28using namespace Kernel;
33 : isisRaw(), m_filename(), m_numberOfSpectra(0), m_noTimeRegimes(0), m_cache_options(), m_specTimeRegimes(),
34 m_prog(0.0), m_lengthIn(0), m_perioids(), m_total_specs(0), m_timeChannelsVec() {}
39 auto mustBePositive = std::make_shared<BoundedValidator<int>>();
40 mustBePositive->setLower(1);
41 declareProperty(
"SpectrumMin", 1, mustBePositive,
"The number of the first spectrum to read.");
44 "A comma-separated list of individual spectra to read. Only used if "
69 throw std::invalid_argument(
"Incorrect file type encountered.");
87 auto channelsVec = std::make_shared<HistogramData::HistogramX>(1, 0);
91 int64_t histCurrent = -1;
95 Run &run = localWorkspace->mutableRun();
98 const int period_number = 1;
115 std::stringstream prevPeriod;
116 prevPeriod <<
"PERIOD " << (period);
117 Run &runObj = localWorkspace->mutableRun();
119 runObj.removeLogData(
"current_period");
121 const int period_number = period + 1;
126 const int64_t periodTimesNSpectraP1 = period * (
static_cast<int64_t
>(
m_numberOfSpectra) + 1);
127 skipData(file, periodTimesNSpectraP1);
130 int64_t histToRead = i + periodTimesNSpectraP1;
137 throw std::runtime_error(
"Error reading raw file");
139 int64_t binStart = 0;
144 if (++histCurrent % 100 == 0) {
145 m_prog = double(histCurrent) / histTotal;
#define DECLARE_ALGORITHM(classname)
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
void interruption_point()
This is called during long-running operations, and check if the algorithm has requested that it be ca...
void removeLogData(const std::string &name, const bool delproperty=true)
Remove a named log entry.
This class stores information regarding an experimental run as a series of log entries.
std::shared_ptr< ISISRAW2 > isisRaw
ISISRAW class instance which does raw file reading.
std::string m_filename
The name and path of the input file.
int64_t m_noTimeRegimes
number of time regime
double m_prog
The current value of the progress counter.
void init() override
Overwrites Algorithm method.
int64_t m_lengthIn
Read in the time bin boundaries.
std::vector< std::shared_ptr< HistogramData::HistogramX > > m_timeChannelsVec
time channel vector
void exec() override
Overwrites Algorithm method.
specnum_t m_numberOfSpectra
The number of spectra in the raw file.
LoadRawBin0()
Default constructor.
void setOptionalProperties()
This sets the optional property to the LoadRawHelper class.
specnum_t m_total_specs
total number of specs
void readTitle(FILE *file, std::string &title)
Reads title from the isisraw class.
void skipData(FILE *file, int hist)
skips histrogram data from raw file.
static void setWorkspaceProperty(const std::string &propertyName, const std::string &title, const API::WorkspaceGroup_sptr &grpws_sptr, const DataObjects::Workspace2D_sptr &ws_sptr, int64_t numberOfPeriods, bool bMonitor, API::Algorithm *const pAlg)
sets the workspace property
static DataObjects::Workspace2D_sptr createWorkspace(const DataObjects::Workspace2D_sptr &ws_sptr, int64_t nVectors=-1, int64_t xLengthIn=-1, int64_t yLengthIn=-1)
creates shared pointer to workspace from parent workspace
void init() override
Overwrites Algorithm method.
specnum_t m_spec_max
The value of the spectrum_max property.
std::vector< specnum_t > m_spec_list
The value of the spectrum_list property.
bool readData(FILE *file, int hist)
reads data
void createPeriodLogs(int64_t period, const DataObjects::Workspace2D_sptr &local_workspace)
Create the period specific logs.
specnum_t m_spec_min
The value of the spectrum_min property.
void runLoadLog(const std::string &fileName, const DataObjects::Workspace2D_sptr &, double, double)
load log algorithm
FILE * openRawFile(const std::string &fileName)
Opens Raw File.
void readworkspaceParameters(specnum_t &numberOfSpectra, int &numberOfPeriods, int64_t &lengthIn, int64_t &noTimeRegimes)
reads workspace parameters like number of histograms,size of vectors etc
bool m_list
Has the spectrum_list property been set?
void setProtonCharge(API::Run &run)
set proton charge
static API::WorkspaceGroup_sptr createGroupWorkspace()
creates shared pointer to group workspace
specnum_t calculateWorkspaceSize()
calculate workspace size
void setWorkspaceData(const DataObjects::Workspace2D_sptr &newWorkspace, const std::vector< std::shared_ptr< HistogramData::HistogramX > > &timeChannelsVec, int64_t wsIndex, specnum_t nspecNum, int64_t noTimeRegimes, int64_t lengthIn, int64_t binStart)
This method sets the raw file data to workspace vectors.
void checkOptionalProperties()
Validates the optional 'spectra to read' properties, if they have been set.
int m_numberOfPeriods
The number of periods in the raw file.
Support for a property that holds an array of values.
bool isAscii() const
Returns true if the descriptor is looking at an ascii file.
void error(const std::string &msg)
Logs at error level.
std::shared_ptr< WorkspaceGroup > WorkspaceGroup_sptr
shared pointer to Mantid::API::WorkspaceGroup
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< Workspace2D > Workspace2D_sptr
shared pointer to Mantid::DataObjects::Workspace2D
constexpr int EMPTY_INT() noexcept
Returns what we consider an "empty" integer within a property.
int32_t specnum_t
Typedef for a spectrum Number.