21using namespace Kernel;
23using namespace DataObjects;
47 auto algLoadEventNexus = AlgorithmManager::Instance().createUnmanaged(
"LoadEventNexus");
48 algLoadEventNexus->initialize();
49 auto algDetermineChunking = AlgorithmManager::Instance().createUnmanaged(
"DetermineChunking");
50 algDetermineChunking->initialize();
56 declareProperty(
"CompressTOFTolerance", .01);
58 setPropertyGroup(
"CompressBinningMode",
"");
65 std::string grp1 =
"Filter Events";
66 setPropertyGroup(
"FilterByTofMin", grp1);
67 setPropertyGroup(
"FilterByTofMax", grp1);
68 setPropertyGroup(
"FilterByTimeStart", grp1);
69 setPropertyGroup(
"FilterByTimeStop", grp1);
79 setPropertySettings(
"MonitorsLoadOnly", std::make_unique<VisibleWhenProperty>(
"LoadMonitors",
IS_EQUAL_TO,
"1"));
80 auto asEventsIsOn = [] {
81 std::unique_ptr<IPropertySettings> settings =
82 std::make_unique<VisibleWhenProperty>(
"MonitorsLoadOnly",
IS_EQUAL_TO,
"1");
85 setPropertySettings(
"FilterMonByTofMin", asEventsIsOn());
86 setPropertySettings(
"FilterMonByTofMax", asEventsIsOn());
87 setPropertySettings(
"FilterMonByTimeStart", asEventsIsOn());
88 setPropertySettings(
"FilterMonByTimeStop", asEventsIsOn());
90 std::string grp4 =
"Monitors";
91 setPropertyGroup(
"LoadMonitors", grp4);
92 setPropertyGroup(
"MonitorsLoadOnly", grp4);
93 setPropertyGroup(
"FilterMonByTofMin", grp4);
94 setPropertyGroup(
"FilterMonByTofMax", grp4);
95 setPropertyGroup(
"FilterMonByTimeStart", grp4);
96 setPropertyGroup(
"FilterMonByTimeStop", grp4);
98 auto range = std::make_shared<BoundedValidator<double>>();
99 range->setBounds(0., 100.);
100 declareProperty(
"FilterBadPulses", 95., range);
108 alg->setProperty(
"Filename", filename);
109 alg->setProperty(
"MaxChunkSize", maxChunkSize);
110 alg->executeAsChildAlg();
113 if (chunkingTable->rowCount() > 1)
114 g_log.
information() <<
"Will load data in " << chunkingTable->rowCount() <<
" chunks\n";
118 return chunkingTable;
123 g_log.
debug() <<
"loadChunk(" << rowIndex <<
")\n";
129 progStart =
static_cast<double>(rowIndex) / rowCount;
130 progStop =
static_cast<double>(rowIndex + 1) / rowCount;
134 alg->setProperty<
string>(
"Filename",
getProperty(
"Filename"));
135 alg->setProperty<
double>(
"FilterByTofMin",
getProperty(
"FilterByTofMin"));
136 alg->setProperty<
double>(
"FilterByTofMax",
getProperty(
"FilterByTofMax"));
137 alg->setProperty<
double>(
"FilterByTimeStart",
getProperty(
"FilterByTimeStart"));
138 alg->setProperty<
double>(
"FilterByTimeStop",
getProperty(
"FilterByTimeStop"));
140 alg->setProperty<
string>(
"NXentryName",
getProperty(
"NXentryName"));
141 alg->setProperty<
bool>(
"LoadMonitors",
getProperty(
"LoadMonitors"));
142 alg->setProperty<
string>(
"MonitorsLoadOnly",
getProperty(
"MonitorsLoadOnly"));
143 alg->setProperty<
double>(
"FilterMonByTofMin",
getProperty(
"FilterMonByTofMin"));
144 alg->setProperty<
double>(
"FilterMonByTofMax",
getProperty(
"FilterMonByTofMax"));
145 alg->setProperty<
double>(
"FilterMonByTimeStart",
getProperty(
"FilterMonByTimeStart"));
146 alg->setProperty<
double>(
"FilterMonByTimeStop",
getProperty(
"FilterMonByTimeStop"));
147 alg->setProperty<
double>(
"CompressTolerance",
getProperty(
"CompressTOFTolerance"));
148 alg->setProperty<
string>(
"CompressBinningMode",
getProperty(
"CompressBinningMode"));
149 alg->setProperty<
int>(
"NumberOfBins", 1);
160 const double filterByTimeStart =
getProperty(
"FilterByTimeStart");
161 const double filterByTimeStop =
getProperty(
"FilterByTimeStop");
162 const double filterMonByTimeStart =
getProperty(
"FilterMonByTimeStart");
163 const double filterMonByTimeStop =
getProperty(
"FilterMonByTimeStop");
164 loadLogs = (!isEmpty(filterByTimeStart)) || (!isEmpty(filterByTimeStop)) || (!isEmpty(filterMonByTimeStart)) ||
165 (!isEmpty(filterMonByTimeStop));
167 alg->setProperty<
bool>(
"LoadLogs", loadLogs);
171 const std::vector<string> COL_NAMES =
m_chunkingTable->getColumnNames();
172 for (
const auto &colName : COL_NAMES) {
173 alg->setProperty(colName,
m_chunkingTable->getRef<
int>(colName, rowIndex));
177 alg->executeAsChildAlg();
179 return std::dynamic_pointer_cast<MatrixWorkspace>(wksp);
191 Progress progress(
this, 0.0, 1.0, 2);
194 progress.
report(
"Loading Chunk");
202 for (
size_t i = 1; i < numRows; ++i) {
207 removeLogsAlg->setProperty(
"Workspace", temp);
208 removeLogsAlg->executeAsChildAlg();
209 temp = removeLogsAlg->getProperty(
"Workspace");
213 plusAlg->setProperty(
"LHSWorkspace", resultWS);
214 plusAlg->setProperty(
"RHSWorkspace", temp);
215 plusAlg->setProperty(
"OutputWorkspace", resultWS);
216 plusAlg->setProperty(
"ClearRHSWorkspace",
true);
217 plusAlg->executeAsChildAlg();
218 resultWS = plusAlg->getProperty(
"OutputWorkspace");
225 if (totalEventWS->getNEvents())
226 totalEventWS->resetAllXToSingleBin();
231 setProperty(
"OutputWorkspace", resultWS);
#define DECLARE_ALGORITHM(classname)
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) override
Create a Child Algorithm.
void copyProperty(const API::Algorithm_sptr &alg, const std::string &name)
Copy a property from an existing algorithm.
Kernel::IPropertyManager::TypedValue getProperty(const std::string &name) const override
Get the property held by this object.
std::string getPropertyValue(const std::string &name) const override
Get the property held by this object.
Helper class for reporting progress from algorithms.
void debug(const std::string &msg)
Logs at debug level.
void information(const std::string &msg)
Logs at information level.
void resetNumSteps(int64_t nsteps, double start, double end)
Change the number of steps between start/end.
void report()
Increments the loop counter by 1, then sends the progress notification on behalf of its algorithm.
LoadEventAndCompress : TODO: DESCRIPTION.
API::MatrixWorkspace_sptr loadChunk(const size_t rowIndex) override
void init() override
Initialize the algorithm's properties.
const std::string summary() const override
Algorithm's summary for use in the GUI and help.
API::ITableWorkspace_sptr m_chunkingTable
API::ITableWorkspace_sptr determineChunk(const std::string &filename) override
void exec() override
Execute the algorithm.
int version() const override
Algorithm's version for identification.
const std::string category() const override
Algorithm's category for identification.
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< Workspace > Workspace_sptr
shared pointer to Mantid::API::Workspace
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< EventWorkspace > EventWorkspace_sptr
shared pointer to the EventWorkspace class