|
Mantid
|
LoadHelper : Auxiliary functions for Loading Files. More...
Typedefs | |
| using | detid_t = int32_t |
Functions | |
| 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: \( E = h^2 / 2m\lambda ^2 \). | |
| double | calculateTOF (double, double) |
| Calculate TOF from distance. | |
| 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 Mantid: ISO8601 format string: "yyyy-mm-ddThh:mm:ss[Z+-]tz:tz". | |
| void | fillMovingWorkspace (const API::MatrixWorkspace_sptr &, const Mantid::Nexus::NXInt &, const std::vector< double > &xAxis, int64_t initialSpectrum=0, const std::set< detid_t > &acceptedID=std::set< int >(), const std::vector< detid_t > &customID=std::vector< 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. | |
| 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 | findInstrumentNexusAddress (const Mantid::Nexus::NXEntry &) |
| Finds the address for the instrument name in the nexus file Usually of the form: entry0/<NXinstrument class>/name. | |
| Kernel::V3D | getComponentPosition (const API::MatrixWorkspace_sptr &ws, const std::string &componentName) |
| LoadHelper::getComponentPosition. | |
| Nexus::NXDouble | getDoubleDataset (const Nexus::NXEntry &, const std::string &) |
| Fetches NXDouble data from the requested group name in the entry provided. | |
| double | getDoubleFromNexusAddress (const Mantid::Nexus::NXEntry &, const std::string &) |
| double | getInstrumentProperty (const API::MatrixWorkspace_sptr &, const std::string &) |
| Nexus::NXInt | getIntDataset (const Nexus::NXEntry &, const std::string &) |
| Fetches NXInt data from the requested group name in the entry provided. | |
| std::string | getStringFromNexusAddress (const Mantid::Nexus::NXEntry &, const std::string &) |
| 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 | loadEmptyInstrument (const API::MatrixWorkspace_sptr &ws, const std::string &instrumentName, const std::string &instrumentAddress="") |
| Loads empty instrument of chosen name into a provided workspace. | |
| void | loadingOrder (const std::tuple< short, short, short > &axisOrder, int *dataIndices) |
| Handles non-standard loading order of the provided data, based on the provided data dimension order. | |
| void | moveComponent (const API::MatrixWorkspace_sptr &ws, const std::string &componentName, const Kernel::V3D &newPos) |
| LoadHelper::moveComponent. | |
| void | recurseAndAddNexusFieldsToWsRun (Nexus::File &filehandle, API::Run &runDetails, const std::string &parent_name, const std::string &parent_class, int level, bool useFullAddress) |
| Recursively add properties from a nexus file to the workspace run. | |
| void | replaceZeroErrors (const API::MatrixWorkspace_sptr &, double) |
| Replaces errors of bins with zero counts with provided value. | |
| void | rotateComponent (const API::MatrixWorkspace_sptr &ws, const std::string &componentName, const Kernel::Quat &rot) |
| LoadHelper::rotateComponent. | |
LoadHelper : Auxiliary functions for Loading Files.
| using Mantid::DataHandling::LoadHelper::detid_t = typedef int32_t |
Definition at line 23 of file LoadHelper.h.
| void Mantid::DataHandling::LoadHelper::addNexusFieldsToWsRun | ( | Nexus::File & | filehandle, |
| API::Run & | runDetails, | ||
| const std::string & | entryName = "", |
||
| bool | useFullAddress = false |
||
| ) |
Add properties from a nexus file to the workspace run.
API entry for recursive routine below
| filehandle | :: Nexus file handle to be parsed, just after an NXopengroup |
| runDetails | :: where to add properties |
| entryName | :: entry name to load properties from |
| useFullAddress | :: use full address to entry in nexus tree to generate the log entry name in Mantid |
Definition at line 128 of file LoadHelper.cpp.
References recurseAndAddNexusFieldsToWsRun().
Referenced by Mantid::DataHandling::LoadILLTOF3::addAllNexusFieldsAsProperties(), Mantid::DataHandling::LoadILLSALSA::fillWorkspaceMetadata(), Mantid::DataHandling::LoadEventNexus::loadEvents(), Mantid::DataHandling::LoadILLDiffraction::loadMetaData(), Mantid::DataHandling::LoadILLLagrange::loadMetaData(), Mantid::DataHandling::LoadILLPolarizedDiffraction::loadMetaData(), Mantid::DataHandling::LoadILLReflectometry::loadNexusEntriesIntoProperties(), Mantid::DataHandling::LoadILLIndirect2::loadNexusEntriesIntoProperties(), and Mantid::DataHandling::LoadILLSANS::setFinalProperties().
| double Mantid::DataHandling::LoadHelper::calculateEnergy | ( | double | wavelength | ) |
Calculate Neutron Energy from wavelength: \( E = h^2 / 2m\lambda ^2 \).
| wavelength | :: wavelength in \( \mbox{\AA} \) |
Definition at line 83 of file LoadHelper.cpp.
References Mantid::PhysicalConstants::h, Mantid::PhysicalConstants::meV, and Mantid::PhysicalConstants::NeutronMass.
Referenced by Mantid::DataHandling::LoadILLTOF2::addEnergyToRun(), Mantid::DataHandling::LoadILLTOF3::addEnergyToRun(), Mantid::DataHandling::LoadILLSANS::loadMetaData(), and Mantid::DataHandling::LoadMLZ::loadRunDetails().
| double Mantid::DataHandling::LoadHelper::calculateTOF | ( | double | distance, |
| double | wavelength | ||
| ) |
Calculate TOF from distance.
| distance | :: distance in meters |
| wavelength | :: wavelength to calculate TOF from |
Definition at line 95 of file LoadHelper.cpp.
References Mantid::PhysicalConstants::h, and Mantid::PhysicalConstants::NeutronMass.
Referenced by Mantid::DataHandling::LoadMLZ::loadDataIntoTheWorkSpace().
| std::string Mantid::DataHandling::LoadHelper::dateTimeInIsoFormat | ( | const std::string & | dateToParse | ) |
Parses the date as formatted at the ILL: 29-Jun-12 11:27:26 and converts it to the ISO format used in Mantid: ISO8601 format string: "yyyy-mm-ddThh:mm:ss[Z+-]tz:tz".
| dateToParse | :: date as string |
Definition at line 302 of file LoadHelper.cpp.
Referenced by Mantid::DataHandling::LoadILLPolarizedDiffraction::loadData(), Mantid::DataHandling::LoadILLReflectometry::loadDataDetails(), Mantid::DataHandling::LoadILLDiffraction::loadDataScan(), Mantid::DataHandling::LoadILLSANS::loadMetaData(), Mantid::DataHandling::LegacyLoadHelper::recurseAndAddNexusFieldsToWsRun(), and recurseAndAddNexusFieldsToWsRun().
| void Mantid::DataHandling::LoadHelper::fillMovingWorkspace | ( | const API::MatrixWorkspace_sptr & | ws, |
| const Mantid::Nexus::NXInt & | data, | ||
| const std::vector< double > & | xAxis, | ||
| int64_t | initialSpectrum = 0, |
||
| const std::set< detid_t > & | acceptedDetectorIDs = std::set<int>(), |
||
| const std::vector< detid_t > & | customDetectorIDs = std::vector<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.
| ws | A MatrixWorkspace to be filled with data |
| data | Data object to extract counts from |
| xAxis | X axis values to be assigned to each spectrum |
| initialSpectrum | Initial spectrum number, optional and defaults to 0 |
| acceptedDetectorIDs | Set of accepted detector IDs, defaults to empty (all accepted) |
| customDetectorIDs | Vector of custom detector IDs to replace the default detectorID calculation, defaults to empty (default calculation) |
| axisOrder | Tuple containing description of axis order of 3D Nexus data, defaults to 0,1,2 meaning tube-pixel-channel order |
Definition at line 495 of file LoadHelper.cpp.
References Mantid::Nexus::NXDataSet::dim0(), Mantid::Nexus::NXDataSet::dim1(), and Mantid::Nexus::NXDataSet::dim2().
Referenced by Mantid::DataHandling::LoadILLDiffraction::fillMovingInstrumentScan().
| void Mantid::DataHandling::LoadHelper::fillStaticWorkspace | ( | const API::MatrixWorkspace_sptr & | ws, |
| const Mantid::Nexus::NXInt & | data, | ||
| 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 > & | acceptedDetectorIDs = 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.
| ws | A MatrixWorkspace to be filled with data |
| data | Data object to extract counts from |
| xAxis | X axis values to be assigned to each spectrum |
| initialSpectrum | Initial spectrum number, optional and defaults to 0 |
| pointData | Switch to decide whether the data is going to be a histogram or point data, defaults to false (histogram) |
| detectorIDs | Vector of detector IDs to override the default spectrum number, defaults to empty (IDs equal to index) |
| acceptedDetectorIDs | Set of accepted detector IDs, defaults to empty (all accepted) |
| axisOrder | Tuple containing information at which position in data one can find tubes, pixels, and channels (scans), defaults to 0,1,2 meaning default order of tube-pixel-channel |
Definition at line 412 of file LoadHelper.cpp.
References Mantid::Nexus::NXDataSet::dim0(), Mantid::Nexus::NXDataSet::dim1(), Mantid::Nexus::NXDataSet::dim2(), loadingOrder(), and Mantid::Kernel::V3D::size().
Referenced by Mantid::DataHandling::LoadILLTOF3::fillScanWorkspace(), Mantid::DataHandling::LoadILLDiffraction::fillStaticInstrumentScan(), Mantid::DataHandling::LoadILLTOF3::fillStaticWorkspace(), Mantid::DataHandling::LoadILLPolarizedDiffraction::loadData(), Mantid::DataHandling::LoadILLReflectometry::loadData(), Mantid::DataHandling::LoadILLSANS::loadDataFromMonitors(), Mantid::DataHandling::LoadILLSANS::loadDataFromTubes(), and Mantid::DataHandling::LoadILLIndirect2::loadDataIntoWorkspace().
| std::string Mantid::DataHandling::LoadHelper::findInstrumentNexusAddress | ( | const Mantid::Nexus::NXEntry & | firstEntry | ) |
Finds the address for the instrument name in the nexus file Usually of the form: entry0/<NXinstrument class>/name.
Definition at line 38 of file LoadHelper.cpp.
References group, and Mantid::Nexus::NXClass::groups().
Referenced by Mantid::DataHandling::LoadILLIndirect2::exec(), Mantid::DataHandling::LoadILLSANS::exec(), Mantid::DataHandling::LoadILLReflectometry::initNames(), Mantid::DataHandling::LoadILLTOF3::loadInstrumentDetails(), Mantid::DataHandling::LoadMLZ::loadInstrumentDetails(), and Mantid::DataHandling::LoadSINQFocus::setInstrumentName().
| V3D Mantid::DataHandling::LoadHelper::getComponentPosition | ( | const API::MatrixWorkspace_sptr & | ws, |
| const std::string & | componentName | ||
| ) |
LoadHelper::getComponentPosition.
| ws | A MatrixWorkspace |
| componentName | The Name of the component of the instrument |
Definition at line 370 of file LoadHelper.cpp.
Referenced by Mantid::DataHandling::LoadILLSANS::exec(), Mantid::DataHandling::LoadILLSANS::moveDetectorDistance(), Mantid::DataHandling::LoadILLSANS::moveDetectorHorizontal(), Mantid::DataHandling::LoadILLSANS::moveDetectorVertical(), and Mantid::DataHandling::LoadSwans::placeDetectorInSpace().
| Nexus::NXDouble Mantid::DataHandling::LoadHelper::getDoubleDataset | ( | const Nexus::NXEntry & | entry, |
| const std::string & | groupName | ||
| ) |
Fetches NXDouble data from the requested group name in the entry provided.
| entry | NXEntry where desired data can be found |
| groupName | Full name of the data group |
Definition at line 568 of file LoadHelper.cpp.
References Mantid::Nexus::NXData::openDoubleData(), and Mantid::Nexus::NXEntry::openNXData().
Referenced by Mantid::DataHandling::LoadILLTOF3::fillScanWorkspace(), Mantid::DataHandling::LoadILLSANS::getOmegaBinning(), Mantid::DataHandling::LoadILLSANS::loadDataFromD16ScanMonitors(), Mantid::DataHandling::LoadILLDiffraction::loadDataScan(), and Mantid::DataHandling::LoadILLTOF3::prepareAxis().
| double Mantid::DataHandling::LoadHelper::getDoubleFromNexusAddress | ( | const Mantid::Nexus::NXEntry & | firstEntry, |
| const std::string & | nexusAddress | ||
| ) |
Definition at line 53 of file LoadHelper.cpp.
References Mantid::Nexus::NXClass::getFloat().
Referenced by Mantid::DataHandling::LoadILLSANS::exec(), and Mantid::DataHandling::LoadILLSANS::getDetectorPositionD33().
| double Mantid::DataHandling::LoadHelper::getInstrumentProperty | ( | const API::MatrixWorkspace_sptr & | workspace, |
| const std::string & | s | ||
| ) |
Definition at line 110 of file LoadHelper.cpp.
References Mantid::EMPTY_DBL(), and workspace.
| Nexus::NXInt Mantid::DataHandling::LoadHelper::getIntDataset | ( | const Nexus::NXEntry & | entry, |
| const std::string & | groupName | ||
| ) |
Fetches NXInt data from the requested group name in the entry provided.
| entry | NXEntry where desired data can be found |
| groupName | Full name of the data group |
Definition at line 557 of file LoadHelper.cpp.
References Mantid::Nexus::NXData::openIntData(), and Mantid::Nexus::NXEntry::openNXData().
Referenced by Mantid::DataHandling::LoadILLTOF3::fillScanWorkspace(), Mantid::DataHandling::LoadILLTOF3::fillStaticWorkspace(), Mantid::DataHandling::LoadILLTOF3::initWorkspace(), Mantid::DataHandling::LoadILLSANS::initWorkSpace(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD11B(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD22B(), Mantid::DataHandling::LoadILLSANS::initWorkSpaceD33(), Mantid::DataHandling::LoadILLPolarizedDiffraction::loadData(), Mantid::DataHandling::LoadILLReflectometry::loadData(), Mantid::DataHandling::LoadILLIndirect2::loadDataDetails(), Mantid::DataHandling::LoadILLSANS::loadDataFromMonitors(), Mantid::DataHandling::LoadILLIndirect2::loadDataIntoWorkspace(), and Mantid::DataHandling::LoadILLIndirect2::loadDiffractionData().
| std::string Mantid::DataHandling::LoadHelper::getStringFromNexusAddress | ( | const Mantid::Nexus::NXEntry & | firstEntry, |
| const std::string & | nexusAddress | ||
| ) |
Definition at line 48 of file LoadHelper.cpp.
References Mantid::Nexus::NXClass::getString().
Referenced by Mantid::DataHandling::LoadILLTOF3::loadInstrumentDetails(), Mantid::DataHandling::LoadMLZ::loadInstrumentDetails(), Mantid::DataHandling::LoadILLSANS::setInstrumentName(), Mantid::DataHandling::LoadSINQFocus::setInstrumentName(), and Mantid::DataHandling::LoadILLIndirect2::setInstrumentName().
| std::vector< double > Mantid::DataHandling::LoadHelper::getTimeBinningFromNexusAddress | ( | const Mantid::Nexus::NXEntry & | firstEntry, |
| const std::string & | nexusAddress | ||
| ) |
Gets the time binning from a Nexus float array Adds an extra bin at the end.
Definition at line 62 of file LoadHelper.cpp.
References Mantid::Nexus::NXDataSet::dim0(), Mantid::Nexus::NXDataSetTyped< T >::load(), and Mantid::Nexus::NXClass::openNXFloat().
Referenced by Mantid::DataHandling::LoadILLSANS::initWorkSpaceD33(), and Mantid::DataHandling::LoadSINQFocus::loadDataIntoTheWorkSpace().
| void Mantid::DataHandling::LoadHelper::loadEmptyInstrument | ( | const API::MatrixWorkspace_sptr & | ws, |
| const std::string & | instrumentName, | ||
| const std::string & | instrumentPath = "" |
||
| ) |
Loads empty instrument of chosen name into a provided workspace.
| ws | A MatrixWorkspace |
| instrumentName | Name of the instrument to be loaded |
| instrumentPath | Path to the instrument definition file, optional |
Definition at line 385 of file LoadHelper.cpp.
Referenced by Mantid::DataHandling::LoadILLIndirect2::exec(), Mantid::DataHandling::LoadILLReflectometry::exec(), Mantid::DataHandling::LoadILLTOF2::exec(), Mantid::DataHandling::LoadILLTOF3::exec(), Mantid::DataHandling::LoadILLDiffraction::fillStaticInstrumentScan(), Mantid::DataHandling::LoadILLDiffraction::initMovingWorkspace(), Mantid::DataHandling::LoadILLLagrange::loadData(), Mantid::DataHandling::LoadILLPolarizedDiffraction::loadData(), Mantid::DataHandling::LoadILLSANS::runLoadInstrument(), and Mantid::DataHandling::LoadILLSALSA::setInstrument().
| void Mantid::DataHandling::LoadHelper::loadingOrder | ( | const std::tuple< short, short, short > & | dataOrder, |
| int * | dataIndices | ||
| ) |
Handles non-standard loading order of the provided data, based on the provided data dimension order.
| dataOrder | tuple containing where tubes, pixels, and channels (scans) can be found in data |
| dataIndices | pointer to the array containing data indices to be set |
Definition at line 474 of file LoadHelper.cpp.
Referenced by fillStaticWorkspace(), and Mantid::DataHandling::LegacyLoadHelper::fillStaticWorkspace().
| void Mantid::DataHandling::LoadHelper::moveComponent | ( | const API::MatrixWorkspace_sptr & | ws, |
| const std::string & | componentName, | ||
| const Kernel::V3D & | newPos | ||
| ) |
| ws | A MatrixWorkspace |
| componentName | The name of the component of the instrument |
| newPos | New position of the component |
Definition at line 335 of file LoadHelper.cpp.
Referenced by Mantid::DataHandling::LoadILLReflectometry::placeDetector(), Mantid::DataHandling::LoadSwans::placeDetectorInSpace(), Mantid::DataHandling::LoadILLReflectometry::placeSlits(), and Mantid::DataHandling::LoadILLReflectometry::placeSource().
| void Mantid::DataHandling::LoadHelper::recurseAndAddNexusFieldsToWsRun | ( | Nexus::File & | filehandle, |
| API::Run & | runDetails, | ||
| const std::string & | parent_name, | ||
| const std::string & | parent_class, | ||
| int | level, | ||
| bool | useFullAddress | ||
| ) |
Recursively add properties from a nexus file to the workspace run.
| filehandle | :: Nexus file handle to be parsed, just after an NXopengroup |
| runDetails | :: where to add properties |
| parent_name | :: nexus caller name |
| parent_class | :: nexus caller class |
| level | :: current level in nexus tree |
| useFullAddress | :: use full address to entry in nexus tree to generate the log entry name in Mantid |
Definition at line 199 of file LoadHelper.cpp.
References Mantid::API::LogManager::addProperty(), NXnumtype::CHAR, dateTimeInIsoFormat(), Mantid::Nexus::Info::dims, NXnumtype::FLOAT32, NXnumtype::FLOAT64, Mantid::API::g_log, Mantid::API::LogManager::getProperty(), Mantid::API::LogManager::hasProperty(), NXnumtype::INT16, NXnumtype::INT32, recurseAndAddNexusFieldsToWsRun(), Mantid::Kernel::Property::setValue(), Mantid::Nexus::Info::type, NXnumtype::UINT16, and Mantid::Kernel::Logger::warning().
Referenced by addNexusFieldsToWsRun(), and recurseAndAddNexusFieldsToWsRun().
| void Mantid::DataHandling::LoadHelper::replaceZeroErrors | ( | const API::MatrixWorkspace_sptr & | ws, |
| double | zeroCountsError | ||
| ) |
Replaces errors of bins with zero counts with provided value.
| ws | MatrixWorkspace to have its zero errors replaced |
| zeroCountsError | Value to replace default error of square root of counts |
Definition at line 543 of file LoadHelper.cpp.
References error.
Referenced by Mantid::DataHandling::LoadILLPolarizedDiffraction::loadData().
| void Mantid::DataHandling::LoadHelper::rotateComponent | ( | const API::MatrixWorkspace_sptr & | ws, |
| const std::string & | componentName, | ||
| const Kernel::Quat & | rot | ||
| ) |
| ws | A MantrixWorkspace |
| componentName | The Name of the component of the instrument |
| rot | Rotations defined by setting a quaternion from an angle in degrees and an axis |
Definition at line 353 of file LoadHelper.cpp.
Referenced by Mantid::DataHandling::LoadILLReflectometry::placeDetector(), and Mantid::DataHandling::LoadSwans::placeDetectorInSpace().