diff --git a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadParameterFile.h b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadParameterFile.h index 83147785439b..1a0bad10c7f7 100644 --- a/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadParameterFile.h +++ b/Code/Mantid/Framework/DataHandling/inc/MantidDataHandling/LoadParameterFile.h @@ -84,7 +84,7 @@ namespace Mantid /// Algorithm's category for identification overriding a virtual method virtual const std::string category() const { return "DataHandling\\Instrument";} - static void execManually(std::string filename, Mantid::API::ExperimentInfo_sptr localWorkspace); + static void execManually(bool useString, std::string filename, std::string parameterString, Mantid::API::ExperimentInfo_sptr localWorkspace); private: /// Sets documentation strings for this algorithm diff --git a/Code/Mantid/Framework/DataHandling/src/LoadIDFFromNexus.cpp b/Code/Mantid/Framework/DataHandling/src/LoadIDFFromNexus.cpp index 9e81ce5b3132..63188bc98028 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadIDFFromNexus.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadIDFFromNexus.cpp @@ -90,7 +90,7 @@ void LoadIDFFromNexus::runLoadParameterFile(const MatrixWorkspace_sptr & workspa const std::string paramFile = directory + instrumentName + "_Parameters.xml"; try { - LoadParameterFile::execManually(paramFile, workspace); + LoadParameterFile::execManually(false, paramFile,"", workspace); } catch ( std::runtime_error& ) { g_log.notice() << "File " << paramFile << " not found or un-parsable. " "However, the instrument has been loaded successfully.\n"; diff --git a/Code/Mantid/Framework/DataHandling/src/LoadInstrument.cpp b/Code/Mantid/Framework/DataHandling/src/LoadInstrument.cpp index f79f227b0f30..4aec499f0b65 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadInstrument.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadInstrument.cpp @@ -237,7 +237,7 @@ namespace Mantid try { // To allow the use of ExperimentInfo instead of workspace, we call it manually - LoadParameterFile::execManually(fullPathParamIDF, m_workspace); + LoadParameterFile::execManually(false, fullPathParamIDF, "", m_workspace); g_log.debug("Parameters loaded successfully."); } catch (std::invalid_argument& e) { diff --git a/Code/Mantid/Framework/DataHandling/src/LoadParameterFile.cpp b/Code/Mantid/Framework/DataHandling/src/LoadParameterFile.cpp index fa30cca9b7b5..6ec3424405a2 100644 --- a/Code/Mantid/Framework/DataHandling/src/LoadParameterFile.cpp +++ b/Code/Mantid/Framework/DataHandling/src/LoadParameterFile.cpp @@ -59,8 +59,8 @@ DECLARE_ALGORITHM(LoadParameterFile) /// Sets documentation strings for this algorithm void LoadParameterFile::initDocs() { - this->setWikiSummary("Loads instrument parameters into a [[workspace]]. where these parameters are associated component names as defined in Instrument Definition File ([[InstrumentDefinitionFile|IDF]])."); - this->setOptionalMessage("Loads instrument parameters into a workspace. where these parameters are associated component names as defined in Instrument Definition File (IDF)."); + this->setWikiSummary("Loads instrument parameters into a [[workspace]]. where these parameters are associated component names as defined in Instrument Definition File ([[InstrumentDefinitionFile|IDF]]) or a string consisting of the contents of such.."); + this->setOptionalMessage("Loads instrument parameters into a workspace. where these parameters are associated component names as defined in Instrument Definition File (IDF) or a string consisting of the contents of such."); } @@ -80,8 +80,9 @@ void LoadParameterFile::init() declareProperty( new WorkspaceProperty("Workspace","Anonymous",Direction::InOut), "The name of the workspace to load the instrument parameters into." ); - declareProperty(new FileProperty("Filename","", FileProperty::Load, ".xml"), - "The filename (including its full or relative path) of a parameter defintion file. The file extension must either be .xml or .XML."); + declareProperty(new FileProperty("Filename","", FileProperty::OptionalLoad, ".xml"), + "The filename (including its full or relative path) of a parameter definition file. The file extension must either be .xml or .XML."); + declareProperty("ParameterXML","","The parameter definition XML as a string."); } /** Executes the algorithm. Reading in the file and creating and populating @@ -95,13 +96,16 @@ void LoadParameterFile::exec() // Retrieve the filename from the properties std::string filename = getPropertyValue("Filename"); + // Retrieve the parameter XML string from the properties + std::string parameterXML = getPropertyValue("ParameterXML"); + // Get the input workspace const MatrixWorkspace_sptr localWorkspace = getProperty("Workspace"); - execManually(filename, localWorkspace); + execManually(false, filename, parameterXML, localWorkspace); } -void LoadParameterFile::execManually(std::string filename, Mantid::API::ExperimentInfo_sptr localWorkspace) +void LoadParameterFile::execManually(bool useString, std::string filename, std::string parameterXML, Mantid::API::ExperimentInfo_sptr localWorkspace) { // TODO: Refactor to remove the need for the const cast Instrument_sptr instrument = boost::const_pointer_cast(localWorkspace->getInstrument()->baseInstrument());