Mantid
Loading...
Searching...
No Matches
Functions
Mantid::DataHandling::LoadHelper Namespace Reference

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...
 

Detailed Description

LoadHelper : Auxiliary functions for Loading Files.

Function Documentation

◆ addNexusFieldsToWsRun()

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

Parameters
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().

◆ calculateEnergy()

double Mantid::DataHandling::LoadHelper::calculateEnergy ( double  wavelength)

Calculate Neutron Energy from wavelength: \( E = h^2 / 2m\lambda ^2 \).

Parameters
wavelength:: wavelength in \( \mbox{\AA} \)
Returns
tof in seconds

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().

◆ calculateTOF()

double Mantid::DataHandling::LoadHelper::calculateTOF ( double  distance,
double  wavelength 
)

Calculate TOF from distance.

Parameters
distance:: distance in meters
wavelength:: wavelength to calculate TOF from
Returns
tof in seconds

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().

◆ dateTimeInIsoFormat()

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".

Parameters
dateToParse:: date as string
Returns
date as required in Mantid

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().

◆ dumpNexusAttributes()

void Mantid::DataHandling::LoadHelper::dumpNexusAttributes ( NXhandle  nxfileID)

Show attributes attached to the current Nexus entry.

Parameters
nxfileIDThe Nexus entry

Definition at line 362 of file LoadHelper.cpp.

References value.

◆ findInstrumentNexusPath()

std::string Mantid::DataHandling::LoadHelper::findInstrumentNexusPath ( const Mantid::NeXus::NXEntry firstEntry)

◆ getComponentPosition()

V3D Mantid::DataHandling::LoadHelper::getComponentPosition ( const API::MatrixWorkspace_sptr ws,
const std::string &  componentName 
)

LoadHelper::getComponentPosition.

Parameters
wsA MatrixWorkspace
componentNameThe Name of the component of the instrument
Returns
The position of the component

Definition at line 489 of file LoadHelper.cpp.

Referenced by Mantid::DataHandling::LoadSwans::placeDetectorInSpace().

◆ getDoubleFromNexusPath()

double Mantid::DataHandling::LoadHelper::getDoubleFromNexusPath ( const Mantid::NeXus::NXEntry firstEntry,
const std::string &  nexusPath 
)

◆ getInstrumentProperty()

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.

◆ getStringFromNexusPath()

std::string Mantid::DataHandling::LoadHelper::getStringFromNexusPath ( const Mantid::NeXus::NXEntry firstEntry,
const std::string &  nexusPath 
)

◆ getTimeBinningFromNexusPath()

std::vector< double > Mantid::DataHandling::LoadHelper::getTimeBinningFromNexusPath ( const Mantid::NeXus::NXEntry firstEntry,
const std::string &  nexusPath 
)

◆ loadEmptyInstrument()

void Mantid::DataHandling::LoadHelper::loadEmptyInstrument ( const API::MatrixWorkspace_sptr ws,
const std::string &  instrumentName,
const std::string &  instrumentPath = "" 
)

◆ moveComponent()

void Mantid::DataHandling::LoadHelper::moveComponent ( const API::MatrixWorkspace_sptr ws,
const std::string &  componentName,
const Kernel::V3D newPos 
)

LoadHelper::moveComponent.

Parameters
wsA MatrixWorkspace
componentNameThe name of the component of the instrument
newPosNew 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().

◆ recurseAndAddNexusFieldsToWsRun()

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.

Parameters
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().

◆ rotateComponent()

void Mantid::DataHandling::LoadHelper::rotateComponent ( const API::MatrixWorkspace_sptr ws,
const std::string &  componentName,
const Kernel::Quat rot 
)

LoadHelper::rotateComponent.

Parameters
wsA MantrixWorkspace
componentNameThe Name of the component of the instrument
rotRotations 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().