Mantid
|
LoadHelper : Auxiliary functions for Loading Files. More...
Functions | |
void | addNexusFieldsToWsRun (NXhandle nxfileID, API::Run &runDetails, const std::string &entryName="", bool useFullPath=false) |
Add properties from a nexus file to the workspace run. More... | |
double | calculateEnergy (double) |
Calculate Neutron Energy from wavelength: \( E = h^2 / 2m\lambda ^2 \). More... | |
double | calculateTOF (double, double) |
Calculate TOF from distance. More... | |
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". More... | |
void | dumpNexusAttributes (NXhandle nxfileID) |
Show attributes attached to the current Nexus entry. More... | |
std::string | findInstrumentNexusPath (const Mantid::NeXus::NXEntry &) |
Finds the path for the instrument name in the nexus file Usually of the form: entry0/<NXinstrument class>/name. More... | |
Kernel::V3D | getComponentPosition (const API::MatrixWorkspace_sptr &ws, const std::string &componentName) |
LoadHelper::getComponentPosition. More... | |
double | getDoubleFromNexusPath (const Mantid::NeXus::NXEntry &, const std::string &) |
double | getInstrumentProperty (const API::MatrixWorkspace_sptr &, const std::string &) |
std::string | getStringFromNexusPath (const Mantid::NeXus::NXEntry &, const std::string &) |
std::vector< double > | getTimeBinningFromNexusPath (const Mantid::NeXus::NXEntry &, const std::string &) |
Gets the time binning from a Nexus float array Adds an extra bin at the end. More... | |
void | loadEmptyInstrument (const API::MatrixWorkspace_sptr &ws, const std::string &instrumentName, const std::string &instrumentPath="") |
void | moveComponent (const API::MatrixWorkspace_sptr &ws, const std::string &componentName, const Kernel::V3D &newPos) |
LoadHelper::moveComponent. More... | |
void | recurseAndAddNexusFieldsToWsRun (NXhandle nxfileID, API::Run &runDetails, std::string &parent_name, std::string &parent_class, int level, bool useFullPath) |
Recursively add properties from a nexus file to the workspace run. More... | |
void | rotateComponent (const API::MatrixWorkspace_sptr &ws, const std::string &componentName, const Kernel::Quat &rot) |
LoadHelper::rotateComponent. More... | |
LoadHelper : Auxiliary functions for Loading Files.
void Mantid::DataHandling::LoadHelper::addNexusFieldsToWsRun | ( | NXhandle | nxfileID, |
API::Run & | runDetails, | ||
const std::string & | entryName = "" , |
||
bool | useFullPath = false |
||
) |
Add properties from a nexus file to the workspace run.
API entry for recursive routine below
nxfileID | :: Nexus file handle to be parsed, just after an NXopengroup |
runDetails | :: where to add properties |
entryName | :: entry name to load properties from |
useFullPath | :: use full path to entry in nexus tree to generate the log entry name in Mantid |
Definition at line 131 of file LoadHelper.cpp.
References recurseAndAddNexusFieldsToWsRun().
Referenced by Mantid::DataHandling::LoadILLTOF2::addAllNexusFieldsAsProperties(), Mantid::DataHandling::LoadILLSALSA::fillWorkspaceMetadata(), Mantid::DataHandling::LoadEventNexus::loadEvents(), Mantid::DataHandling::LoadILLDiffraction::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 82 of file LoadHelper.cpp.
References Mantid::PhysicalConstants::h, Mantid::PhysicalConstants::meV, and Mantid::PhysicalConstants::NeutronMass.
Referenced by Mantid::DataHandling::LoadILLTOF2::addEnergyToRun(), Mantid::DataHandling::LoadILLSANS::loadMetaData(), Mantid::DataHandling::LoadLLB::loadRunDetails(), 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 94 of file LoadHelper.cpp.
References Mantid::PhysicalConstants::h, and Mantid::PhysicalConstants::NeutronMass.
Referenced by Mantid::DataHandling::LoadMLZ::loadDataIntoTheWorkSpace(), and Mantid::DataHandling::LoadLLB::setTimeBinning().
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 421 of file LoadHelper.cpp.
Referenced by Mantid::DataHandling::LoadILLPolarizedDiffraction::loadData(), Mantid::DataHandling::LoadILLReflectometry::loadDataDetails(), Mantid::DataHandling::LoadILLDiffraction::loadDataScan(), Mantid::DataHandling::LoadILLSANS::loadMetaData(), and recurseAndAddNexusFieldsToWsRun().
void Mantid::DataHandling::LoadHelper::dumpNexusAttributes | ( | NXhandle | nxfileID | ) |
Show attributes attached to the current Nexus entry.
nxfileID | The Nexus entry |
Definition at line 362 of file LoadHelper.cpp.
References value.
std::string Mantid::DataHandling::LoadHelper::findInstrumentNexusPath | ( | const Mantid::NeXus::NXEntry & | firstEntry | ) |
Finds the path for the instrument name in the nexus file Usually of the form: entry0/<NXinstrument class>/name.
Definition at line 37 of file LoadHelper.cpp.
References Mantid::NeXus::NXClass::groups().
Referenced by Mantid::DataHandling::LoadILLIndirect2::exec(), Mantid::DataHandling::LoadILLSANS::exec(), Mantid::DataHandling::LoadILLReflectometry::initNames(), Mantid::DataHandling::LoadILLTOF2::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 489 of file LoadHelper.cpp.
Referenced by Mantid::DataHandling::LoadSwans::placeDetectorInSpace().
double Mantid::DataHandling::LoadHelper::getDoubleFromNexusPath | ( | const Mantid::NeXus::NXEntry & | firstEntry, |
const std::string & | nexusPath | ||
) |
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 109 of file LoadHelper.cpp.
References Mantid::EMPTY_DBL(), and workspace.
std::string Mantid::DataHandling::LoadHelper::getStringFromNexusPath | ( | const Mantid::NeXus::NXEntry & | firstEntry, |
const std::string & | nexusPath | ||
) |
Definition at line 49 of file LoadHelper.cpp.
References Mantid::NeXus::NXClass::getString().
Referenced by Mantid::DataHandling::LoadILLTOF2::loadInstrumentDetails(), Mantid::DataHandling::LoadMLZ::loadInstrumentDetails(), Mantid::DataHandling::LoadILLSANS::setInstrumentName(), Mantid::DataHandling::LoadLLB::setInstrumentName(), Mantid::DataHandling::LoadSINQFocus::setInstrumentName(), and Mantid::DataHandling::LoadILLIndirect2::setInstrumentName().
std::vector< double > Mantid::DataHandling::LoadHelper::getTimeBinningFromNexusPath | ( | const Mantid::NeXus::NXEntry & | firstEntry, |
const std::string & | nexusPath | ||
) |
Gets the time binning from a Nexus float array Adds an extra bin at the end.
Definition at line 61 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 = "" |
||
) |
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 454 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 | ( | NXhandle | nxfileID, |
API::Run & | runDetails, | ||
std::string & | parent_name, | ||
std::string & | parent_class, | ||
int | level, | ||
bool | useFullPath | ||
) |
Recursively add properties from a nexus file to the workspace run.
nxfileID | :: 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 |
useFullPath | :: use full path to entry in nexus tree to generate the log entry name in Mantid |
< return status
< NX data type if a dataset, e.g. NX_CHAR, NX_FLOAT32, see
napi.h
Definition at line 168 of file LoadHelper.cpp.
References Mantid::API::LogManager::addProperty(), dateTimeInIsoFormat(), Mantid::API::g_log, Mantid::API::LogManager::getProperty(), Mantid::API::LogManager::hasProperty(), recurseAndAddNexusFieldsToWsRun(), Mantid::Kernel::Property::setValue(), std::to_string(), and Mantid::Kernel::Logger::warning().
Referenced by addNexusFieldsToWsRun(), and recurseAndAddNexusFieldsToWsRun().
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 472 of file LoadHelper.cpp.
Referenced by Mantid::DataHandling::LoadILLReflectometry::placeDetector(), and Mantid::DataHandling::LoadSwans::placeDetectorInSpace().