23#include <boost/algorithm/string/predicate.hpp>
32inline std::string alternateDataStream(
const std::filesystem::path &filePath) {
33 return filePath.string() +
":checksum";
42inline bool hasAlternateDataStream(
const std::filesystem::path &pathToFile) {
43 std::ifstream adsStream(alternateDataStream(pathToFile));
51inline bool hasAlternateDataStream([[maybe_unused]]
const std::filesystem::path &pathToFile) {
return false; }
61std::set<std::string> logFilesFromAlternateDataStream(
const std::filesystem::path &pathToRawFile) {
62 std::set<std::string> logfilesList;
63 std::ifstream adsStream(alternateDataStream(pathToRawFile));
76 std::filesystem::path dirOfFile = pathToRawFile.parent_path();
79 if (boost::algorithm::iends_with(line,
".txt") || boost::algorithm::iends_with(line,
".log")) {
80 const size_t asteriskPos = line.find(
'*');
81 if (asteriskPos == std::string::npos)
83 std::filesystem::path logFilePath = dirOfFile / line.substr(asteriskPos + 1);
84 if (std::filesystem::exists(logFilePath)) {
85 logfilesList.insert(logFilePath.string());
96using namespace Kernel;
98using Types::Core::DateAndTime;
102 : m_list(false), m_interval(false), m_spec_list(), m_spec_min(0), m_spec_max(
EMPTY_INT()), m_numberOfPeriods(0),
103 m_isis_raw(), m_cache_options(), m_specTimeRegimes(), m_prog(0.0), m_numberOfSpectra(0), m_monitordetectorList(),
104 m_bmspeclist(false), m_total_specs(0), m_logCreator() {}
111 const std::vector<std::string> exts{
".raw",
".s*",
".add"};
113 "The name of the RAW file to read, including its full or "
114 "relative path. The file extension must be .raw or .RAW "
115 "(N.B. case sensitive if running on Linux).");
117 "The name of the workspace that will be created, filled with "
118 "the read-in data and stored in the Analysis Data Service. "
119 "If the input RAW file contains multiple periods higher "
120 "periods will be stored in separate workspaces called "
121 "OutputWorkspace_PeriodNo.");
127 "An option allowing the algorithm to cache a remote file on "
128 "the local drive before loading. When \"If Slow\" is set the "
129 "download speed is estimated and if is deemed as slow the "
130 "file is cached. \"Always\" means always cache a remote file "
131 "and \"Never\" - never cache.");
134 "Boolean option to load or skip log files. If this option is "
135 "set all the log files associated with the selected raw file "
136 "are loaded into workspace and can be displayed using right "
137 "click menu item Sample Logs...on the selected "
138 "workspace.\nNote: If the log files contain motor positions, "
139 "etc. that would affect the instrument geometry this option "
140 "must be set to true for these adjustments to be applied to "
141 "the instrument geometry.");
148 FILE *file = fopen(fileName.c_str(),
"rb");
149 if (file ==
nullptr) {
157 std::stringstream os;
158 os <<
"File \"" << fileName
159 <<
"\" is not a valid RAW file. The first 256 bytes suggest it is an "
161 throw std::invalid_argument(os.str());
172 title = std::string(
isisRaw().r_title, 80);
230 int64_t &noTimeRegimes) {
238 lengthIn = channelsPerSpectrum + 1;
250 int64_t nVectors, int64_t xLengthIn, int64_t yLengthIn) {
269 const std::string &title) {
272 workspace = std::dynamic_pointer_cast<DataObjects::Workspace2D>(
275 workspace->getAxis(0)->unit() = UnitFactory::Instance().create(
"TOF");
296 const int64_t nwsSpecs,
const int64_t numberOfPeriods,
297 const int64_t lengthIn,
const std::string &title,
305 monws_sptr =
createWorkspace(normalws_sptr, mwsSpecs, lengthIn, lengthIn - 1);
319 std::string monitorwsName = wsName +
"_monitors";
322 setWorkspaceProperty(
"MonitorWorkspace", title, mongrp_sptr, monws_sptr, numberOfPeriods,
true, pAlg);
326 setWorkspaceProperty(
"OutputWorkspace", title, mongrp_sptr, monws_sptr, numberOfPeriods,
false, pAlg);
329 }
catch (std::out_of_range &) {
330 pAlg->
getLogger().
debug() <<
"Error in creating monitor workspace\n";
331 }
catch (std::runtime_error &) {
332 pAlg->
getLogger().
debug() <<
"Error in creating monitor workspace\n";
361 std::string outputWorkspace;
362 std::string localWSName = pAlg->
getProperty(
"OutputWorkspace");
363 std::stringstream suffix;
364 suffix << (period + 1);
366 wsName = localWSName +
"_monitors" +
"_" + suffix.str();
367 outputWorkspace =
"MonitorWorkspace";
369 wsName = localWSName +
"_" + suffix.str();
370 outputWorkspace =
"OutputWorkspace";
372 outws = outputWorkspace +
"_" + suffix.str();
374 pAlg->
setProperty(outws, std::static_pointer_cast<Workspace>(ws_sptr));
375 grpws_sptr->addWorkspace(ws_sptr);
399 ws_sptr->setTitle(title);
400 ws_sptr->getAxis(0)->unit() = UnitFactory::Instance().create(
"TOF");
401 if (numberOfPeriods > 1) {
402 pAlg->
setProperty(propertyName, std::dynamic_pointer_cast<Workspace>(grpws_sptr));
404 pAlg->
setProperty(propertyName, std::dynamic_pointer_cast<Workspace>(ws_sptr));
418 const std::vector<std::shared_ptr<HistogramData::HistogramX>> &timeChannelsVec,
419 int64_t wsIndex,
specnum_t nspecNum, int64_t noTimeRegimes, int64_t lengthIn,
425 auto &
Y = newWorkspace->mutableY(wsIndex);
428 newWorkspace->setCountVariances(wsIndex,
Y.rawData());
430 newWorkspace->getSpectrum(wsIndex).setSpectrumNo(nspecNum);
433 newWorkspace->setX(wsIndex, timeChannelsVec[0]);
438 newWorkspace->setX(wsIndex, timeChannelsVec[0]);
442 if (noTimeRegimes < 2)
443 newWorkspace->setX(wsIndex, timeChannelsVec[0]);
447 newWorkspace->setX(wsIndex, timeChannelsVec.at(
m_specTimeRegimes[nspecNum] - 1));
456 std::vector<specnum_t> spectrumIndices;
460 for (
const auto &SpectrumDetectorPair : map) {
461 auto detIDs = SpectrumDetectorPair.second;
464 for (
auto detID : detIDs) {
467 spectrumIndices.emplace_back(SpectrumDetectorPair.first);
472 g_log.
error() <<
"monitor detector id list is empty for the selected workspace\n";
475 return spectrumIndices;
491 const int64_t &lengthIn) {
492 auto const timeChannels =
new float[lengthIn];
495 std::vector<std::shared_ptr<HistogramData::HistogramX>> timeChannelsVec;
497 g_log.
debug() <<
"Raw file contains " << regimes <<
" time regimes\n";
500 for (int64_t i = 0; i < regimes; ++i) {
502 std::shared_ptr<HistogramData::HistogramX> channelsVec(
503 new HistogramData::HistogramX(timeChannels, timeChannels + lengthIn));
504 const double shift = isisRawRef.daep.tr_shift[i];
505 g_log.
debug() <<
"Time regime " << i + 1 <<
" shifted by " << shift <<
" microseconds\n";
507 using std::placeholders::_1;
508 std::transform(channelsVec->begin(), channelsVec->end(), channelsVec->begin(),
509 std::bind(std::plus<double>(), _1, shift));
510 timeChannelsVec.emplace_back(channelsVec);
514 const auto ndet =
static_cast<int64_t
>(isisRawRef.i_det);
516 for (int64_t j = 0; j < ndet; ++j) {
520 hint =
m_specTimeRegimes.insert(hint, std::make_pair(isisRawRef.spec[j], isisRawRef.timr[j]));
524 std::shared_ptr<HistogramData::HistogramX> channelsVec(
525 new HistogramData::HistogramX(timeChannels, timeChannels + lengthIn));
526 timeChannelsVec.emplace_back(channelsVec);
529 delete[] timeChannels;
530 return timeChannelsVec;
539 double progStart,
double progEnd) {
540 g_log.
debug(
"Loading the instrument definition...");
545 size_t i = instrumentID.find_first_of(
' ');
546 if (i != std::string::npos)
547 instrumentID.erase(i);
555 bool executionSuccessful(
true);
557 loadInst->setPropertyValue(
"InstrumentName", instrumentID);
561 }
catch (std::invalid_argument &) {
563 executionSuccessful =
false;
564 }
catch (std::runtime_error &) {
565 g_log.
information(
"Unable to successfully run LoadInstrument Child Algorithm");
566 executionSuccessful =
false;
571 if (!executionSuccessful) {
573 <<
" not found. Attempt to load information about \n"
574 <<
"the instrument from raw data file.\n";
578 const auto &
pmap = localWorkspace->constInstrumentParameters();
579 if (
pmap.contains(localWorkspace->getInstrument()->getComponentID(),
"det-pos-source")) {
580 std::shared_ptr<Geometry::Parameter> updateDets =
581 pmap.get(localWorkspace->getInstrument()->getComponentID(),
"det-pos-source");
582 std::string
value = updateDets->value<std::string>();
583 if (
value.substr(0, 8) ==
"datafile") {
586 updateInst->setPropertyValue(
"Filename", fileName);
592 if (
value ==
"datafile-ignore-phi") {
593 updateInst->setProperty(
"IgnorePhi",
true);
595 "in the data file except for the phi values");
602 updateInst->execute();
607 std::vector<specnum_t>::const_iterator itr;
609 g_log.
debug() <<
"Monitor detector id is " << (*itr) <<
'\n';
621 loadInst->setPropertyValue(
"Filename", fileName);
628 }
catch (std::runtime_error &) {
629 g_log.
error(
"Unable to successfully run LoadInstrumentFromRaw Child Algorithm");
632 std::vector<specnum_t>::const_iterator itr;
634 g_log.
debug() <<
"Monitor dtector id is " << (*itr) <<
'\n';
636 if (!loadInst->isExecuted()) {
637 g_log.
error(
"No instrument definition loaded");
646 g_log.
debug(
"Loading the spectra-detector mapping...");
652 loadmap->setPropertyValue(
"Filename", fileName);
656 }
catch (std::runtime_error &) {
657 g_log.
error(
"Unable to successfully execute LoadMappingTable Child Algorithm");
660 if (!loadmap->isExecuted()) {
661 g_log.
error(
"LoadMappingTable Child Algorithm is not executed");
671 double progStart,
double progEnd) {
673 std::list<std::string> logFiles =
searchForLogFiles(std::filesystem::path(fileName));
676 if (progStart < progEnd) {
683 std::list<std::string>::const_iterator logPath;
684 for (logPath = logFiles.begin(); logPath != logFiles.end(); ++logPath) {
686 std::string statusSuffix =
"ICPstatus.txt";
687 if (boost::algorithm::iends_with(*logPath, statusSuffix)) {
692 std::string debugSuffix =
"ICPdebug.txt";
693 if (boost::algorithm::iends_with(*logPath, debugSuffix)) {
698 std::string alarmSuffix =
"ICPalarm.txt";
699 if (boost::algorithm::iends_with(*logPath, alarmSuffix)) {
710 loadLog->setPropertyValue(
"Filename", *logPath);
717 if (boost::algorithm::iends_with(*logPath,
"ICPevent.txt")) {
718 loadLog->setPropertyValue(
"NumberOfColumns",
"2");
723 if (progStart < progEnd) {
730 loadLog->setLogging(
false);
732 if (!loadLog->isExecuted())
733 g_log.
warning(
"Unable to successfully run LoadLog Child Algorithm");
735 }
catch (std::exception &ex) {
736 g_log.
warning(
"Unable to successfully run LoadLog Child Algorithm: ");
743 m_logCreator->addStatusLog(localWorkspace->mutableRun());
753 std::string fileName = std::filesystem::path(path).stem().string();
755 return (fileName.substr(fileName.find(
'_') + 1));
764 m_logCreator->addPeriodLogs(
static_cast<int>(period), local_workspace->mutableRun());
782 API::Run &runDetails = localWorkspace->mutableRun();
832 runDetails.
addProperty(
"run_end", endTime.toISO8601String());
835 runDetails.
addProperty(
"run_start", startTime.toISO8601String());
845 if (isisDate[0] ==
' ')
858 if (isisDate[0] ==
' ')
868 std::transform(month.begin(), month.end(), month.begin(), toupper);
895 throw std::runtime_error(
"LoadRawHelper::convertMonthLabelToIntStr(): Invalid month label found.");
905 m_spec_list.assign(spec_list.begin(), spec_list.end());
930 throw std::invalid_argument(
"Inconsistent properties defined");
941 g_log.
error(
"Invalid Spectrum min/max properties");
942 throw std::invalid_argument(
"Inconsistent properties defined");
994 monitorwsSpecs =
static_cast<specnum_t>(monitorSpecList.size());
996 g_log.
debug() <<
"normalwsSpecs when m_interval & m_bmspeclist are false is " << normalwsSpecs
997 <<
" monitorwsSpecs is " << monitorwsSpecs <<
'\n';
1000 const auto msize = std::count_if(monitorSpecList.cbegin(), monitorSpecList.cend(),
1001 [&](
const auto &spec) { return (spec >= m_spec_min && spec < m_spec_max); });
1002 monitorwsSpecs =
static_cast<specnum_t>(msize);
1004 g_log.
debug() <<
"normalwsSpecs when m_interval true is " << normalwsSpecs <<
" monitorwsSpecs is "
1005 << monitorwsSpecs <<
'\n';
1018 g_log.
debug() <<
"normalwsSpecs is " << normalwsSpecs <<
" monitorwsSpecs is " << monitorwsSpecs <<
'\n';
1024 const auto monitr = find(monitorSpecList.begin(), monitorSpecList.end(), *itr);
1025 if (monitr != monitorSpecList.end())
1028 monitorwsSpecs += monCounter;
1030 g_log.
debug() <<
"normalwsSpecs is " << normalwsSpecs <<
" monitorwsSpecs is " << monitorwsSpecs <<
'\n';
1035 std::vector<specnum_t>::const_iterator itr;
1036 std::vector<specnum_t>::const_iterator monitr;
1038 monitr = find(monitorSpecList.begin(), monitorSpecList.end(), *itr);
1039 if (monitr != monitorSpecList.end()) {
1043 monitorwsSpecs = mSize;
1052 const std::vector<std::shared_ptr<HistogramData::HistogramX>> &timeChannelsVec) {
1053 double progStart =
m_prog;
1054 double progEnd = 1.0;
1056 int64_t histCurrent = -1;
1057 int64_t wsIndex = 0;
1058 const auto &isisRawRef =
isisRaw();
1059 auto numberOfPeriods =
static_cast<int64_t
>(isisRawRef.t_nper);
1060 auto histTotal =
static_cast<double>(total_specs * numberOfPeriods);
1062 auto lengthIn =
static_cast<int64_t
>(isisRawRef.t_ntc1 + 1);
1064 const int64_t periodTimesNSpectraP1 = period * (
static_cast<int64_t
>(
m_numberOfSpectra) + 1);
1067 int64_t histToRead = i + periodTimesNSpectraP1;
1074 throw std::runtime_error(
"Error reading raw file, in "
1075 "LoadRawHelper::loadSpectra, readData failed");
1077 setWorkspaceData(ws_sptr, timeChannelsVec, wsIndex, i, noTimeRegimes, lengthIn, 1);
1080 if (numberOfPeriods == 1) {
1081 if (++histCurrent % 100 == 0) {
1082 m_prog = progStart + (progEnd - progStart) * (
static_cast<double>(histCurrent) / histTotal);
1099 auto &stream = descriptor.
data();
1101 stream.seekg(84, std::ios::beg);
1102 int c = stream.get();
1105 stream.seekg(3, std::ios::cur);
1122 std::set<std::string> potentialLogFiles;
1125 std::list<std::string> potentialLogFilesList;
1129 if (std::filesystem::is_directory(pathToRawFile)) {
1136 const auto fileExt = pathToRawFile.extension().string().substr(1);
1137 if (boost::algorithm::iequals(fileExt,
".log") || boost::algorithm::iequals(fileExt,
".txt")) {
1139 potentialLogFiles.insert(pathToRawFile.string());
1144 if (hasAlternateDataStream(pathToRawFile)) {
1146 potentialLogFiles = logFilesFromAlternateDataStream(pathToRawFile);
1149 std::filesystem::path pattern = pathToRawFile.parent_path() / (pathToRawFile.stem().string() +
"_*.txt");
1152 }
catch (std::exception &) {
1155 std::filesystem::path combinedLogPath = pathToRawFile;
1156 combinedLogPath.replace_extension(
".log");
1157 if (std::filesystem::exists(combinedLogPath)) {
1159 if (pathToRawFile.parent_path().string() ==
".")
1160 potentialLogFilesList.insert(potentialLogFilesList.end(), combinedLogPath.filename().string());
1162 potentialLogFilesList.insert(potentialLogFilesList.end(), combinedLogPath.string());
1167 potentialLogFilesList.insert(potentialLogFilesList.begin(), potentialLogFiles.begin(), potentialLogFiles.end());
1169 return potentialLogFilesList;
1202 std::string monitorOption = pAlgo->
getProperty(
"LoadMonitors");
1203 if (monitorOption ==
"1")
1204 monitorOption =
"Separate";
1205 if (monitorOption ==
"0")
1206 monitorOption =
"Exclude";
1209 bseparateMonitors =
false;
1210 bexcludeMonitors =
false;
1211 if (!bincludeMonitors) {
double value
The value of the point.
IPeaksWorkspace_sptr workspace
void skipData(FILE *file, int i)
Skip data.
int ioRAW(FILE *file, bool from_file, bool read_data=true) override
Loads the headers of the file, leaves the file pointer at a specific position.
bool readData(FILE *file, int i)
Read data.
HDR_STRUCT hdr
header block (80 bytes)
int getTimeChannels(float *rtcb1, int n)
rtcb1 is of size t_ntc1+1
char i_inst[8]
instrument name
DAEP_STRUCT daep
DAE parameter block (size 64*4 bytes)
int t_nper
number of periods
int t_nsp1
number of spectra in time regime 1
RPB_STRUCT rpb
run parameter block (32*4 bytes)
int t_ntc1
number of time channels in time regime 1
Base class from which all concrete algorithm classes should be derived.
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
void setChildEndProgress(const double endProgress) const override
setting the child end progress
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.
virtual std::shared_ptr< Algorithm > createChildAlgorithm(const std::string &name, const double startProgress=-1., const double endProgress=-1., const bool enableLogging=true, const int &version=-1)
Create a Child Algorithm.
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
void setChildStartProgress(const double startProgress) const override
setting the child start progress
void interruption_point()
This is called during long-running operations, and check if the algorithm has requested that it be ca...
Kernel::Logger & getLogger() const
Returns a reference to the logger.
const Poco::AbstractObserver & progressObserver() const
Return a reference to the algorithm's object that is reporting progress.
@ Load
allowed here which will be passed to the algorithm
Defines a class to aid in creating ISIS specific run logs for periods, status etc.
void addLogData(Kernel::Property *p)
Add a log entry.
void addProperty(Kernel::Property *prop, bool overwrite=false)
Add data to the object in the form of a property.
This class stores information regarding an experimental run as a series of log entries.
void setProtonCharge(const double charge)
Set the proton charge.
A minimal class to hold the mapping between the spectrum number and its related detector ID numbers f...
const sdmap & getMapping() const
Class to hold a set of workspaces.
A property class for workspaces.
int confidence(Kernel::FileDescriptor &descriptor) const override
Returns a confidence value that this algorithm can load a file.
void ioRaw(FILE *file, bool from_file)
calls isisRaw ioraw
bool m_interval
Have the spectrum_min/max properties been set?
std::vector< std::shared_ptr< HistogramData::HistogramX > > getTimeChannels(const int64_t ®imes, const int64_t &lengthIn)
Constructs the time channel (X) vector(s)
void reset()
resets the isisraw shared pointer
void calculateWorkspacesizes(const std::vector< specnum_t > &monitorSpecList, specnum_t &normalwsSpecs, specnum_t &monitorwsSpecs)
calculate workspace sizes if separate or exclude monitors are selected
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
specnum_t m_total_specs
the total nuumber of spectra
std::string extractLogName(const std::string &path)
Extract the log name from the path to the specific log file.
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
std::unique_ptr< API::ISISRunLogs > m_logCreator
A ptr to the log creator.
std::map< specnum_t, specnum_t > m_specTimeRegimes
A map for storing the time regime for each spectrum.
static void ProcessLoadMonitorOptions(bool &bincludeMonitors, bool &bseparateMonitors, bool &bexcludeMonitors, const API::Algorithm *pAlgo)
The method to interpret LoadMonitors property options and convert then into boolean values.
static Types::Core::DateAndTime extractEndTime(ISISRAW &isisRaw)
Extract the end time from a raw file.
static bool isSeparateMonitors(const std::string &monitorOption)
returns true if the Separate Monitor Option selected
static void createMonitorWorkspace(DataObjects::Workspace2D_sptr &monws_sptr, const DataObjects::Workspace2D_sptr &normalws_sptr, API::WorkspaceGroup_sptr &mongrp_sptr, const int64_t mwsSpecs, const int64_t nwsSpecs, const int64_t numberOfPeriods, const int64_t lengthIn, const std::string &title, API::Algorithm *const pAlg)
creates monitor workspace
ISISRAW2 & isisRaw() const
return an reference to the ISISRAW2 reader
void init() override
Overwrites Algorithm method.
specnum_t m_spec_max
The value of the spectrum_max property.
bool m_bmspeclist
boolean for list spectra options
double m_prog
The current value of the progress counter.
void exec() override
Overwrites Algorithm method.
std::vector< specnum_t > m_spec_list
The value of the spectrum_list property.
std::vector< std::string > m_cache_options
Allowed values for the cache property.
std::unique_ptr< ISISRAW2 > m_isis_raw
ISISRAW class instance which does raw file reading.
bool readData(FILE *file, int hist)
reads data
void createPeriodLogs(int64_t period, const DataObjects::Workspace2D_sptr &local_workspace)
Create the period specific logs.
int getNumberofTimeRegimes()
number of time regimes
LoadRawHelper()
Default constructor.
void runLoadMappingTable(const std::string &fileName, const DataObjects::Workspace2D_sptr &)
loadinstrumentfromraw Child Algorithm
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
static Types::Core::DateAndTime extractStartTime(ISISRAW &isisRaw)
Extract the start time from a raw file.
static bool isExcludeMonitors(const std::string &monitorOption)
returns true if the Exclude Monitor option(property) selected
void setRunNumber(API::Run &run)
Stores the run number in the sample's logs.
void loadRunParameters(const API::MatrixWorkspace_sptr &localWorkspace, ISISRAW *const =nullptr) const
Read in run parameters Public so that LoadRaw2 can use it.
void runLoadInstrument(const std::string &fileName, const DataObjects::Workspace2D_sptr &, double, double)
loadinstrument Child Algorithm
FILE * openRawFile(const std::string &fileName)
Opens Raw File.
void setOptionalProperties(const int &spec_min, const int &spec_max, const std::vector< int > &spec_list)
sets optional properties like spec_min,spec_max etc
void runLoadInstrumentFromRaw(const std::string &fileName, const DataObjects::Workspace2D_sptr &)
loadinstrumentfromraw algorithm
specnum_t m_numberOfSpectra
number of spectra
static std::list< std::string > searchForLogFiles(const std::filesystem::path &pathToRawFile)
Search for the log files in the workspace, and output their names as a list.
~LoadRawHelper() override
Destructor.
float getProtonCharge() const
get proton charge from raw file
static bool isIncludeMonitors(const std::string &monitorOption)
returns true if the Include Monitor Option selected
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 loadSpectra(FILE *file, const int &period, const int &total_specs, const DataObjects::Workspace2D_sptr &ws_sptr, const std::vector< std::shared_ptr< HistogramData::HistogramX > > &)
load the spectra
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
static std::string convertMonthLabelToIntStr(std::string month)
convert month label to int string
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.
std::vector< specnum_t > getmonitorSpectrumList(const API::SpectrumDetectorMapping &mapping)
gets the monitor spectrum list from the workspace
std::vector< specnum_t > m_monitordetectorList
a vector holding the indexes of monitors
static const std::string runTitle(const ISISRAW &isisRaw)
Return the run title from the raw data structure.
static const std::string runHeader(const ISISRAW &isisRaw)
Return the run header from the raw data structure.
Records the filename and the description of failure.
Defines a wrapper around an open file.
bool isAscii() const
Returns true if the descriptor is looking at an ascii file.
static bool isEmpty(const std::string &filename)
Returns true if the file is empty.
std::istream & data()
Access the open file stream.
static void glob(const std::string &pathPattern, std::set< std::string > &files, int options=0)
Creates a set of files that match the given pathPattern.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
void debug(const std::string &msg)
Logs at debug level.
void error(const std::string &msg)
Logs at error level.
void warning(const std::string &msg)
Logs at warning level.
void information(const std::string &msg)
Logs at information level.
OptionalBool : Tri-state bool.
The concrete, templated class for properties.
Base class for properties.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< WorkspaceGroup > WorkspaceGroup_sptr
shared pointer to Mantid::API::WorkspaceGroup
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< Workspace2D > Workspace2D_sptr
shared pointer to Mantid::DataObjects::Workspace2D
std::unique_ptr< T > create(const P &parent, const IndexArg &indexArg, const HistArg &histArg)
This is the create() method that all the other create() methods call.
MANTID_KERNEL_DLL std::istream & extractToEOL(std::istream &is, std::string &str)
Extract a line from input stream, discarding any EOL characters encountered.
constexpr int EMPTY_INT() noexcept
Returns what we consider an "empty" integer within a property.
int32_t specnum_t
Typedef for a spectrum Number.
Generate a tableworkspace to store the calibration results.
std::string to_string(const wide_integer< Bits, Signed > &n)
char hd_date[12]
start date
char hd_time[8]
start time
char inst_abrv[3]
instrument abbreviated name
char hd_dur[8]
run duration (uA.hour) constructor
char hd_user[20]
user name
@ Output
An output workspace.
int r_dur_secs
actual run duration in seconds
int r_freq
2**k where source frequency = 50 / 2**k
int r_dur_freq
test interval for above (seconds)
int r_mon_sum2
monitor sum 2
char r_endtime[8]
format HH-MM-SS
int r_dmp_units
scaler for above
char r_enddate[12]
format DD-MMM-YYYY
int r_dur_wanted
requested run duration (units as for "duration" above)
float r_gd_prtn_chrg
good proton charge (uA.hour)
int r_durunits
scaler for above (1=seconds)
int r_mon_sum1
monitor sum 1
int r_dmp_freq
test interval for above
int r_mon_sum3
monitor sum 3
int r_dur
actual run duration
int r_prop
RB (proposal) number.
float r_tot_prtn_chrg
total proton charge (uA.hour)