Mantid
Loading...
Searching...
No Matches
LoadDiffCal.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
8
11#include "MantidAPI/Progress.h"
12#include "MantidAPI/Run.h"
13#include "MantidAPI/TableRow.h"
22#include "MantidKernel/Unit.h"
23#include "MantidNexus/H5Util.h"
24
25#include <H5Cpp.h>
26#include <cmath>
27#include <filesystem>
28
29namespace Mantid::DataHandling {
30
40using Mantid::Kernel::compareStringsCaseInsensitive;
45
46using namespace H5;
47using namespace Nexus;
48
49namespace {
50enum class CalibFilenameExtensionEnum { H5, HD5, HDF, CAL, enum_count };
51const std::vector<std::string> calibFilenameExtensions{".h5", ".hd5", ".hdf", ".cal"};
52typedef EnumeratedString<CalibFilenameExtensionEnum, &calibFilenameExtensions, &compareStringsCaseInsensitive>
53 CalibFilenameExtension;
54
55enum class GroupingFilenameExtensionEnum { XML, H5, HD5, HDF, CAL, enum_count };
56const std::vector<std::string> groupingFilenameExtensions{".xml", ".h5", ".hd5", ".hdf", ".cal"};
57typedef EnumeratedString<GroupingFilenameExtensionEnum, &groupingFilenameExtensions, &compareStringsCaseInsensitive>
58 GroupingFilenameExtension;
59
60namespace PropertyNames {
61const std::string CAL_FILE("Filename");
62const std::string GROUP_FILE("GroupFilename");
63const std::string MAKE_CAL("MakeCalWorkspace");
64const std::string MAKE_GRP("MakeGroupingWorkspace");
65const std::string MAKE_MSK("MakeMaskWorkspace");
66} // namespace PropertyNames
67} // namespace
68
69// Register the algorithm into the AlgorithmFactory
70DECLARE_ALGORITHM(LoadDiffCal)
71
72
73const std::string LoadDiffCal::name() const { return "LoadDiffCal"; }
74
76int LoadDiffCal::version() const { return 1; }
77
79const std::string LoadDiffCal::category() const { return "DataHandling\\Instrument;Diffraction\\DataHandling"; }
80
82const std::string LoadDiffCal::summary() const { return "Loads a calibration file for powder diffraction"; }
83
87 // 3 properties for getting the right instrument
89
91 std::make_unique<FileProperty>(PropertyNames::CAL_FILE, "", FileProperty::Load, calibFilenameExtensions),
92 "Path to the input calibration file.");
93
94 declareProperty(std::make_unique<FileProperty>(PropertyNames::GROUP_FILE, "", FileProperty::OptionalLoad,
95 groupingFilenameExtensions),
96 "Overrides grouping from CalFileName");
97
98 declareProperty(std::make_unique<PropertyWithValue<bool>>(PropertyNames::MAKE_GRP, true, Direction::Input),
99 "Set to true to create a GroupingWorkspace with called "
100 "WorkspaceName_group.");
101
102 declareProperty(std::make_unique<PropertyWithValue<bool>>(PropertyNames::MAKE_CAL, true, Direction::Input),
103 "Set to true to create a CalibrationWorkspace with called "
104 "WorkspaceName_cal.");
105
106 declareProperty(std::make_unique<PropertyWithValue<bool>>(PropertyNames::MAKE_MSK, true, Direction::Input),
107 "Set to true to create a MaskWorkspace with called WorkspaceName_mask.");
108
109 declareProperty(std::make_unique<PropertyWithValue<std::string>>("WorkspaceName", "", Direction::Input),
110 "The base of the output workspace names. Names will have '_group', "
111 "'_cal', '_mask' appended to them.");
112
113 std::string grpName("Calibration Validation");
114 declareProperty("TofMin", 0., "Minimum for TOF axis. Defaults to 0.");
115 declareProperty("TofMax", EMPTY_DBL(), "Maximum for TOF axis. Defaults to Unused.");
116 declareProperty(std::make_unique<PropertyWithValue<bool>>("FixConversionIssues", true, Direction::Input),
117 "Set DIFA and TZERO to zero if there is an error and the "
118 "pixel is masked");
119 setPropertyGroup("TofMin", grpName);
120 setPropertyGroup("TofMax", grpName);
121 setPropertyGroup("FixConversionIssues", grpName);
122}
123
124namespace { // anonymous
125
126void setGroupWSProperty(API::Algorithm *alg, const std::string &prefix, const GroupingWorkspace_sptr &wksp) {
128 "OutputGroupingWorkspace", prefix + "_group", Direction::Output),
129 "Set the output GroupingWorkspace, if any.");
130 alg->setProperty("OutputGroupingWorkspace", wksp);
131}
132
133void setMaskWSProperty(API::Algorithm *alg, const std::string &prefix, const MaskWorkspace_sptr &wksp) {
135 "OutputMaskWorkspace", prefix + "_mask", Direction::Output),
136 "Set the output MaskWorkspace, if any.");
137 alg->setProperty("OutputMaskWorkspace", wksp);
138}
139
140void setCalWSProperty(API::Algorithm *alg, const std::string &prefix, const ITableWorkspace_sptr &wksp) {
141 alg->declareProperty(
142 std::make_unique<WorkspaceProperty<ITableWorkspace>>("OutputCalWorkspace", prefix + "_cal", Direction::Output),
143 "Set the output Diffraction Calibration workspace, if any.");
144 alg->setProperty("OutputCalWorkspace", wksp);
145}
146
147} // anonymous namespace
148
149void LoadDiffCal::getInstrument(H5File &file) {
150 // don't bother if there isn't a mask or grouping requested
151 bool makeMask = getProperty(PropertyNames::MAKE_MSK);
152 bool makeGrouping = getProperty(PropertyNames::MAKE_GRP);
153 if ((!makeMask) & (!makeGrouping))
154 return;
155
156 // see if the user specified the instrument independently
159 return;
160 }
161
162 std::string idf = H5Util::readString(file, "/calibration/instrument/instrument_source");
163 std::string instrumentName = H5Util::readString(file, "/calibration/instrument/name");
164
165 g_log.debug() << "IDF : " << idf << "\n"
166 << "NAME: " << instrumentName << "\n";
167 API::Algorithm_sptr childAlg = this->createChildAlgorithm("LoadInstrument", 0.0, 0.1);
168 MatrixWorkspace_sptr tempWS(new Workspace2D());
169 childAlg->setProperty<MatrixWorkspace_sptr>("Workspace", tempWS);
170 try {
171 if (idf.empty()) {
172 childAlg->setPropertyValue("InstrumentName", instrumentName);
173 } else {
174 childAlg->setPropertyValue("Filename", idf);
175 }
176 childAlg->setProperty("RewriteSpectraMap", Mantid::Kernel::OptionalBool(false));
177 childAlg->executeAsChildAlg();
178 if (childAlg->isExecuted()) {
179 m_instrument = tempWS->getInstrument();
180
181 g_log.information() << "Loaded instrument \"" << m_instrument->getName() << "\" from \""
182 << m_instrument->getFilename() << "\"\n";
183 } else {
184 g_log.debug("LoadInstrument child algorithm did not execute successfully. No instrument will be associated with "
185 "the output workspaces.");
186 m_instrument = nullptr;
187 }
188 } catch (const std::exception &) {
189 g_log.debug("LoadInstrument child algorithm threw an exception. No instrument will be associated with the output "
190 "workspaces.");
191 m_instrument = nullptr;
192 }
193}
194
195void LoadDiffCal::makeGroupingWorkspace(const std::vector<int32_t> &detids, const std::vector<int32_t> &groups) {
196 bool makeWS = getProperty(PropertyNames::MAKE_GRP);
197 if (!makeWS) {
198 g_log.information("Not loading GroupingWorkspace from the calibration file");
199 return;
200 }
201
202 // load grouping from a separate file if supplied
203 if (!isDefault(PropertyNames::GROUP_FILE)) {
205 return;
206 }
207
208 size_t numDet = detids.size();
209 Progress progress(this, .4, .6, numDet);
210
211 GroupingWorkspace_sptr wksp{nullptr};
212 if (m_instrument) {
213 wksp = std::make_shared<DataObjects::GroupingWorkspace>(m_instrument);
214 } else {
215 wksp = std::make_shared<DataObjects::GroupingWorkspace>(detids);
216 }
217 wksp->setTitle(m_filename);
218 wksp->mutableRun().addProperty("Filename", m_filename);
219
220 for (size_t i = 0; i < numDet; ++i) {
221 auto detid = static_cast<detid_t>(detids[i]);
222 wksp->setValue(detid, groups[i]);
223 progress.report();
224 }
225
226 setGroupWSProperty(this, m_workspaceName, wksp);
227}
228
229void LoadDiffCal::makeMaskWorkspace(const std::vector<int32_t> &detids, const std::vector<int32_t> &use) {
230 bool makeWS = getProperty(PropertyNames::MAKE_MSK);
231 if (!makeWS) {
232 g_log.information("Not making a MaskWorkspace");
233 return;
234 }
235
236 size_t numDet = detids.size();
237 Progress progress(this, .6, .8, numDet);
238
239 MaskWorkspace_sptr wksp{nullptr};
240 if (m_instrument) {
241 wksp = std::make_shared<DataObjects::MaskWorkspace>(m_instrument);
242 } else {
243 wksp = std::make_shared<DataObjects::MaskWorkspace>(detids);
244 }
245 wksp->setTitle(m_filename);
246 wksp->mutableRun().addProperty("Filename", m_filename);
247
248 for (size_t i = 0; i < numDet; ++i) {
249 bool shouldUse = (use[i] > 0); // true if detector is calibrated
250 auto detid = static_cast<detid_t>(detids[i]);
251 // in maskworkspace 0=use, 1=dontuse
252 wksp->setMasked(detid, !shouldUse);
253 // The mask value is 0 if the detector is good for use
254 wksp->setValue(detid, (shouldUse ? 0. : 1.));
255 progress.report();
256 }
257
258 setMaskWSProperty(this, m_workspaceName, wksp);
259}
260
261void LoadDiffCal::makeCalWorkspace(const std::vector<int32_t> &detids, const std::vector<double> &difc,
262 const std::vector<double> &difa, const std::vector<double> &tzero,
263 const std::vector<int32_t> &dasids, const std::vector<double> &offsets,
264 const std::vector<int32_t> &use) {
265 bool makeWS = getProperty(PropertyNames::MAKE_CAL);
266 if (!makeWS) {
267 g_log.information("Not making a calibration workspace");
268 return;
269 }
270
271 size_t numDet = detids.size();
272 Progress progress(this, .8, 1., numDet);
273
274 bool haveDasids = !dasids.empty();
275 bool haveOffsets = !offsets.empty();
276 bool fixIssues = getProperty("FixConversionIssues");
277
278 double tofMin = getProperty("TofMin");
279 double tofMax = getProperty("TofMax");
280 bool useTofMax = !isEmpty(tofMax);
281
282 ITableWorkspace_sptr wksp = std::make_shared<DataObjects::TableWorkspace>();
283 wksp->setTitle(m_filename);
284 wksp->addColumn("int", "detid");
285 wksp->addColumn("double", "difc");
286 wksp->addColumn("double", "difa");
287 wksp->addColumn("double", "tzero");
288 // only add these columns if they have values
289 if (haveDasids)
290 wksp->addColumn("int", "dasid");
291 if (haveOffsets)
292 wksp->addColumn("double", "offset");
293
294 // columns for valid range of data
295 wksp->addColumn("double", "tofmin");
296 if (useTofMax)
297 wksp->addColumn("double", "tofmax");
298
299 size_t badCount = 0;
300 for (size_t i = 0; i < numDet; ++i) {
301 API::TableRow newrow = wksp->appendRow();
302 newrow << detids[i];
303 newrow << difc[i];
304 newrow << difa[i];
305 newrow << tzero[i];
306 if (haveDasids)
307 newrow << dasids[i];
308 if (haveOffsets)
309 newrow << offsets[i];
310
311 // calculate tof range for information
312 Kernel::Units::dSpacing dspacingUnit;
313 const double tofMinRow = dspacingUnit.calcTofMin(difc[i], difa[i], tzero[i], tofMin);
314 std::stringstream msg;
315 if (tofMinRow != tofMin) {
316 msg << "TofMin shifted from " << tofMin << " to " << tofMinRow << " ";
317 }
318 newrow << tofMinRow;
319 if (useTofMax) {
320 const double tofMaxRow = dspacingUnit.calcTofMax(difc[i], difa[i], tzero[i], tofMax);
321 newrow << tofMaxRow;
322
323 if (tofMaxRow != tofMax) {
324 msg << "TofMax shifted from " << tofMax << " to " << tofMaxRow;
325 }
326 }
327 if (!msg.str().empty()) {
328 badCount += 1;
329 std::stringstream longMsg;
330 longMsg << "[detid=" << detids[i];
331 if (haveDasids)
332 longMsg << ", dasid=" << dasids[i];
333 longMsg << "] " << msg.str();
334
335 // to fix issues for masked pixels, just zero difa and tzero
336 if (fixIssues && (!use[i])) {
337 longMsg << " pixel is masked, ";
338 longMsg << " changing difa (" << wksp->cell<double>(i, 2) << " to 0.)";
339 wksp->cell<double>(i, 2) = 0.;
340
341 longMsg << " and tzero (" << wksp->cell<double>(i, 3) << " to 0.)";
342 wksp->cell<double>(i, 3) = 0.;
343
344 // restore valid tof range
345 size_t index = 4; // where tofmin natively is
346 if (haveDasids)
347 index += 1;
348 if (haveOffsets)
349 index += 1;
350 wksp->cell<double>(i, index) = tofMin;
351 if (useTofMax)
352 wksp->cell<double>(i, index + 1) = tofMax;
353 }
354
355 this->g_log.warning(longMsg.str());
356 }
357
358 progress.report();
359 }
360 if (badCount > 0) {
361 this->g_log.warning() << badCount << " rows have reduced time-of-flight range\n";
362 }
363
364 setCalWSProperty(this, m_workspaceName, wksp);
365}
366
368 bool makeWS = getProperty(PropertyNames::MAKE_GRP);
369 if (!makeWS)
370 return; // input property says not to load grouping
371
372 if (isDefault(PropertyNames::GROUP_FILE))
373 return; // a separate grouping file was not specified
374
375 // Check that the instrument is defined
376 if (!m_instrument) {
377 throw std::runtime_error("Cannot load alternate grouping: the instrument is not defined.");
378 }
379 // Create a grouping workspace with this instrument
380 GroupingWorkspace_sptr groupingWorkspace = std::make_shared<DataObjects::GroupingWorkspace>(m_instrument);
381
382 // Get the alternate grouping file name
383 std::string filename = getPropertyValue(PropertyNames::GROUP_FILE);
384 g_log.information() << "Override grouping with information from \"" << filename << "\"\n";
385
386 // Determine file format by file name extension
387 std::string filenameExtension = std::filesystem::path(filename).extension().string();
388 GroupingFilenameExtension enFilenameExtension(
389 filenameExtension); // this will throw a runtime error if the extension is invalid
390 switch (enFilenameExtension) {
391 case GroupingFilenameExtensionEnum::XML: {
392 auto alg = createChildAlgorithm("LoadDetectorsGroupingFile");
393 alg->setProperty("InputWorkspace", groupingWorkspace);
394 alg->setProperty("InputFile", filename);
395 alg->executeAsChildAlg();
396 groupingWorkspace = alg->getProperty("OutputWorkspace");
397 } break;
398 case GroupingFilenameExtensionEnum::H5:
399 case GroupingFilenameExtensionEnum::HD5:
400 case GroupingFilenameExtensionEnum::HDF:
401 case GroupingFilenameExtensionEnum::CAL: {
402 auto alg = createChildAlgorithm("LoadDiffCal");
403 alg->setPropertyValue(PropertyNames::CAL_FILE, filename); // the alternate grouping file
404 alg->setProperty("InputWorkspace", groupingWorkspace); // a workspace to get the instrument from
405 alg->setProperty<bool>(PropertyNames::MAKE_CAL, false);
406 alg->setProperty<bool>(PropertyNames::MAKE_GRP, true);
407 alg->setProperty<bool>(PropertyNames::MAKE_MSK, false);
408 alg->setPropertyValue("WorkspaceName", m_workspaceName);
409 alg->executeAsChildAlg();
410 groupingWorkspace = alg->getProperty("OutputGroupingWorkspace");
411 } break;
412 default:
413 std::ostringstream os;
414 os << "Alternate grouping file has an invalid extension: "
415 << "\"" << filenameExtension << "\"";
416 throw std::runtime_error(os.str());
417 }
418
419 setGroupWSProperty(this, m_workspaceName, groupingWorkspace);
420}
421
423 bool makeCalWS = getProperty(PropertyNames::MAKE_CAL);
424 bool makeMaskWS = getProperty(PropertyNames::MAKE_MSK);
425 bool makeGroupWS = getProperty(PropertyNames::MAKE_GRP);
426 API::MatrixWorkspace_sptr inputWs = getProperty("InputWorkspace");
427
428 bool haveGroupingFile = !isDefault(PropertyNames::GROUP_FILE);
429
430 auto alg = createChildAlgorithm("LoadCalFile", 0., 1.);
431 alg->setPropertyValue("CalFilename", m_filename);
432 alg->setProperty("InputWorkspace", inputWs);
433 alg->setPropertyValue("InstrumentName", getPropertyValue("InstrumentName"));
434 alg->setPropertyValue("InstrumentFilename", getPropertyValue("InstrumentFilename"));
435 alg->setProperty<bool>("MakeOffsetsWorkspace", makeCalWS);
436 alg->setProperty<bool>("MakeGroupingWorkspace", makeGroupWS);
437 alg->setProperty<bool>("MakeMaskWorkspace", makeMaskWS);
438 alg->setPropertyValue("WorkspaceName", m_workspaceName);
439 alg->executeAsChildAlg();
440
441 if (makeCalWS) {
442 ITableWorkspace_sptr wksp = alg->getProperty("OutputCalWorkspace");
443 setCalWSProperty(this, m_workspaceName, wksp);
444 }
445
446 if (makeMaskWS) {
447 MatrixWorkspace_sptr wksp = alg->getProperty("OutputMaskWorkspace");
448 setMaskWSProperty(this, m_workspaceName, std::dynamic_pointer_cast<DataObjects::MaskWorkspace>(wksp));
449 }
450
451 if (makeGroupWS) {
452 GroupingWorkspace_sptr wksp = alg->getProperty("OutputGroupingWorkspace");
453 if (haveGroupingFile) {
454 // steal the instrument from what was loaded already
455 if (!m_instrument)
456 m_instrument = wksp->getInstrument();
458 } else {
459 setGroupWSProperty(this, m_workspaceName, wksp);
460 }
461 }
462}
463
464//----------------------------------------------------------------------------------------------
468 m_filename = getPropertyValue(PropertyNames::CAL_FILE);
469 m_workspaceName = getPropertyValue("WorkspaceName");
470
471 // Determine file format by file name extension
472 std::string filenameExtension = std::filesystem::path(m_filename).extension().string();
473 CalibFilenameExtension enFilenameExtension(
474 filenameExtension); // this will throw a runtime error if the extension is invalid
475 if (enFilenameExtension == CalibFilenameExtensionEnum::CAL) {
477 return;
478 }
479
480 // read in everything from the file
481 H5::Exception::dontPrint();
482 H5File file;
483 try {
484 file = H5File(m_filename, H5F_ACC_RDONLY, Nexus::H5Util::defaultFileAcc());
485 } catch (FileIException &) {
486 throw FileError("Failed to open file using HDF5", m_filename);
487 }
488 // try to get the instrument - this can leave the instrument as nullptr if anything goes wrong
489 getInstrument(file);
490
491 Progress progress(this, 0.1, 0.4, 8);
492 Group calibrationGroup;
493 try {
494 calibrationGroup = file.openGroup("calibration");
495 } catch (FileIException &e) {
496#if H5_VERSION_GE(1, 8, 13)
497 UNUSED_ARG(e);
498 H5::Exception::printErrorStack();
499#else
500 e.printError(stderr);
501#endif
502 file.close();
503 throw FileError("Did not find group \"/calibration\"", m_filename);
504 }
505
506 progress.report("Reading detid");
507 std::vector<int32_t> detids = H5Util::readArray1DCoerce<int32_t>(calibrationGroup, "detid");
508 progress.report("Reading dasid");
509 std::vector<int32_t> dasids = H5Util::readArray1DCoerce<int32_t>(calibrationGroup, "dasid");
510 progress.report("Reading group");
511 std::vector<int32_t> groups = H5Util::readArray1DCoerce<int32_t>(calibrationGroup, "group");
512 progress.report("Reading use");
513 std::vector<int32_t> use = H5Util::readArray1DCoerce<int32_t>(calibrationGroup, "use");
514
515 progress.report("Reading difc");
516 std::vector<double> difc = H5Util::readArray1DCoerce<double>(calibrationGroup, "difc");
517 progress.report("Reading difa");
518 std::vector<double> difa = H5Util::readArray1DCoerce<double>(calibrationGroup, "difa");
519 progress.report("Reading tzero");
520 std::vector<double> tzero = H5Util::readArray1DCoerce<double>(calibrationGroup, "tzero");
521 progress.report("Reading offset");
522 std::vector<double> offset = H5Util::readArray1DCoerce<double>(calibrationGroup, "offset");
523
524 file.close();
525
526 // verify the minimum is present
527 if (detids.empty()) {
528 throw std::runtime_error("File was missing required field \"/calibraion/detid\"");
529 }
530 if (difc.empty()) {
531 throw std::runtime_error("File was missing required field \"/calibraion/difc\"");
532 }
533
534 // fix up empty arrays
535 if (groups.empty())
536 groups.assign(detids.size(), 1); // all go to one spectrum
537 if (use.empty())
538 use.assign(detids.size(), 1); // all detectors are good, use them
539 if (difa.empty())
540 difa.assign(detids.size(), 0.); // turn off difa
541 if (tzero.empty())
542 tzero.assign(detids.size(), 0.); // turn off tzero
543
544 // create the appropriate output workspaces
545 makeGroupingWorkspace(detids, groups);
546 makeMaskWorkspace(detids, use);
547 makeCalWorkspace(detids, difc, difa, tzero, dasids, offset, use);
548}
549} // namespace Mantid::DataHandling
std::string name
Definition Run.cpp:60
#define DECLARE_ALGORITHM(classname)
Definition Algorithm.h:538
std::map< DeltaEMode::Type, std::string > index
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
Definition System.h:44
Base class from which all concrete algorithm classes should be derived.
Definition Algorithm.h:76
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.
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.
Kernel::Logger & g_log
Definition Algorithm.h:422
void progress(double p, const std::string &msg="", double estimatedTime=0.0, int progressPrecision=0)
Sends ProgressNotification.
bool isDefault(const std::string &name) const
static bool isEmpty(const NumT toCheck)
checks that the value was not set by users, uses the value in empty double/int.
A specialized class for dealing with file properties.
@ OptionalLoad
to specify a file to read but the file doesn't have to exist
@ Load
allowed here which will be passed to the algorithm
ITableWorkspace is an implementation of Workspace in which the data are organised in columns of same ...
Helper class for reporting progress from algorithms.
Definition Progress.h:25
TableRow represents a row in a TableWorkspace.
Definition TableRow.h:39
T & cell(size_t col)
Templated method to access the element col in the row.
Definition TableRow.h:115
A property class for workspaces.
static void getInstrument3WaysInit(Mantid::API::Algorithm *alg)
For use by getInstrument3Ways, initializes the properties.
static bool instrumentIsSpecified(API::Algorithm const *alg)
static Geometry::Instrument_const_sptr getInstrument3Ways(API::Algorithm *alg)
Get a pointer to an instrument in one of 3 ways: InputWorkspace, InstrumentName, InstrumentFilename.
LoadDiffCal : TODO: DESCRIPTION.
Definition LoadDiffCal.h:23
int version() const override
Algorithm's version for identification.
Geometry::Instrument_const_sptr m_instrument
Definition LoadDiffCal.h:46
void init() override
Initialize the algorithm's properties.
void getInstrument(H5::H5File &file)
const std::string summary() const override
Algorithm's summary for use in the GUI and help.
void exec() override
Execute the algorithm.
void makeGroupingWorkspace(const std::vector< int32_t > &detids, const std::vector< int32_t > &groups)
const std::string category() const override
Algorithm's category for identification.
void makeMaskWorkspace(const std::vector< int32_t > &detids, const std::vector< int32_t > &use)
void makeCalWorkspace(const std::vector< int32_t > &detids, const std::vector< double > &difc, const std::vector< double > &difa, const std::vector< double > &tzero, const std::vector< int32_t > &dasids, const std::vector< double > &offsets, const std::vector< int32_t > &use)
Concrete workspace implementation.
Definition Workspace2D.h:29
The class Group represents a set of symmetry operations (or symmetry group).
Definition Group.h:135
Records the filename and the description of failure.
Definition Exception.h:98
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
virtual void declareProperty(std::unique_ptr< Property > p, const std::string &doc="")=0
Function to declare properties (i.e. store them)
void setPropertyGroup(const std::string &name, const std::string &group)
Set the group for a given property.
void debug(const std::string &msg)
Logs at debug level.
Definition Logger.cpp:145
void warning(const std::string &msg)
Logs at warning level.
Definition Logger.cpp:117
void information(const std::string &msg)
Logs at information level.
Definition Logger.cpp:136
OptionalBool : Tri-state bool.
The concrete, templated class for properties.
d-Spacing in Angstrom
Definition Unit.h:351
double calcTofMax(const double difc, const double difa, const double tzero, const double tofmax=0.)
Definition Unit.cpp:782
double calcTofMin(const double difc, const double difa, const double tzero, const double tofmin=0.)
Definition Unit.cpp:775
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
std::shared_ptr< Algorithm > Algorithm_sptr
Typedef for a shared pointer to an Algorithm.
Definition Algorithm.h:52
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::shared_ptr< GroupingWorkspace > GroupingWorkspace_sptr
shared pointer to the GroupingWorkspace class
std::shared_ptr< MaskWorkspace > MaskWorkspace_sptr
shared pointer to the MaskWorkspace class
MANTID_NEXUS_DLL std::string readString(H5::H5File &file, const std::string &address)
Definition H5Util.cpp:266
MANTID_NEXUS_DLL H5::FileAccPropList defaultFileAcc()
Default file access is H5F_CLOSE_STRONG.
Definition H5Util.cpp:119
int32_t detid_t
Typedef for a detector ID.
constexpr double EMPTY_DBL() noexcept
Returns what we consider an "empty" double within a property.
Definition EmptyValues.h:42
STL namespace.
Describes the direction (within an algorithm) of a Property.
Definition Property.h:50
@ Input
An input workspace.
Definition Property.h:53
@ Output
An output workspace.
Definition Property.h:54