22#include "MantidHistogramData/LinearGenerator.h"
32#include "MantidNexus/NexusFile.h"
36using namespace Kernel;
46 : m_supportedInstruments{
"D11",
"D22",
"D33",
"D16"}, m_defaultBinning{0, 0}, m_resMode(
"nominal"), m_isTOF(
false),
47 m_sourcePos(0.), m_numberOfMonitors(2) {}
61 return "Loads ILL nexus files for SANS instruments D11, D16, D22, D33.";
74 if (descriptor.
isEntry(
"/entry0/mode") &&
75 ((descriptor.
isEntry(
"/entry0/reactor_power") && descriptor.
isEntry(
"/entry0/instrument_name")) ||
76 (descriptor.
isEntry(
"/entry0/instrument/name") && descriptor.
isEntry(
"/entry0/acquisition_mode") &&
77 !descriptor.
isEntry(
"/entry0/instrument/Detector"))))
90 "Name of the nexus file to load");
92 "The name to use for the output workspace");
93 auto mustBePositive = std::make_shared<BoundedValidator<double>>();
94 mustBePositive->setLower(0);
96 "The wavelength of the experiment, in angstroms. Used only for D16. Will "
97 "override the nexus' value if there is one.");
99 "Name of the file containing sensitivity map.");
120 progress.report(
"Moving detectors");
134 distance = firstEntry.
getFloat(instrumentAddress +
"/Det/value") / 1000;
135 }
catch (std::runtime_error &) {
138 const double angle = firstEntry.
getFloat(instrumentAddress +
"/Gamma/value");
139 placeD16(-angle, distance,
"detector");
148 double finalDistance = firstEntry.
getFloat(instrumentAddress +
"/Detector 1/det_calc");
150 double currentDistance = pos.
Z();
154 runDetails.
addProperty<
double>(
"L2", finalDistance,
true);
159 const std::string backIndex =
m_localWorkspace->getInstrument()->getStringParameter(
"back_detector_index")[0];
160 const std::string frontIndex =
m_localWorkspace->getInstrument()->getStringParameter(
"front_detector_index")[0];
163 double distance = firstEntry.
getFloat(instrumentAddress +
"/Detector " + backIndex +
"/det" + backIndex +
"_calc");
166 runDetails.
addProperty<
double>(
"L2", distance,
true);
168 double offset = firstEntry.
getFloat(instrumentAddress +
"/Detector " + backIndex +
"/dtr" + backIndex +
"_actual");
172 distance = firstEntry.
getFloat(instrumentAddress +
"/Detector " + frontIndex +
"/det" + frontIndex +
"_calc");
176 offset = firstEntry.
getFloat(instrumentAddress +
"/Detector " + frontIndex +
"/dtr" + frontIndex +
"_actual");
178 double angle = firstEntry.
getFloat(instrumentAddress +
"/Detector " + frontIndex +
"/dan" + frontIndex +
"_actual");
187 progress.report(
"Moving detectors");
190 runDetails.
addProperty<
double>(
"L2", distance,
true);
199 progress.report(
"Setting sample logs");
210 if (instrumentNameAddress.empty()) {
211 throw std::runtime_error(
"Cannot set the instrument name from the Nexus file!");
223 " is not supported. Only D11, D16, D22 and D33 are supported");
241 divide->setPropertyValue(
"RHSWorkspace",
"sensitivity_map");
242 divide->setProperty(
"AllowDifferentNumberSpectra",
244 divide->executeAsChildAlg();
255 const std::string &instrumentNameAddress) {
256 std::string detectorAddress(instrumentNameAddress +
"/detector");
280 size_t &numberOfPixelsPerTube) {
282 numberOfChannels =
static_cast<size_t>(data.
dim0());
283 numberOfTubes =
static_cast<size_t>(data.
dim1());
284 numberOfPixelsPerTube =
static_cast<size_t>(data.
dim2());
286 numberOfPixelsPerTube =
static_cast<size_t>(data.
dim1());
287 numberOfChannels =
static_cast<size_t>(data.
dim2());
288 numberOfTubes =
static_cast<size_t>(data.
dim0());
290 g_log.
debug() <<
"Dimensions found:\n- Number of tubes: " << numberOfTubes
291 <<
"\n- Number of pixels per tube: " << numberOfPixelsPerTube
292 <<
"\n- Number of channels: " << numberOfChannels <<
"\n";
312 H5::DataSet scanVarNames = h5file.openDataSet(
"entry0/data_scan/scanned_variables/variables_names/name");
313 H5::DataSpace scanVarNamesSpace = scanVarNames.getSpace();
314 const auto nDims = scanVarNamesSpace.getSimpleExtentNdims();
315 auto dimsSize = std::vector<hsize_t>(nDims);
316 scanVarNamesSpace.getSimpleExtentDims(dimsSize.data(),
nullptr);
317 std::vector<char *> rdata(dimsSize[0]);
318 scanVarNames.read(rdata.data(), scanVarNames.getDataType());
319 size_t monitorIndex = 0;
320 while (monitorIndex < rdata.size()) {
321 const auto varName = std::string(rdata[monitorIndex]);
322 if (varName.find(
"Monitor") != std::string::npos)
343 address =
"data_scan/detector_data/data";
352 const size_t numberOfWiresInD16B = 1152;
353 const size_t numberOfPixelsPerWireInD16B = 192;
357 if (data.dim1() == numberOfWiresInD16B && data.dim2() == numberOfPixelsPerWireInD16B) {
363 size_t numberOfTubes, numberOfPixelsPerTubes, numberOfChannels;
364 getDataDimensions(data, numberOfChannels, numberOfTubes, numberOfPixelsPerTubes);
369 size_t numberOfHistograms = numberOfPixelsPerTubes * numberOfTubes +
m_numberOfMonitors;
374 std::vector<double> binning =
m_isD16Omega && numberOfChannels > 1
386 if (data.dim1() == 128) {
406 size_t numberOfHistograms =
407 static_cast<size_t>(dataCenter.dim0() * dataCenter.dim1() + dataRight.dim0() * dataRight.dim1() +
408 dataLeft.dim0() * dataLeft.dim1()) +
411 size_t numberOfChannels, numberOfPixelsPerTubeCenter, numberOfTubesCenter;
412 getDataDimensions(dataCenter, numberOfChannels, numberOfTubesCenter, numberOfPixelsPerTubeCenter);
419 if (numberOfChannels != 1) {
420 std::vector<double> frames(numberOfChannels, 0);
421 for (
size_t i = 0; i < numberOfChannels; ++i) {
422 frames[i] =
static_cast<double>(i);
434 if (numberOfChannels != 1) {
437 if (nextIndex < numberOfHistograms)
443 const HistogramData::Counts histoCounts(durations(), durations() + numberOfChannels);
446 HistogramData::CountVariances(std::vector<double>(numberOfChannels, 0)));
463 size_t numberOfHistograms =
464 static_cast<size_t>(data2_data.dim0() * data2_data.dim1() + data1_data.dim0() * data1_data.dim1()) +
467 size_t numberOfChannels, numberOfPixelsPerTubeCenter, numberOfTubesCenter;
468 getDataDimensions(data1_data, numberOfChannels, numberOfTubesCenter, numberOfPixelsPerTubeCenter);
476 if (numberOfChannels != 1) {
477 std::vector<double> frames(numberOfChannels, 0);
478 for (
size_t i = 0; i < numberOfChannels; ++i) {
479 frames[i] =
static_cast<double>(i);
487 const std::string backIndex =
m_localWorkspace->getInstrument()->getStringParameter(
"back_detector_index")[0];
489 if (backIndex ==
"2") {
499 if (numberOfChannels != 1) {
502 const HistogramData::Counts histoCounts(durations(), durations() + numberOfChannels);
505 HistogramData::CountVariances(std::vector<double>(numberOfChannels, 0)));
531 if (dataRear.dim2() != dataRight.dim2() && dataRight.dim2() != dataLeft.dim2() &&
532 dataLeft.dim2() != dataDown.dim2() && dataDown.dim2() != dataUp.dim2()) {
533 throw std::runtime_error(
"The time bins have not the same dimension for all the 5 detectors!");
535 const auto numberOfHistograms =
static_cast<size_t>(
536 dataRear.dim0() * dataRear.dim1() + dataRight.dim0() * dataRight.dim1() + dataLeft.dim0() * dataLeft.dim1() +
537 dataDown.dim0() * dataDown.dim1() + dataUp.dim0() * dataUp.dim1());
544 std::vector<double> binningRear, binningRight, binningLeft, binningDown, binningUp;
546 if (firstEntry.
getFloat(
"mode") == 0.0) {
547 g_log.
debug(
"Getting default wavelength bins...");
561 g_log.
debug(
"Master choppers are " + first +
" and " + second);
566 secondChopper.
load();
567 m_sourcePos = (firstChopper[0] + secondChopper[0]) / 2.;
569 g_log.
debug(
"Getting wavelength bins from the nexus file...");
575 channelWidthSum.
load();
576 channelWidthTimes.
load();
577 std::string distancePrefix(instrumentAddress +
"/tof/tof_distance_detector");
578 binningRear =
getVariableTimeBinning(firstEntry, distancePrefix +
"1", channelWidthSum, channelWidthTimes);
579 binningRight =
getVariableTimeBinning(firstEntry, distancePrefix +
"2", channelWidthSum, channelWidthTimes);
580 binningLeft =
getVariableTimeBinning(firstEntry, distancePrefix +
"3", channelWidthSum, channelWidthTimes);
581 binningDown =
getVariableTimeBinning(firstEntry, distancePrefix +
"4", channelWidthSum, channelWidthTimes);
583 }
catch (
const std::runtime_error &) {
589 std::string binAddressPrefix(instrumentAddress +
"/tof/tof_wavelength_detector");
595 }
catch (std::runtime_error &e) {
596 throw std::runtime_error(
"Unable to load the wavelength axes for TOF data " + std::string(e.what()));
601 g_log.
debug(
"Loading the data into the workspace...");
621 for (std::vector<NXClassInfo>::const_iterator it = firstEntry.
groups().begin(); it != firstEntry.
groups().end();
623 if (it->nxclass ==
"NXmonitor") {
626 g_log.
debug() <<
"Monitor: " << it->nxname <<
" dims = " << data.dim0() <<
"x" << data.dim1() <<
"x"
627 << data.dim2() <<
'\n';
628 std::vector<double> binning(data.dim2());
631 binning.push_back(0.0);
632 std::iota(binning.begin(), binning.end(), 0.0);
640 double averageMonitorCounts =
641 std::accumulate(data(), data() + data.dim2(),
double(0)) /
static_cast<double>(data.dim2());
643 if (averageMonitorCounts > 0) {
645 runDetails.
addProperty(
"monitor", averageMonitorCounts,
true);
662 const std::vector<double> &binning) {
663 std::string address =
"/data_scan/scanned_variables/data";
667 scannedVariables.load();
668 auto monitorNumber = 1;
670 auto firstMonitorValuePos = scannedVariables() + monitorIndex * scannedVariables.dim1();
671 const HistogramData::Counts counts(firstMonitorValuePos, firstMonitorValuePos + scannedVariables.dim1());
680 const HistogramData::BinEdges binEdges(binning);
683 HistogramData::Points points = HistogramData::Points(binning);
688 const auto averageMonitorCounts =
689 std::accumulate(firstMonitorValuePos, firstMonitorValuePos + scannedVariables.dim1(),
double(0)) /
690 static_cast<double>(scannedVariables.dim1());
693 if (averageMonitorCounts > 0) {
702 if (scannedVariables.dim1() == 1) {
703 const HistogramData::BinEdges binEdges(binning);
706 HistogramData::Points points = HistogramData::Points(binning);
726 size_t numberOfTubes, numberOfChannels, numberOfPixelsPerTube;
729 bool pointData =
true;
730 std::tuple<short, short, short> dimOrder;
732 dimOrder = std::tuple<short, short, short>{1, 2, 0};
740 dimOrder = std::tuple<short, short, short>{0, 1, 2};
743 std::vector<int>(), std::set<detid_t>(), dimOrder);
744 return firstIndex + numberOfTubes * numberOfPixelsPerTube;
761 m_localWorkspace->getAxis(0)->unit() = UnitFactory::Instance().create(
"Wavelength");
764 auto labelX = std::dynamic_pointer_cast<Kernel::Units::Label>(Kernel::UnitFactory::Instance().
create(
"Label"));
765 labelX->setLabel(
"Omega angle");
784 std::filesystem::path directory(ConfigService::Instance().getInstrumentDirectory());
785 std::filesystem::path fullPath = directory / (instName +
"_Definition.xml");
786 return fullPath.string();
796 instrumentPath +=
"lr";
798 instrumentPath +=
"_Definition.xml";
834 mover->setProperty(
"ComponentName", componentName);
836 mover->setProperty(
"X", pos.
X());
837 mover->setProperty(
"Y", pos.
Y());
838 mover->setProperty(
"Z", distance);
839 mover->setProperty(
"RelativePosition",
false);
840 mover->executeAsChildAlg();
842 g_log.
debug() <<
"Moving component '" << componentName <<
"' to Z = " << distance <<
'\n';
853 rotater->setProperty(
"ComponentName", componentName);
854 rotater->setProperty(
"X", 0.);
855 rotater->setProperty(
"Y", 1.);
856 rotater->setProperty(
"Z", 0.);
857 rotater->setProperty(
"Angle", angle);
858 rotater->setProperty(
"RelativeRotation",
false);
859 rotater->executeAsChildAlg();
860 g_log.
debug() <<
"Rotating component '" << componentName <<
"' to angle = " << angle <<
" degrees.\n";
872 mover->setProperty(
"ComponentName", componentName);
873 mover->setProperty(
"X", sin(angle * M_PI / 180) * distance);
874 mover->setProperty(
"Y", 0.);
875 mover->setProperty(
"Z", cos(angle * M_PI / 180) * distance);
876 mover->setProperty(
"RelativePosition",
false);
877 mover->executeAsChildAlg();
882 runDetails.
addProperty<
double>(
"L2", distance,
true);
884 g_log.
debug() <<
"Moving component '" << componentName <<
"' to angle = " << angle
885 <<
" degrees and distance = " << distance <<
"metres.\n";
897 mover->setProperty(
"ComponentName", componentName);
898 mover->setProperty(
"X", shift);
899 mover->setProperty(
"Y", pos.
Y());
900 mover->setProperty(
"Z", pos.
Z());
901 mover->setProperty(
"RelativePosition",
false);
902 mover->executeAsChildAlg();
903 g_log.
debug() <<
"Moving component '" << componentName <<
"' to X = " << shift <<
'\n';
915 mover->setProperty(
"ComponentName", componentName);
916 mover->setProperty(
"X", pos.
X());
917 mover->setProperty(
"Y", shift);
918 mover->setProperty(
"Z", pos.
Z());
919 mover->setProperty(
"RelativePosition",
false);
920 mover->executeAsChildAlg();
921 g_log.
debug() <<
"Moving component '" << componentName <<
"' to Y = " << shift <<
'\n';
935 runDetails.
addProperty<std::string>(
"tof_mode",
"Non TOF");
937 runDetails.
addProperty<std::string>(
"tof_mode",
"TOF");
943 wavelength = entry.
getFloat(instrumentNameAddress +
"/Beam/wavelength");
945 wavelength = entry.
getFloat(instrumentNameAddress +
"/selector/wavelength");
947 g_log.
debug() <<
"Wavelength found in the nexus file: " << wavelength <<
'\n';
953 wavelength = std::round(wavelength * 100) / 100.;
955 if (wavelength <= 0) {
958 if (entry.
getFloat(
"mode") == 0.0) {
959 throw std::runtime_error(
"Working in Non TOF mode and the wavelength in "
960 "the file is <=0 !!! Check with the instrument "
964 double wavelengthRes = 10.;
965 const std::string entryResolution = instrumentNameAddress +
"/selector/";
967 wavelengthRes = entry.
getFloat(entryResolution +
"wavelength_res");
968 }
catch (
const std::runtime_error &) {
970 wavelengthRes = entry.
getFloat(entryResolution +
"wave_length_res");
971 }
catch (
const std::runtime_error &) {
974 g_log.
information() <<
"Could not find wavelength resolution, assuming " << wavelengthRes <<
"%.\n";
979 wavelengthRes = std::round(wavelengthRes * 100) / 100.;
980 runDetails.
addProperty<
double>(
"wavelength", wavelength);
989 std::string startDate = entry.
getString(
"start_time");
992 runDetails.
addProperty<std::string>(
"Facility", std::string(
"ILL"));
1005 g_log.
debug() <<
"Failed to open nexus file \"" << filename <<
"\" in read mode: " << e.what() <<
"\n";
1019 const double l2 = specInfo.l2(
index);
1020 const double z = specInfo.position(
index).Z();
1022 const double scale = (l1 +
z) / (l1 +
l2);
1023 std::transform(
x.begin(),
x.end(),
x.begin(), [scale](
double lambda) { return scale * lambda; });
1029 const double l2 = specInfo.l2(0);
1030 const double monitor2 = -specInfo.position(nHist - 1).Z();
1032 const double monScale = (l1 +
l2) / l1Monitor2;
1033 std::transform(firstPixel.begin(), firstPixel.end(), firstPixel.begin(),
1034 [monScale](
double lambda) { return monScale * lambda; });
1036 const HistogramData::Counts counts =
m_localWorkspace->histogram(mIndex).counts();
1037 const HistogramData::BinEdges binEdges(firstPixel);
1049 mover->setProperty(
"ComponentName",
"moderator");
1050 mover->setProperty(
"X", 0.);
1051 mover->setProperty(
"Y", 0.);
1053 mover->setProperty(
"RelativePosition",
false);
1054 mover->executeAsChildAlg();
1067 scannedValues.load();
1069 const int64_t nBins = scannedValues.dim1();
1070 std::vector<double> binning(nBins, 0);
1072 for (int64_t i = 0; i < nBins; ++i) {
1074 binning[i] = scannedValues(0, i);
1089 const int64_t nBins = sum.
dim0();
1090 std::vector<double> binCenters;
1091 binCenters.reserve(nBins);
1094 for (int64_t bin = 0; bin < nBins; ++bin) {
1096 const double tof = sum[bin] * 1E-9 - times[bin] * 1E-6 / 2.;
1098 const double velocity = distance[0] / tof;
1101 binCenters.emplace_back(
lambda);
1103 std::vector<double> binEdges;
1104 binEdges.reserve(nBins + 1);
1108 if (binEdges[0] < 0.) {
const std::vector< double > * lambda
std::map< DeltaEMode::Type, std::string > index
#define PARALLEL_FOR_IF(condition)
Empty definitions - to enable set your complier to enable openMP.
#define DECLARE_NEXUS_FILELOADER_ALGORITHM(classname)
DECLARE_NEXUS_FILELOADER_ALGORITHM should be used in place of the standard DECLARE_ALGORITHM macro wh...
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
Kernel::Property * getPointerToProperty(const std::string &name) const override
Get a property by name.
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.
void initialize() override
Initialization method invoked by the framework.
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.
bool execute() override final
The actions to be performed by the algorithm on a dataset.
bool isDefault(const std::string &name) const
void setPropertyValue(const std::string &name, const std::string &value) override
Set the value of a property by string N.B.
@ 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
void addProperty(Kernel::Property *prop, bool overwrite=false)
Add data to the object in the form of a property.
Helper class for reporting progress from algorithms.
This class stores information regarding an experimental run as a series of log entries.
A property class for workspaces.
LoadILLSANS; supports D11, D22 and D33 (TOF/monochromatic)
bool m_isTOF
TOF or monochromatic flag.
void runLoadInstrument()
Loads the instrument from the IDF.
void initWorkSpaceD33(Nexus::NXEntry &, const std::string &)
Loads data for D33.
void getMonitorIndices(const std::string &)
Gets monitor indices from the scanned variables names and sets them in a vector of indices to be used...
void moveDetectorsD33(const DetectorPosition &)
Move the detector banks for D33.
void createEmptyWorkspace(const size_t, const size_t, const MultichannelType type=MultichannelType::TOF)
Create a workspace without any data in it.
size_t loadDataFromTubes(Nexus::NXInt const &, const std::vector< double > &, size_t, const MultichannelType type=MultichannelType::TOF)
Loads data from tubes in scan both mode (channels - tubes - pixels) (D16B)
const std::string name() const override
Algorithm's name for identification.
const std::string summary() const override
Algorithm's summary.
void initWorkSpaceD22B(Nexus::NXEntry &, const std::string &)
LoadILLSANS::initWorkSpaceD22B Load D22B data.
void init() override
Initialize the algorithm's properties.
double m_sourcePos
Source Z (for D33 TOF)
const std::string category() const override
Algorithm's category for identification.
void setFinalProperties(const std::string &filename)
Sets full sample logs.
size_t loadDataFromD16ScanMonitors(const Nexus::NXEntry &firstEntry, size_t firstIndex, const std::vector< double > &binning)
Load data from D16B's monitor.
std::vector< double > getOmegaBinning(const Nexus::NXEntry &entry, const std::string &address) const
LoadILLSANS::getOmegaBinning Get the binning for an omega scan for D16B files.
void moveDetectorDistance(double distance, const std::string &componentName)
Move detectors in Z axis (X,Y are kept constant)
int version() const override
Algorithm's version for identification.
int confidence(Nexus::NexusDescriptor &descriptor) const override
Returns a confidence value that this algorithm can load a file.
void setInstrumentName(const Nexus::NXEntry &, const std::string &)
Set member variable with the instrument name.
void moveSource()
Moves the source to the middle of the two master choppers Used only for D33 in TOF mode.
void loadMetaData(const Nexus::NXEntry &, const std::string &)
Loads some metadata present in the nexus file.
std::vector< double > getVariableTimeBinning(const Nexus::NXEntry &, const std::string &, const Nexus::NXInt &, const Nexus::NXFloat &) const
Returns the wavelength axis computed in VTOF mode.
void applySensitivityMap()
Applies sensitivity map correction to the loaded D16B data.
size_t loadDataFromMonitors(Nexus::NXEntry &firstEntry, size_t firstIndex=0, const MultichannelType type=MultichannelType::TOF)
Loads data from all the monitors.
void moveDetectorVertical(double, const std::string &)
Move detectors in Y.
size_t m_numberOfMonitors
Number of monitors in this instrument.
void placeD16(double, double, const std::string &)
LoadILLSANS::placeD16 : place the D16 detector.
std::vector< double > m_defaultBinning
the default x-axis binning
void exec() override
Execute the algorithm.
std::vector< std::string > m_supportedInstruments
List of supported instruments.
void initWorkSpace(Nexus::NXEntry &, const std::string &)
Loads data for D11, D16 and D22.
void adjustTOF()
Adjusts pixel by pixel the wavelength axis Used only for D33 in TOF mode.
void getDataDimensions(const Nexus::NXInt &data, size_t &numberOfChannels, size_t &numberOfTubes, size_t &numberOfPixelsPerTube)
LoadILLSANS::getDataDimensions Retrieves physical dimensions of the data from the dataset dimensions.
void moveDetectorHorizontal(double, const std::string &)
Move detectors in X.
API::MatrixWorkspace_sptr m_localWorkspace
to-be output workspace
void initWorkSpaceD11B(Nexus::NXEntry &, const std::string &)
LoadILLSANS::initWorkSpaceD11B Load D11B data.
void rotateInstrument(double, const std::string &)
Rotates instrument detector around y-axis in place.
std::vector< size_t > m_monitorIndices
Indices for monitor data in scanned variables table.
DetectorPosition getDetectorPositionD33(const Nexus::NXEntry &, const std::string &)
Get detector panel distances from the nexus file.
bool m_isD16Omega
Data comes from a D16 omega scan flag.
std::string m_instrumentName
Name of the instrument.
std::string m_resMode
Resolution mode for D11 and D22.
std::string getInstrumentFilePath(const std::string &) const
Makes up the full path of the relevant IDF dependent on resolution mode.
Loads a workspace from a NeXus Processed entry in a NeXus file.
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 information(const std::string &msg)
Logs at information level.
virtual bool isDefault() const =0
Overriden function that returns if property has the same value that it was initialised with,...
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
constexpr double X() const noexcept
Get x.
constexpr double Y() const noexcept
Get y.
constexpr double Z() const noexcept
Get z.
Class that provides for a standard Nexus exception.
float getFloat(const std::string &name) const
Returns a float.
std::string getString(const std::string &name) const
Returns a string.
bool containsGroup(const std::string &query) const
Returns whether an individual group (or group) is present.
NXFloat openNXFloat(const std::string &name) const
Creates and opens a float dataset.
std::vector< NXClassInfo > & groups() const
Returns a list of all classes (or groups) in this NXClass.
NXInt openNXInt(const std::string &name) const
Creates and opens an integer dataset.
Templated class implementation of NXDataSet.
void load()
Read all of the datablock in.
dimsize_t dim0() const
Returns the number of elements along the first dimension.
dimsize_t dim2() const
Returns the number of elements along the third dimension.
dimsize_t dim1() const
Returns the number of elements along the second dimension.
Implements NXentry Nexus class.
Implements NXroot Nexus class.
NXEntry openFirstEntry()
Open the first NXentry in the file.
bool isEntry(const std::string &entryName, const std::string &groupClass) const noexcept
Checks if a full-address entry exists for a particular groupClass in a Nexus dataset.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
std::string getStringFromNexusAddress(const Mantid::Nexus::NXEntry &, const std::string &)
void addNexusFieldsToWsRun(Nexus::File &filehandle, API::Run &runDetails, const std::string &entryName="", bool useFullAddress=false)
Add properties from a nexus file to the workspace run.
double calculateEnergy(double)
Calculate Neutron Energy from wavelength: .
Nexus::NXInt getIntDataset(const Nexus::NXEntry &, const std::string &)
Fetches NXInt data from the requested group name in the entry provided.
Nexus::NXDouble getDoubleDataset(const Nexus::NXEntry &, const std::string &)
Fetches NXDouble data from the requested group name in the entry provided.
std::vector< double > getTimeBinningFromNexusAddress(const Mantid::Nexus::NXEntry &, const std::string &)
Gets the time binning from a Nexus float array Adds an extra bin at the end.
void fillStaticWorkspace(const API::MatrixWorkspace_sptr &, const Mantid::Nexus::NXInt &, const std::vector< double > &xAxis, int64_t initialSpectrum=0, bool pointData=false, const std::vector< detid_t > &detectorIDs=std::vector< int >(), const std::set< detid_t > &acceptedID=std::set< int >(), const std::tuple< short, short, short > &axisOrder=std::tuple< short, short, short >(0, 1, 2))
Fills workspace with histogram data from provided data structure.
std::string dateTimeInIsoFormat(const std::string &)
Parses the date as formatted at the ILL: 29-Jun-12 11:27:26 and converts it to the ISO format used in...
Kernel::V3D getComponentPosition(const API::MatrixWorkspace_sptr &ws, const std::string &componentName)
LoadHelper::getComponentPosition.
void loadEmptyInstrument(const API::MatrixWorkspace_sptr &ws, const std::string &instrumentName, const std::string &instrumentAddress="")
Loads empty instrument of chosen name into a provided workspace.
double getDoubleFromNexusAddress(const Mantid::Nexus::NXEntry &, const std::string &)
std::string findInstrumentNexusAddress(const Mantid::Nexus::NXEntry &)
Finds the address for the instrument name in the nexus file Usually of the form: entry0/<NXinstrument...
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.
void MANTID_KERNEL_DLL convertToBinBoundary(const std::vector< double > &bin_centers, std::vector< double > &bin_edges)
Convert an array of bin centers to bin boundary values.
std::enable_if< std::is_pointer< Arg >::value, bool >::type threadSafe(Arg workspace)
Thread-safety check Checks the workspace to ensure it is suitable for multithreaded access.
MANTID_NEXUS_DLL H5::FileAccPropList defaultFileAcc()
Default file access is H5F_CLOSE_STRONG.
static constexpr double NeutronMass
Mass of the neutron in kg.
static constexpr double h
Planck constant in J*s.
std::string to_string(const wide_integer< Bits, Signed > &n)
double distanceSampleRear
double distanceSampleBottomTop
double distanceSampleRightLeft
@ Output
An output workspace.