|
Mantid
|
#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. | |
| static std::string | getParameterFilename (const std::string &instrumentName, const std::string &date="", const std::string &dirHint="") |
| Get the Parameter file using the instrument name and date, optionally searching dirHint first before the standard instrument directories. | |
| 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 "". | |
| 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, ..) | |
| static void | getValidFromTo (const std::string &IDFfilename, std::string &outValidFrom, std::string &outValidTo) |
| Utility to retrieve the validity dates for the given IDF. | |
Static Private Member Functions | |
| static std::string | getFilenameByInstrumentDateAndSearchTerm (const std::string &instrumentName, const std::string &date, const std::string &searchTerm, const std::vector< std::string > &fileFormats, const std::string &dirHint="") |
| This method returns a file name which finds a file which contains the given instrument name + search term and is valid at the given date. | |
| static const std::string | getNormalisedDate (const std::string &date) |
| If date with only YYYY - MM - DD was provided (no time component), append midnight so DateAndTime can parse it. | |
| static std::string | lookupIPF (const std::string &dir, std::string filename) |
Definition at line 16 of file InstrumentFileFinder.h.
|
staticprivate |
This method returns a file name which finds a file which contains the given instrument name + search term and is valid at the given date.
The search will look for filenames which start with InstrumentName + SearchTerm and match the provided file formats.
If several files are found with valid names and valid date ranges, the file with the most recent "valid-from" date is selected. If files are found with valid names but which do not match the date, the file with the most recent "valid-from" date is selected.
If no file is found to have a valid name, an empty string is returned.
| instrumentName | :: Instrument name e.g. GEM, TOPAS or BIOSANS |
| date | :: ISO 8601 date |
| searchTerm | :: Snippet expected as part of filename eg. "_Definition" or "_Parameters" |
| fileFormats | :: Acceptable file extensions |
| dirHint | :: Any non-standard directory that should be search alongside the Instrument Directories |
Definition at line 88 of file InstrumentFileFinder.cpp.
References Mantid::Kernel::Logger::debug(), Mantid::API::g_log, and getResourceFilenames().
Referenced by getInstrumentFilename(), and getParameterFilename().
|
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 search will look for filenames which start with InstrumentName + _Definition and match the above extensions.
If several files are found with valid names and valid date ranges, the file with the most recent "valid-from" date is selected. If files are found with valid names but which do not match the date, the file with the most recent "valid-from" date is selected.
If no file is found to have a valid name, an empty string is returned.
| instrumentName | :: Instrument name e.g. GEM, TOPAS or BIOSANS |
| date | :: ISO 8601 date |
Definition at line 153 of file InstrumentFileFinder.cpp.
References getFilenameByInstrumentDateAndSearchTerm().
Referenced by Mantid::DataHandling::LoadDetectorsGroupingFile::exec(), Mantid::DataHandling::LoadInstrument::exec(), Mantid::DataHandling::LoadNXSPE::exec(), Mantid::DataHandling::SNSAppendGeometryToNexus::exec(), export_ExperimentInfo(), exportInstrumentFileFinder(), Mantid::DataHandling::NXcanSAS::InstrumentNameInfo::getIdfFromFile(), getInstrumentFilenameWarn(), Mantid::Algorithms::VesuvioL1ThetaResolution::loadInstrument(), Mantid::DataHandling::LoadEventNexus::runLoadInstrument(), MantidQt::MantidWidgets::SlitCalculator::setInstrument(), and Mantid::API::ExperimentInfo::setInstumentFromXML().
|
staticprivate |
If date with only YYYY - MM - DD was provided (no time component), append midnight so DateAndTime can parse it.
Otherwise just return back the same date string
| date | :: string of date read from file |
Definition at line 65 of file InstrumentFileFinder.cpp.
Referenced by getResourceFilenames().
|
static |
Get the Parameter file using the instrument name and date, optionally searching dirHint first before the standard instrument directories.
A given instrument may also have multiple parameter files associated with it.
This method returns a file name which identifies a parameter file associated with the given date for a given instrument. The parameter can be loaded from either a ".xml" file (old-style IDF) or a ".hdf5/.nxs" file (new-style nexus).
The search will look for filenames which start with InstrumentName + _Parameters and match the above extensions.
If several files are found with valid names and valid date ranges, the file with the most recent "valid-from" date is selected. If files are found with valid names but which do not match the date, the file with the most recent "valid-from" date is selected.
If no file is found to have a valid name, an empty string is returned.
| instrumentName | :: Instrument name e.g. GEM, TOPAS or BIOSANS |
| date | :: ISO 8601 date |
| dirHint | :: Any non-standard directory that should be search alongside the Instrument Directories |
Definition at line 176 of file InstrumentFileFinder.cpp.
References getFilenameByInstrumentDateAndSearchTerm().
Referenced by exportInstrumentFileFinder(), Mantid::DataHandling::LoadIDFFromNexus::loadParameterFile(), and Mantid::DataHandling::LoadInstrument::runLoadParameterFile().
|
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 184 of file InstrumentFileFinder.cpp.
References Mantid::Kernel::Logger::debug(), Mantid::API::g_log, Mantid::Kernel::ConfigServiceImpl::getInstrumentDirectories(), and lookupIPF().
Referenced by exportInstrumentFileFinder().
|
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.
| 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 |
Definition at line 264 of file InstrumentFileFinder.cpp.
References Mantid::Geometry::d, Mantid::Kernel::Logger::debug(), Mantid::API::g_log, getNormalisedDate(), getResourceFilenames(), getValidFromTo(), and Mantid::Kernel::Logger::warning().
Referenced by getFilenameByInstrumentDateAndSearchTerm(), getResourceFilenames(), and getResourceFilenames().
|
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.
| 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 394 of file InstrumentFileFinder.cpp.
Referenced by getResourceFilenames(), and Mantid::DataHandling::LoadInstrument::runLoadParameterFile().
|
staticprivate |
Definition at line 215 of file InstrumentFileFinder.cpp.
Referenced by getParameterPath().