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