Mantid
Loading...
Searching...
No Matches
Static Public Member Functions | Static Private Member Functions | List of all members
Mantid::API::InstrumentFileFinder Class Reference

#include <InstrumentFileFinder.h>

Static Public Member Functions

static std::string getInstrumentFilename (const std::string &instrumentName, const std::string &date="")
 Get the IDF using the instrument name and date. More...
 
static std::string getParameterPath (const std::string &instName, const std::string &dirHint="")
 Search instrument directories for Parameter file, return full path name if found, else "". More...
 
static std::vector< std::string > getResourceFilenames (const std::string &prefix, const std::vector< std::string > &fileFormats, const std::vector< std::string > &directoryNames, const std::string &date)
 Utility to retrieve a resource file (IDF, Parameters, ..) More...
 
static void getValidFromTo (const std::string &IDFfilename, std::string &outValidFrom, std::string &outValidTo)
 Utility to retrieve the validity dates for the given IDF. More...
 

Static Private Member Functions

static std::string lookupIPF (const std::string &dir, std::string filename)
 

Detailed Description

Definition at line 16 of file InstrumentFileFinder.h.

Member Function Documentation

◆ getInstrumentFilename()

std::string Mantid::API::InstrumentFileFinder::getInstrumentFilename ( const std::string &  instrumentName,
const std::string &  date = "" 
)
static

Get the IDF using the instrument name and date.

A given instrument may have multiple definition files associated with it.

This method returns a file name which identifies a given instrument definition for a given instrument. The instrument geometry can be loaded from either a ".xml" file (old-style IDF) or a ".hdf5/.nxs" file (new-style nexus). The filename is required to be of the form InstrumentName + _Definition + Identifier + extension. The identifier then is the part of a filename that identifies the instrument definition valid at a given date.

If several instrument files files are valid at the given date the file with the most recent from date is selected. If no such files are found the file with the latest from date is selected.

If no file is found for the given instrument, an empty string is returned.

Parameters
instrumentName:: Instrument name e.g. GEM, TOPAS or BIOSANS
date:: ISO 8601 date
Returns
full path of instrument geometry file
Exceptions
Exception::NotFoundErrorIf no valid instrument definition filename is found

Definition at line 83 of file InstrumentFileFinder.cpp.

References Mantid::Kernel::Logger::debug(), Mantid::API::g_log, getResourceFilenames(), and Mantid::Kernel::SingletonHolder< T >::Instance().

Referenced by Mantid::DataHandling::LoadDetectorsGroupingFile::exec(), Mantid::DataHandling::LoadInstrument::exec(), Mantid::DataHandling::LoadNXSPE::exec(), Mantid::DataHandling::SNSAppendGeometryToNexus::exec(), export_ExperimentInfo(), exportInstrumentFileFinder(), getInstrumentFilenameWarn(), Mantid::Algorithms::VesuvioL1ThetaResolution::loadInstrument(), Mantid::DataHandling::LoadEventNexus::runLoadInstrument(), MantidQt::MantidWidgets::SlitCalculator::setInstrument(), and Mantid::API::ExperimentInfo::setInstumentFromXML().

◆ getParameterPath()

std::string Mantid::API::InstrumentFileFinder::getParameterPath ( const std::string &  instName,
const std::string &  dirHint = "" 
)
static

Search instrument directories for Parameter file, return full path name if found, else "".

Search the directory for the Parameter IDF file and return full path name if found, else return "".

Definition at line 108 of file InstrumentFileFinder.cpp.

References Mantid::Kernel::Logger::debug(), Mantid::API::g_log, Mantid::Kernel::ConfigServiceImpl::getInstrumentDirectories(), Mantid::Kernel::SingletonHolder< T >::Instance(), and lookupIPF().

Referenced by exportInstrumentFileFinder(), and Mantid::DataHandling::LoadInstrument::runLoadParameterFile().

◆ getResourceFilenames()

std::vector< std::string > Mantid::API::InstrumentFileFinder::getResourceFilenames ( const std::string &  prefix,
const std::vector< std::string > &  fileFormats,
const std::vector< std::string > &  directoryNames,
const std::string &  date 
)
static

Utility to retrieve a resource file (IDF, Parameters, ..)

Compile a list of files in compliance with name pattern-matching, file format, and date-stamp constraints.

Ideally, the valid-from and valid-to of any valid file should encapsulate argument date. If this is not possible, then the file with the most recent valid-from stamp is selected.

Parameters
prefix:: the name of a valid file must begin with this pattern
fileFormats:: the extension of a valid file must be one of these formats
directoryNames:: search only in these directories
date:: the valid-from and valid-to of a valid file should encapsulate this date
Returns
list of absolute paths for each valid file

Definition at line 189 of file InstrumentFileFinder.cpp.

References Mantid::Geometry::d, Mantid::Kernel::Logger::debug(), Mantid::API::g_log, getResourceFilenames(), and getValidFromTo().

Referenced by getInstrumentFilename(), getResourceFilenames(), and getResourceFilenames().

◆ getValidFromTo()

void Mantid::API::InstrumentFileFinder::getValidFromTo ( const std::string &  IDFfilename,
std::string &  outValidFrom,
std::string &  outValidTo 
)
static

Utility to retrieve the validity dates for the given IDF.

Return from an IDF the values of the valid-from and valid-to attributes.

Parameters
IDFfilename:: Full path of an IDF
[out]outValidFrom:: Used to return valid-from date
[out]outValidTo:: Used to return valid-to date

Definition at line 287 of file InstrumentFileFinder.cpp.

Referenced by getResourceFilenames().

◆ lookupIPF()

std::string Mantid::API::InstrumentFileFinder::lookupIPF ( const std::string &  dir,
std::string  filename 
)
staticprivate

Definition at line 139 of file InstrumentFileFinder.cpp.

References Mantid::DataHandling::exists().

Referenced by getParameterPath().


The documentation for this class was generated from the following files: