21using namespace Kernel;
23using namespace DataObjects;
48 algLoadEventNexus->initialize();
50 algDetermineChunking->initialize();
56 declareProperty(
"CompressTOFTolerance", .01);
63 std::string grp1 =
"Filter Events";
64 setPropertyGroup(
"FilterByTofMin", grp1);
65 setPropertyGroup(
"FilterByTofMax", grp1);
66 setPropertyGroup(
"FilterByTimeStart", grp1);
67 setPropertyGroup(
"FilterByTimeStop", grp1);
77 setPropertySettings(
"MonitorsLoadOnly", std::make_unique<VisibleWhenProperty>(
"LoadMonitors",
IS_EQUAL_TO,
"1"));
78 auto asEventsIsOn = [] {
79 std::unique_ptr<IPropertySettings> settings =
80 std::make_unique<VisibleWhenProperty>(
"MonitorsLoadOnly",
IS_EQUAL_TO,
"1");
83 setPropertySettings(
"FilterMonByTofMin", asEventsIsOn());
84 setPropertySettings(
"FilterMonByTofMax", asEventsIsOn());
85 setPropertySettings(
"FilterMonByTimeStart", asEventsIsOn());
86 setPropertySettings(
"FilterMonByTimeStop", asEventsIsOn());
88 std::string grp4 =
"Monitors";
89 setPropertyGroup(
"LoadMonitors", grp4);
90 setPropertyGroup(
"MonitorsLoadOnly", grp4);
91 setPropertyGroup(
"FilterMonByTofMin", grp4);
92 setPropertyGroup(
"FilterMonByTofMax", grp4);
93 setPropertyGroup(
"FilterMonByTimeStart", grp4);
94 setPropertyGroup(
"FilterMonByTimeStop", grp4);
96 auto range = std::make_shared<BoundedValidator<double>>();
97 range->setBounds(0., 100.);
98 declareProperty(
"FilterBadPulses", 95., range);
106 alg->setProperty(
"Filename", filename);
107 alg->setProperty(
"MaxChunkSize", maxChunkSize);
108 alg->executeAsChildAlg();
111 if (chunkingTable->rowCount() > 1)
112 g_log.
information() <<
"Will load data in " << chunkingTable->rowCount() <<
" chunks\n";
116 return chunkingTable;
121 g_log.
debug() <<
"loadChunk(" << rowIndex <<
")\n";
124 double progStart =
static_cast<double>(rowIndex) / rowCount;
125 double progStop =
static_cast<double>(rowIndex + 1) / rowCount;
128 alg->setProperty<
string>(
"Filename",
getProperty(
"Filename"));
129 alg->setProperty<
double>(
"FilterByTofMin",
getProperty(
"FilterByTofMin"));
130 alg->setProperty<
double>(
"FilterByTofMax",
getProperty(
"FilterByTofMax"));
131 alg->setProperty<
double>(
"FilterByTimeStart",
getProperty(
"FilterByTimeStart"));
132 alg->setProperty<
double>(
"FilterByTimeStop",
getProperty(
"FilterByTimeStop"));
134 alg->setProperty<
string>(
"NXentryName",
getProperty(
"NXentryName"));
135 alg->setProperty<
bool>(
"LoadMonitors",
getProperty(
"LoadMonitors"));
136 alg->setProperty<
string>(
"MonitorsLoadOnly",
getProperty(
"MonitorsLoadOnly"));
137 alg->setProperty<
double>(
"FilterMonByTofMin",
getProperty(
"FilterMonByTofMin"));
138 alg->setProperty<
double>(
"FilterMonByTofMax",
getProperty(
"FilterMonByTofMax"));
139 alg->setProperty<
double>(
"FilterMonByTimeStart",
getProperty(
"FilterMonByTimeStart"));
140 alg->setProperty<
double>(
"FilterMonByTimeStop",
getProperty(
"FilterMonByTimeStop"));
148 const double filterByTimeStart =
getProperty(
"FilterByTimeStart");
149 const double filterByTimeStop =
getProperty(
"FilterByTimeStop");
150 const double filterMonByTimeStart =
getProperty(
"FilterMonByTimeStart");
151 const double filterMonByTimeStop =
getProperty(
"FilterMonByTimeStop");
152 loadLogs = (!isEmpty(filterByTimeStart)) || (!isEmpty(filterByTimeStop)) || (!isEmpty(filterMonByTimeStart)) ||
153 (!isEmpty(filterMonByTimeStop));
155 alg->setProperty<
bool>(
"LoadLogs", loadLogs);
159 const std::vector<string> COL_NAMES =
m_chunkingTable->getColumnNames();
160 for (
const auto &
name : COL_NAMES) {
165 alg->executeAsChildAlg();
167 return std::dynamic_pointer_cast<MatrixWorkspace>(wksp);
178 filterBadPulsesAlgo->setProperty(
"InputWorkspace", eventWS);
179 filterBadPulsesAlgo->setProperty(
"OutputWorkspace", eventWS);
181 filterBadPulsesAlgo->executeAsChildAlg();
182 eventWS = filterBadPulsesAlgo->getProperty(
"OutputWorkspace");
186 compressEvents->setProperty(
"InputWorkspace", eventWS);
187 compressEvents->setProperty(
"OutputWorkspace", eventWS);
188 compressEvents->setProperty<
double>(
"Tolerance",
getProperty(
"CompressTOFTolerance"));
189 compressEvents->executeAsChildAlg();
190 eventWS = compressEvents->getProperty(
"OutputWorkspace");
204 Progress progress(
this, 0.0, 1.0, 2);
207 progress.
report(
"Loading Chunk");
209 progress.
report(
"Process Chunk");
217 for (
size_t i = 1; i < numRows; ++i) {
223 removeLogsAlg->setProperty(
"Workspace", temp);
224 removeLogsAlg->executeAsChildAlg();
225 temp = removeLogsAlg->getProperty(
"Workspace");
229 plusAlg->setProperty(
"LHSWorkspace", resultWS);
230 plusAlg->setProperty(
"RHSWorkspace", temp);
231 plusAlg->setProperty(
"OutputWorkspace", resultWS);
232 plusAlg->setProperty(
"ClearRHSWorkspace",
true);
233 plusAlg->executeAsChildAlg();
234 resultWS = plusAlg->getProperty(
"OutputWorkspace");
242 if (totalEventWS->getNEvents())
243 totalEventWS->resetAllXToSingleBin();
248 setProperty(
"OutputWorkspace", total);
251Parallel::ExecutionMode
253 static_cast<void>(storageModes);
254 return Parallel::ExecutionMode::Distributed;
#define DECLARE_ALGORITHM(classname)
Workspace_sptr assemble(Workspace_sptr partialWS)
Assemble the partial workspaces from all MPI processes.
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.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
LoadEventAndCompress : TODO: DESCRIPTION.
const std::string name() const override
Algorithms name for identification.
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.
Parallel::ExecutionMode getParallelExecutionMode(const std::map< std::string, Parallel::StorageMode > &storageModes) const override
int version() const override
Algorithm's version for identification.
API::MatrixWorkspace_sptr processChunk(API::MatrixWorkspace_sptr &wksp)
Process a chunk in-place.
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