Commit bdf4de0a authored by David Fairbrother's avatar David Fairbrother
Browse files

Rename to InstrumentFileFinder and add deprecation warn

Renames FileFinderHelper to InstrumentFileFinder following a PR comment.
Additionally it adds a deprecated warning to the Python export
parent ac0414ae
......@@ -39,7 +39,7 @@ set(SRC_FILES
src/Expression.cpp
src/FileBackedExperimentInfo.cpp
src/FileFinder.cpp
src/FileFinderHelpers.cpp
src/InstrumentFileFinder.cpp
src/FileLoaderRegistry.cpp
src/FileProperty.cpp
src/FrameworkManager.cpp
......@@ -211,7 +211,7 @@ set(INC_FILES
inc/MantidAPI/Expression.h
inc/MantidAPI/FileBackedExperimentInfo.h
inc/MantidAPI/FileFinder.h
inc/MantidAPI/FileFinderHelpers.h
inc/MantidAPI/InstrumentFileFinder.h
inc/MantidAPI/FileLoaderRegistry.h
inc/MantidAPI/FileProperty.h
inc/MantidAPI/FrameworkManager.h
......@@ -407,7 +407,7 @@ set(TEST_FILES
ExpressionTest.h
FileBackedExperimentInfoTest.h
FileFinderTest.h
FileFinderHelpersTest.h
InstrumentFileFinderTest.h
FilePropertyTest.h
FrameworkManagerTest.h
FuncMinimizerFactoryTest.h
......
......@@ -13,12 +13,12 @@
namespace Mantid::API {
class MANTID_API_DLL FileFinderHelpers {
class MANTID_API_DLL InstrumentFileFinder {
public:
/// Search instrument directories for Parameter file,
/// return full path name if found, else "".
static std::string getIPFPath(const std::string &instName,
const std::string &dirHint = "");
static std::string getParameterPath(const std::string &instName,
const std::string &dirHint = "");
/// Get the IDF using the instrument name and date
static std::string getInstrumentFilename(const std::string &instrumentName,
......
......@@ -5,8 +5,8 @@
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidAPI/ExperimentInfo.h"
#include "MantidAPI/FileFinderHelpers.h"
#include "MantidAPI/InstrumentDataService.h"
#include "MantidAPI/InstrumentFileFinder.h"
#include "MantidAPI/ResizeRectangularDetectorHelper.h"
#include "MantidAPI/Run.h"
#include "MantidAPI/Sample.h"
......@@ -1099,7 +1099,7 @@ void ExperimentInfo::setInstumentFromXML(const std::string &nxFilename,
} else {
// XML was not included or was empty
// Use the instrument name to find the file
instrumentFilename = FileFinderHelpers::getInstrumentFilename(
instrumentFilename = InstrumentFileFinder::getInstrumentFilename(
instrumentName, getWorkspaceStartDate());
// And now load the contents
instrumentXml = loadInstrumentXML(instrumentFilename);
......
#include "MantidAPI/FileFinderHelpers.h"
#include "MantidAPI/InstrumentFileFinder.h"
#include "MantidKernel/ConfigService.h"
#include "MantidKernel/DateAndTime.h"
......@@ -24,7 +24,7 @@ using namespace Poco::XML;
namespace {
/// static logger object
Mantid::Kernel::Logger g_log("FileFinderHelpers");
Mantid::Kernel::Logger g_log("InstrumentFileFinder");
// used to terminate SAX process
class DummyException {
......@@ -88,8 +88,8 @@ namespace Mantid::API {
*is found
*/
std::string
FileFinderHelpers::getInstrumentFilename(const std::string &instrumentName,
const std::string &date) {
InstrumentFileFinder::getInstrumentFilename(const std::string &instrumentName,
const std::string &date) {
const std::vector<std::string> validFormats = {"xml", "nxs", "hdf5"};
g_log.debug() << "Looking for instrument file for " << instrumentName
<< " that is valid on '" << date << "'\n";
......@@ -117,8 +117,8 @@ FileFinderHelpers::getInstrumentFilename(const std::string &instrumentName,
/// Search the directory for the Parameter IDF file and return full path name if
/// found, else return "".
// directoryName must include a final '/'.
std::string FileFinderHelpers::getIPFPath(const std::string &instName,
const std::string &dirHint) {
std::string InstrumentFileFinder::getParameterPath(const std::string &instName,
const std::string &dirHint) {
// Remove the path from the filename, some legacy callers will pass in
// a full path rather than a filename
Poco::Path filePath(instName);
......@@ -150,8 +150,8 @@ std::string FileFinderHelpers::getIPFPath(const std::string &instName,
return "";
}
std::string FileFinderHelpers::lookupIPF(const std::string &dir,
std::string filename) {
std::string InstrumentFileFinder::lookupIPF(const std::string &dir,
std::string filename) {
const std::string ext = ".xml";
// Remove .xml for example if abc.xml was passed
boost::algorithm::ierase_all(filename, ext);
......@@ -204,7 +204,7 @@ std::string FileFinderHelpers::lookupIPF(const std::string &dir,
* this date
* @return list of absolute paths for each valid file
*/
std::vector<std::string> FileFinderHelpers::getResourceFilenames(
std::vector<std::string> InstrumentFileFinder::getResourceFilenames(
const std::string &prefix, const std::vector<std::string> &fileFormats,
const std::vector<std::string> &directoryNames, const std::string &date) {
......@@ -214,8 +214,8 @@ std::vector<std::string> FileFinderHelpers::getResourceFilenames(
const std::string now =
Types::Core::DateAndTime::getCurrentTime().toISO8601String();
// Recursively call this method, but with all parameters.
return FileFinderHelpers::getResourceFilenames(prefix, fileFormats,
directoryNames, now);
return InstrumentFileFinder::getResourceFilenames(prefix, fileFormats,
directoryNames, now);
}
// Join all the file formats into a single string
......@@ -310,9 +310,9 @@ std::vector<std::string> FileFinderHelpers::getResourceFilenames(
* @param[out] outValidFrom :: Used to return valid-from date
* @param[out] outValidTo :: Used to return valid-to date
*/
void FileFinderHelpers::getValidFromTo(const std::string &IDFfilename,
std::string &outValidFrom,
std::string &outValidTo) {
void InstrumentFileFinder::getValidFromTo(const std::string &IDFfilename,
std::string &outValidFrom,
std::string &outValidTo) {
SAXParser pParser;
// Create on stack to ensure deletion. Relies on pParser also being local
// variable.
......
......@@ -6,7 +6,7 @@
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidAPI/FileFinderHelpers.h"
#include "MantidAPI/InstrumentFileFinder.h"
#include "MantidKernel/ConfigService.h"
#include "MantidKernel/DateAndTime.h"
......@@ -25,7 +25,7 @@ using namespace Mantid::Kernel;
using namespace Mantid::API;
using Mantid::Types::Core::DateAndTime;
class FileFinderHelpersTest : public CxxTest::TestSuite {
class InstrumentFileFinderTest : public CxxTest::TestSuite {
public:
struct fromToEntry {
std::string path;
......@@ -54,7 +54,8 @@ public:
if (boost::regex_match(l_filenamePart, regex)) {
std::string validFrom, validTo;
FileFinderHelpers::getValidFromTo(dir_itr->path(), validFrom, validTo);
InstrumentFileFinder::getValidFromTo(dir_itr->path(), validFrom,
validTo);
size_t found;
found = l_filenamePart.find("_Definition");
......@@ -102,25 +103,25 @@ public:
// Check that instrument dirs are searched correctly
const std::string expectedFileName = "GEM_parameters.xml";
const auto result = FileFinderHelpers::getIPFPath("GEM");
const auto result = InstrumentFileFinder::getParameterPath("GEM");
TS_ASSERT(boost::icontains(result, expectedFileName));
// Should be case insensitive
const auto mixedResult =
FileFinderHelpers::getIPFPath("GEM_defINITION.xml");
InstrumentFileFinder::getParameterPath("GEM_defINITION.xml");
TS_ASSERT_EQUALS(result, mixedResult);
}
void testFindIPFWithDate() {
const std::string input = "D2B_Definition_2018-03-01.xml";
const auto result = FileFinderHelpers::getIPFPath(input);
const auto result = InstrumentFileFinder::getParameterPath(input);
const std::string expected = "D2B_Parameters_2018-03-01.xml";
TS_ASSERT(boost::icontains(result, expected));
}
void testFindIPFNonExistant() {
const auto result = FileFinderHelpers::getIPFPath("NotThere");
const auto result = InstrumentFileFinder::getParameterPath("NotThere");
TS_ASSERT_EQUALS("", result);
}
......@@ -133,7 +134,7 @@ public:
Poco::File fileHandle(expectedPath);
fileHandle.createFile();
const auto result = FileFinderHelpers::getIPFPath("test", tmpDir);
const auto result = InstrumentFileFinder::getParameterPath("test", tmpDir);
// Ensure file was found and it's in the tmp dir
TS_ASSERT(result.find(filename) != std::string::npos);
TS_ASSERT(result.find(tmpDir) != std::string::npos);
......@@ -141,14 +142,15 @@ public:
void testNonExistantIPFWithHint() {
const auto tmpDir = Poco::Path::temp();
const auto result = FileFinderHelpers::getIPFPath("notThere", tmpDir);
const auto result =
InstrumentFileFinder::getParameterPath("notThere", tmpDir);
TS_ASSERT(result.empty());
}
//
void testHelperFunctions() {
ConfigService::Instance().updateFacilities();
FileFinderHelpers helper;
InstrumentFileFinder helper;
std::string boevs =
helper.getInstrumentFilename("BIOSANS", "2100-01-31 22:59:59");
TS_ASSERT(!boevs.empty());
......@@ -156,7 +158,7 @@ public:
//
void testHelper_TOPAZ_No_To_Date() {
FileFinderHelpers helper;
InstrumentFileFinder helper;
std::string boevs =
helper.getInstrumentFilename("TOPAZ", "2011-01-31 22:59:59");
TS_ASSERT(!boevs.empty());
......@@ -168,7 +170,7 @@ public:
const std::string testDir = instDir + "unit_testing";
ConfigService::Instance().setString("instrumentDefinition.directory",
testDir);
FileFinderHelpers helper;
InstrumentFileFinder helper;
std::string boevs =
helper.getInstrumentFilename("ARGUS", "1909-01-31 22:59:59");
TS_ASSERT_DIFFERS(boevs.find("TEST1_ValidDateOverlap"), std::string::npos);
......@@ -202,7 +204,7 @@ public:
void test_nexus_geometry_getInstrumentFilename() {
const std::string instrumentName = "LOKI";
FileFinderHelpers info;
InstrumentFileFinder info;
const auto path = info.getInstrumentFilename(instrumentName, "");
TS_ASSERT(!path.empty());
TS_ASSERT(
......
......@@ -7,8 +7,8 @@
#include "MantidAlgorithms/VesuvioL1ThetaResolution.h"
#include "MantidAPI/AlgorithmManager.h"
#include "MantidAPI/FileFinderHelpers.h"
#include "MantidAPI/FileProperty.h"
#include "MantidAPI/InstrumentFileFinder.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/SpectrumInfo.h"
#include "MantidAPI/TextAxis.h"
......@@ -269,7 +269,7 @@ void VesuvioL1ThetaResolution::loadInstrument() {
MatrixWorkspace_sptr tempWS =
WorkspaceFactory::Instance().create("Workspace2D", 1, 1, 1);
const std::string vesuvioIPF =
FileFinderHelpers::getInstrumentFilename("VESUVIO");
InstrumentFileFinder::getInstrumentFilename("VESUVIO");
// Load an empty VESUVIO instrument workspace
IAlgorithm_sptr loadInst =
......
......@@ -5,8 +5,8 @@
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidDataHandling/AppendGeometryToSNSNexus.h"
#include "MantidAPI/FileFinderHelpers.h"
#include "MantidAPI/FileProperty.h"
#include "MantidAPI/InstrumentFileFinder.h"
#include "MantidAPI/WorkspaceFactory.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidGeometry/Instrument.h"
......@@ -145,7 +145,7 @@ void AppendGeometryToSNSNexus::exec() {
// Now what is the instrument definition filename ?
// TODO: Modify to use /entry/instrument/instrument_xml/data after
// establishing a way to maintain ADARA Geometry Packet
m_idf_filename = FileFinderHelpers::getInstrumentFilename(m_instrument);
m_idf_filename = InstrumentFileFinder::getInstrumentFilename(m_instrument);
g_log.debug() << "Loading instrument definition from " << m_idf_filename
<< ".\n";
......
......@@ -6,8 +6,8 @@
// SPDX - License - Identifier: GPL - 3.0 +
#include <sstream>
#include "MantidAPI/FileFinderHelpers.h"
#include "MantidAPI/FileProperty.h"
#include "MantidAPI/InstrumentFileFinder.h"
#include "MantidAPI/Run.h"
#include "MantidAPI/SpectraAxis.h"
#include "MantidDataHandling/LoadDetectorsGroupingFile.h"
......@@ -105,7 +105,7 @@ void LoadDetectorsGroupingFile::exec() {
// empty -
// the most recent will be used.
const std::string instrumentFilename =
FileFinderHelpers::getInstrumentFilename(instrumentName, date);
InstrumentFileFinder::getInstrumentFilename(instrumentName, date);
// Load an instrument
Algorithm_sptr childAlg = this->createChildAlgorithm("LoadInstrument");
......
......@@ -5,9 +5,9 @@
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidDataHandling/LoadInstrument.h"
#include "MantidAPI/FileFinderHelpers.h"
#include "MantidAPI/FileProperty.h"
#include "MantidAPI/InstrumentDataService.h"
#include "MantidAPI/InstrumentFileFinder.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/Progress.h"
#include "MantidDataHandling/LoadGeometry.h"
......@@ -139,7 +139,7 @@ void LoadInstrument::exec() {
"must be specified to load an instrument",
filename);
} else {
filename = FileFinderHelpers::getInstrumentFilename(
filename = InstrumentFileFinder::getInstrumentFilename(
instname, ws->getWorkspaceStartDate());
setPropertyValue("Filename", filename);
}
......@@ -265,7 +265,7 @@ void LoadInstrument::runLoadParameterFile(
std::string directoryName =
filename.substr(0, dir_end + 1); // include final '/'.
std::string fullPathParamIDF =
FileFinderHelpers::getIPFPath(filename, directoryName);
InstrumentFileFinder::getParameterPath(filename, directoryName);
if (!fullPathParamIDF.empty()) {
......
......@@ -6,8 +6,8 @@
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidDataHandling/LoadNXSPE.h"
#include "MantidAPI/ExperimentInfo.h"
#include "MantidAPI/FileFinderHelpers.h"
#include "MantidAPI/FileProperty.h"
#include "MantidAPI/InstrumentFileFinder.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/RegisterFileLoader.h"
#include "MantidAPI/Run.h"
......@@ -331,7 +331,7 @@ void LoadNXSPE::exec() {
// NB. LoadParameterFile must be used on a workspace with an instrument
if (!instrument_name.empty() && instrument_name != "NXSPE") {
std::string IDF_filename =
FileFinderHelpers::getInstrumentFilename(instrument_name);
InstrumentFileFinder::getInstrumentFilename(instrument_name);
std::string instrument_parfile =
IDF_filename.substr(0, IDF_filename.find("_Definition")) +
"_Parameters.xml";
......
......@@ -8,8 +8,8 @@
#include "MantidAPI/Axis.h"
#include "MantidAPI/CommonBinsValidator.h"
#include "MantidAPI/ExperimentInfo.h"
#include "MantidAPI/FileFinderHelpers.h"
#include "MantidAPI/FileProperty.h"
#include "MantidAPI/InstrumentFileFinder.h"
#include "MantidAPI/Progress.h"
#include "MantidAPI/Run.h"
#include "MantidAPI/WorkspaceUnitValidator.h"
......@@ -212,7 +212,7 @@ getInstrumentName(const Mantid::API::MatrixWorkspace_sptr &workspace) {
std::string getIDF(const Mantid::API::MatrixWorkspace_sptr &workspace) {
auto date = workspace->getWorkspaceStartDate();
auto instrumentName = getInstrumentName(workspace);
return FileFinderHelpers::getInstrumentFilename(instrumentName, date);
return InstrumentFileFinder::getInstrumentFilename(instrumentName, date);
}
void addDetectors(H5::Group &group,
......
......@@ -13,7 +13,7 @@
#include "MantidAPI/AlgorithmManager.h"
#include "MantidAPI/AnalysisDataService.h"
#include "MantidAPI/FileFinderHelpers.h"
#include "MantidAPI/InstrumentFileFinder.h"
#include "MantidAPI/SpectrumInfo.h"
#include "MantidDataHandling/LoadMask.h"
#include "MantidDataObjects/MaskWorkspace.h"
......@@ -364,7 +364,7 @@ public:
TS_ASSERT(source);
std::string IDF_name =
API::FileFinderHelpers::getInstrumentFilename("MARI", "");
API::InstrumentFileFinder::getInstrumentFilename("MARI", "");
/*Fake export mask algorithm: */
std::string mask_contents("4 10-12 100 110 120 130 140 200 300");
......
......@@ -7,7 +7,7 @@
#include "NXcanSASTestHelper.h"
#include "MantidAPI/AlgorithmManager.h"
#include "MantidAPI/Axis.h"
#include "MantidAPI/FileFinderHelpers.h"
#include "MantidAPI/InstrumentFileFinder.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/NumericAxis.h"
#include "MantidDataHandling/NXcanSASDefinitions.h"
......@@ -35,7 +35,7 @@ getIDFfromWorkspace(const Mantid::API::MatrixWorkspace_sptr &workspace) {
auto instrument = workspace->getInstrument();
auto name = instrument->getFullName();
auto date = workspace->getWorkspaceStartDate();
return Mantid::API::FileFinderHelpers::getInstrumentFilename(name, date);
return Mantid::API::InstrumentFileFinder::getInstrumentFilename(name, date);
}
void setXValuesOn1DWorkspaceWithPointData(
......
......@@ -19,7 +19,7 @@ set(EXPORT_FILES
src/Exports/AlgorithmManager.cpp
src/Exports/AnalysisDataService.cpp
src/Exports/FileProperty.cpp
src/Exports/FileFinderHelpers.cpp
src/Exports/InstrumentFileFinder.cpp
src/Exports/MultipleFileProperty.cpp
src/Exports/FrameworkManager.cpp
src/Exports/ISpectrum.cpp
......
......@@ -5,7 +5,7 @@
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidAPI/ExperimentInfo.h"
#include "MantidAPI/FileFinderHelpers.h"
#include "MantidAPI/InstrumentFileFinder.h"
#include "MantidAPI/Run.h"
#include "MantidAPI/Sample.h"
#include "MantidAPI/SpectrumInfo.h"
......@@ -24,7 +24,7 @@
#include <boost/python/register_ptr_to_python.hpp>
using Mantid::API::ExperimentInfo;
using Mantid::API::FileFinderHelpers;
using Mantid::API::InstrumentFileFinder;
using Mantid::PythonInterface::Policies::RemoveConstSharedPtr;
using namespace Mantid::PythonInterface;
using namespace boost::python;
......@@ -34,22 +34,31 @@ GET_POINTER_SPECIALIZATION(ExperimentInfo)
/// Converter from C++ signature to python signature
// As we can't have two converters in the global namespace we will
// keep the converter with ExperimentInfo despite the C++ impl moving to
// FileFinderHelpers for backwards compatibility and as there is a single user
// InstrumentFileFinder for backwards compatibility and as there is a single
// user
list getResourceFilenames(const std::string &prefix, const list &fileFormats,
const list &directoryNames, const std::string &date) {
return Converters::ToPyList<std::string>()(
FileFinderHelpers::getResourceFilenames(
InstrumentFileFinder::getResourceFilenames(
prefix, Converters::PySequenceToVector<std::string>(fileFormats)(),
Converters::PySequenceToVector<std::string>(directoryNames)(), date));
}
std::string getInstrumentFilenameWarn(const std::string &instName,
const std::string &date = "") {
PyErr_Warn(PyExc_DeprecationWarning,
"ExperimentInfo.getInstrumentFilename() is deprecated.\n"
"Use InstrumentFileFinder.getInstrumentFilename() instead.");
return InstrumentFileFinder::getInstrumentFilename(instName, date);
}
GNU_DIAG_OFF("unused-local-typedef")
// Ignore -Wconversion warnings coming from boost::python
// Seen with GCC 7.1.1 and Boost 1.63.0
GNU_DIAG_OFF("conversion")
/// Overload generator for getInstrumentFilename
BOOST_PYTHON_FUNCTION_OVERLOADS(getInstrumentFilename_Overload,
FileFinderHelpers::getInstrumentFilename, 1, 2)
getInstrumentFilenameWarn, 1, 2)
GNU_DIAG_ON("conversion")
GNU_DIAG_ON("unused-local-typedef")
......@@ -69,7 +78,7 @@ void export_ExperimentInfo() {
.def("getInstrument", &ExperimentInfo::getInstrument,
return_value_policy<RemoveConstSharedPtr>(), args("self"),
"Returns the :class:`~mantid.geometry.Instrument` for this run.")
// FileFinderHelpers binds Kept for backwards compat.
// InstrumentFileFinder binds Kept for backwards compat.
.def("getResourceFilenames", &getResourceFilenames,
(arg("prefix"), arg("fileFormats"), arg("directoryNames"),
arg("date")),
......@@ -86,7 +95,8 @@ void export_ExperimentInfo() {
"file will encapsulate this date (e.g '1900-01-31 23:59:00')\n"
"\nreturns : list of absolute paths for each valid file\n")
.staticmethod("getResourceFilenames")
.def("getInstrumentFilename", &FileFinderHelpers::getInstrumentFilename,
.def("getInstrumentFilename",
&InstrumentFileFinder::getInstrumentFilename,
getInstrumentFilename_Overload(
"Returns IDF filename", (arg("instrument"), arg("date") = "")))
.staticmethod("getInstrumentFilename")
......
......@@ -5,7 +5,7 @@
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidAPI/FileFinderHelpers.h"
#include "MantidAPI/InstrumentFileFinder.h"
#include "MantidKernel/WarningSuppressions.h"
......@@ -22,11 +22,11 @@
#include <string>
using Mantid::API::FileFinderHelpers;
using Mantid::API::InstrumentFileFinder;
using namespace Mantid::PythonInterface;
using namespace boost::python;
GET_POINTER_SPECIALIZATION(FileFinderHelpers)
GET_POINTER_SPECIALIZATION(InstrumentFileFinder)
GNU_DIAG_OFF("unused-local-typedef")
// Ignore -Wconversion warnings coming from boost::python
......@@ -34,24 +34,26 @@ GNU_DIAG_OFF("unused-local-typedef")
GNU_DIAG_OFF("conversion")
/// Overload generator for getInstrumentFilename
BOOST_PYTHON_FUNCTION_OVERLOADS(getInstrumentFilename_Overload,
FileFinderHelpers::getInstrumentFilename, 1, 2)
BOOST_PYTHON_FUNCTION_OVERLOADS(getIPFPath_Overload,
FileFinderHelpers::getIPFPath, 1, 2)
InstrumentFileFinder::getInstrumentFilename, 1,
2)
BOOST_PYTHON_FUNCTION_OVERLOADS(getParameterPath_Overload,
InstrumentFileFinder::getParameterPath, 1, 2)
GNU_DIAG_ON("conversion")
GNU_DIAG_ON("unused-local-typedef")
void exportFileFinderHelpers() {
register_ptr_to_python<std::shared_ptr<FileFinderHelpers>>();
void exportInstrumentFileFinder() {
register_ptr_to_python<std::shared_ptr<InstrumentFileFinder>>();
class_<FileFinderHelpers>("FileFinderHelpers", no_init)
class_<InstrumentFileFinder>("InstrumentFileFinder", no_init)
// -
.def("getInstrumentFilename", &FileFinderHelpers::getInstrumentFilename,
.def("getInstrumentFilename",
&InstrumentFileFinder::getInstrumentFilename,
getInstrumentFilename_Overload(
"Returns IDF filename", (arg("instrument"), arg("date") = "")))
.staticmethod("getInstrumentFilename")
// -
.def("getIPFPath", &FileFinderHelpers::getIPFPath,
getIPFPath_Overload(
.def("getParameterPath", &InstrumentFileFinder::getParameterPath,
getParameterPath_Overload(
"Returns the full path to the given instrument parameter file "
"for the named instrument if it exists in the instrument search "
"directories, or the optional user provided path.\n"
......@@ -63,5 +65,5 @@ void exportFileFinderHelpers() {
"returns: The full path as a string if found, else an "
"empty string",
(arg("instName"), arg("directoryHint") = "")))
.staticmethod("getIPFPath");
.staticmethod("getParameterPath");
}
\ No newline at end of file
......@@ -22,7 +22,7 @@ Usage
.. include:: ../usagedata-note.txt
.. testcode:: ExLoadGSASInstrumentFileSimple
.. testcode:: ExLoadGSASInstrumentFileFinderimple
# We load a GSAS Instrument file with 2 Banks
tws = LoadGSASInstrumentFile("GSAS_2bank.prm")
......@@ -34,7 +34,7 @@ Usage
Output:
.. testoutput:: ExLoadGSASInstrumentFileSimple
.. testoutput:: ExLoadGSASInstrumentFileFinderimple
{'Name': 'BANK','Value_1': 1.00, 'Value_2': 2.00}
{'Name': 'Alph0','Value_1': 0.00, 'Value_2': 0.00}
......
......@@ -35,7 +35,7 @@ Proof of concept background removal algorithm::
import os
maps_dir = '/home/user/InstrumentFiles/let/'
maps_dir = '/home/user/InstrumentFileFinder/let/'
data_dir ='/home/user/results'
ref_data_dir = '/home/user/SystemTests/AnalysisTests/ReferenceResults'
config.setDataSearchDirs('{0};{1};{2}'.format(data_dir,maps_dir,ref_data_dir))
......@@ -130,7 +130,7 @@ are identical::
import os
maps_dir = '/home/user/InstrumentFiles/let/'
maps_dir = '/home/user/InstrumentFileFinder/let/'
data_dir ='/home/user/results'
ref_data_dir = '/home/user/SystemTests/AnalysisTests/ReferenceResults'
config.setDataSearchDirs('{0};{1};{2}'.format(data_dir,maps_dir,ref_data_dir))
......
......@@ -85,10 +85,10 @@ Python
- Documentation for manipulating :ref:`workspaces <02_scripting_workspaces>` and :ref:`plots <02_scripting_plots>` within a script have been produced.
- Property.units now attempts to encode with windows-1252 if utf-8 fails.
- Property.unitsAsBytes has been added to retrieve the raw bytes from the units string.
- Various file finding methods have been moved to ``mantid.api.FileFinderHelpers``. For compatibility
- Various file finding methods have been moved to ``mantid.api.InstrumentFileFinder``. For compatibility
these still exist in ``ExperimentInfo`` but the helpers should be used instead in the future.
- A new method for finding IPF files has been added to the ``FileFinderHelpers``
``getIPFPath``, which will accept an instrument name and return the full path to the associated