diff --git a/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp b/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp index fa20bda6ac1e54928a64e78ca25c5db771a9fc2f..53ba5c73d9e18feef05810528f0856425895e13f 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOneAuto2.cpp @@ -267,14 +267,16 @@ void ReflectometryReductionOneAuto2::exec() { if (!params.empty()) { if (params.size() == 3) { setProperty("MomentumTransferMin", params[0]); - setProperty("MomentumTransferStep", params[1]); + setProperty("MomentumTransferStep", -params[1]); setProperty("MomentumTransferMax", params[2]); } else { setProperty("MomentumTransferMin", IvsQ->x(0).front()); setProperty("MomentumTransferMax", IvsQ->x(0).back()); - setProperty("MomentumTransferStep", params[0]); + setProperty("MomentumTransferStep", -params[0]); } } + if (getPointerToProperty("ScaleFactor")->isDefault()) + setProperty("ScaleFactor", 1.0); } /** Returns the detectors of interest, specified via processing instructions diff --git a/MantidQt/CustomInterfaces/src/Reflectometry/ReflGenericDataProcessorPresenterFactory.cpp b/MantidQt/CustomInterfaces/src/Reflectometry/ReflGenericDataProcessorPresenterFactory.cpp index 6e2ae82df3626b365653da3d4c3d66322ac275dc..d881059dff066883319d48b525c87516c1ad5f4f 100644 --- a/MantidQt/CustomInterfaces/src/Reflectometry/ReflGenericDataProcessorPresenterFactory.cpp +++ b/MantidQt/CustomInterfaces/src/Reflectometry/ReflGenericDataProcessorPresenterFactory.cpp @@ -42,14 +42,14 @@ ReflGenericDataProcessorPresenterFactory::create() { "/><i>optional</i><br />To specify two transmission runs, separate " "them with a '+'. If left blank, the sample runs will be normalised " "by monitor only.<br /><br /><b>Example:</b> <samp>1234+12345</samp>"); - whitelist.addElement("Q min", "MomentumTransferMinimum", + whitelist.addElement("Q min", "MomentumTransferMin", "<b>Minimum value of Q to be used</b><br " "/><i>optional</i><br />Unit: Å<sup>-1</sup><br " "/>Data with a value of Q lower than this will be " "discarded. If left blank, this is set to the lowest " "Q value found. This is useful for discarding noisy " "data. <br /><br /><b>Example:</b> <samp>0.1</samp>"); - whitelist.addElement("Q max", "MomentumTransferMaximum", + whitelist.addElement("Q max", "MomentumTransferMax", "<b>Maximum value of Q to be used</b><br " "/><i>optional</i><br />Unit: Å<sup>-1</sup><br " "/>Data with a value of Q higher than this will be " @@ -72,14 +72,14 @@ ReflGenericDataProcessorPresenterFactory::create() { /*The name of the algorithm */ "ReflectometryReductionOneAuto", /*Prefixes to the output workspaces*/ - std::vector<std::string>{"IvsQ_", "IvsLam_"}, + std::vector<std::string>{"IvsQ_", "IvsQ_binned_", "IvsLam_"}, /*The blacklist*/ - std::set<std::string>{ - "ThetaIn", "ThetaOut", "InputWorkspace", "OutputWorkspace", - "OutputWorkspaceWavelength", "FirstTransmissionRun", - "SecondTransmissionRun", "MomentumTransferMinimum", - "MomentumTransferMaximum", "MomentumTransferStep", "ScaleFactor"}, - 1); + std::set<std::string>{"ThetaIn", "ThetaOut", "InputWorkspace", + "OutputWorkspace", "OutputWorkspaceBinned", + "OutputWorkspaceWavelength", "FirstTransmissionRun", + "SecondTransmissionRun", "MomentumTransferMin", + "MomentumTransferMax", "MomentumTransferStep", + "ScaleFactor"}); // Pre-processing instructions as a map: // Keys are the column names @@ -96,8 +96,7 @@ ReflGenericDataProcessorPresenterFactory::create() { DataProcessorPreprocessingAlgorithm( "CreateTransmissionWorkspaceAuto", "TRANS_", std::set<std::string>{"FirstTransmissionRun", - "SecondTransmissionRun", "OutputWorkspace"}, - 1)}}; + "SecondTransmissionRun", "OutputWorkspace"})}}; // The post-processing algorithm DataProcessorPostprocessingAlgorithm postprocessor( diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorGenerateNotebook.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorGenerateNotebook.h index c3e3195817e62cf1ee0eb4f0709f654d830ee35b..665ef7da0de276a7afd2cd336429dbce35a7e1ef 100644 --- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorGenerateNotebook.h +++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorGenerateNotebook.h @@ -97,7 +97,6 @@ loadRunString(const std::string &run, const std::string &instrument, const std::string &prefix); std::string DLLExport completeOutputProperties(const std::string &algName, - int algVersion, size_t currentProperties); class DLLExport DataProcessorGenerateNotebook { diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorPostprocessingAlgorithm.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorPostprocessingAlgorithm.h index 5f45224bd0b05a448a3a037f54009b94d40e62e5..8cca5cac0ebaf316947e07c57d8e14275a14cd6f 100644 --- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorPostprocessingAlgorithm.h +++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorPostprocessingAlgorithm.h @@ -38,8 +38,7 @@ public: // Constructor DataProcessorPostprocessingAlgorithm( const std::string &name, const std::string &prefix = "", - const std::set<std::string> &blacklist = std::set<std::string>(), - int version = -1); + const std::set<std::string> &blacklist = std::set<std::string>()); // Default constructor DataProcessorPostprocessingAlgorithm(); // Destructor diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorPreprocessingAlgorithm.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorPreprocessingAlgorithm.h index 24b60b17fd4f76c9a328fb532f6ad642c3363f94..afd79817ccb9052700968c6033abb3c8616ecafd 100644 --- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorPreprocessingAlgorithm.h +++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorPreprocessingAlgorithm.h @@ -39,8 +39,7 @@ public: // Constructor DataProcessorPreprocessingAlgorithm( const std::string &name, const std::string &prefix = "", - const std::set<std::string> &blacklist = std::set<std::string>(), - int version = -1); + const std::set<std::string> &blacklist = std::set<std::string>()); // Default constructor DataProcessorPreprocessingAlgorithm(); // Destructor diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorProcessingAlgorithm.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorProcessingAlgorithm.h index 36f5cd20915097d3d84c6a8595779eab58250d66..ec48c8e82d8049a9f9fbc362397916cbeab4e22e 100644 --- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorProcessingAlgorithm.h +++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorProcessingAlgorithm.h @@ -40,8 +40,7 @@ public: // Constructor DataProcessorProcessingAlgorithm( const std::string &name, const std::vector<std::string> &prefix, - const std::set<std::string> &blacklist = std::set<std::string>(), - int version = -1); + const std::set<std::string> &blacklist = std::set<std::string>()); // Destructor virtual ~DataProcessorProcessingAlgorithm(); // The number of output properties diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorProcessingAlgorithmBase.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorProcessingAlgorithmBase.h index 0c8509ecb6b06c427362353a96d38aa3bef5e77c..f31adc65073f36234893e9a395f55d46679c5a4f 100644 --- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorProcessingAlgorithmBase.h +++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorProcessingAlgorithmBase.h @@ -45,8 +45,7 @@ public: // Constructor DataProcessorProcessingAlgorithmBase( const std::string &name, - const std::set<std::string> &blacklist = std::set<std::string>(), - int version = -1); + const std::set<std::string> &blacklist = std::set<std::string>()); // Destructor ~DataProcessorProcessingAlgorithmBase(); @@ -63,9 +62,6 @@ public: // Returns the name of this algorithm virtual std::string name() const final { return m_algName; }; - // Returns the version of this algorithm - virtual int version() const final { return m_algVersion; }; - // Returns the blacklist virtual std::set<std::string> blacklist() const final { return m_blacklist; }; @@ -75,8 +71,6 @@ private: // The name of this algorithm std::string m_algName; - // The version of this algorithm - int m_algVersion; // The blacklist std::set<std::string> m_blacklist; // Input ws properties diff --git a/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorGenerateNotebook.cpp b/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorGenerateNotebook.cpp index a6dc3d7509a68a0cbce6bc54fba9f18365be2160..3a37327cd554a1f16815fef4f47f14c9a61e1f9d 100644 --- a/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorGenerateNotebook.cpp +++ b/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorGenerateNotebook.cpp @@ -182,9 +182,9 @@ std::string plotsString(const std::vector<std::string> &output_ws, // 13462, 0 // 13463, 0 // output_ws will be: - // output_ws [0] = 'IvsQ_TOF_13460, IvsLam_TOF_13460' - // output_ws [1] = 'IvsQ_TOF_13462, IvsLam_TOF_13462' - // output_ws [3] = 'IvsQ_TOF_13463, IvsLam_TOF_13463' + // output_ws [0] = 'IvsQ_binned_TOF_13460, IvsQ_TOF_13460, IvsLam_TOF_13460' + // output_ws [1] = 'IvsQ_binned_TOF_13462, IvsQ_TOF_13462, IvsLam_TOF_13462' + // output_ws [3] = 'IvsQ_binned_TOF_13463, IvsQ_TOF_13463, IvsLam_TOF_13463' // As the reduction algorithm, ReflectometryReductionOneAuto, produces two // output workspaces // We need to group the 'IvsQ_' workspaces and the 'IvsLam_' workspaces @@ -327,7 +327,7 @@ boost::tuple<std::string, std::string> postprocessGroupString( postprocessor.prefix() + boost::algorithm::join(outputName, "_"); stitch_string << outputWSName; stitch_string << completeOutputProperties( - postprocessor.name(), postprocessor.version(), + postprocessor.name(), postprocessor.numberOfOutputProperties()) << " = "; stitch_string << postprocessor.name() << "("; stitch_string << postprocessor.inputProperty() << " = '"; @@ -518,8 +518,7 @@ boost::tuple<std::string, std::string> reduceRowString( std::ostringstream process_string; process_string << outputPropertiesStr; process_string << completeOutputProperties( - processor.name(), processor.version(), - processor.numberOfOutputProperties()); + processor.name(), processor.numberOfOutputProperties()); process_string << " = " << processor.name() << "("; process_string << boost::algorithm::join(algProperties, ", "); process_string << ")"; @@ -631,11 +630,10 @@ loadRunString(const std::string &run, const std::string &instrument, /** Given an algorithm's name, completes the list of output properties * @param algName : The name of the algorithm -* @param algVersion : The version of the algorithm * @param currentProperties : The number of output properties that are workspaces * @return : The list of output properties as a string */ -std::string completeOutputProperties(const std::string &algName, int algVersion, +std::string completeOutputProperties(const std::string &algName, size_t currentProperties) { // In addition to output ws properties, our reduction and post-processing @@ -644,7 +642,7 @@ std::string completeOutputProperties(const std::string &algName, int algVersion, // We need to specify those too in our python code Mantid::API::IAlgorithm_sptr alg = - Mantid::API::AlgorithmManager::Instance().create(algName, algVersion); + Mantid::API::AlgorithmManager::Instance().create(algName); auto properties = alg->getProperties(); int totalOutputProp = 0; for (auto &prop : properties) { diff --git a/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorPostprocessingAlgorithm.cpp b/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorPostprocessingAlgorithm.cpp index 1d4bb0a485ed4952d540e813a3c3a56c6c1f36e8..f010175e42f46ed5849c6d50251f7bf9c53994bc 100644 --- a/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorPostprocessingAlgorithm.cpp +++ b/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorPostprocessingAlgorithm.cpp @@ -7,13 +7,11 @@ namespace MantidWidgets { * @param name : The name of the post-processing algorithm * @param prefix : The prefix that will be added to the output workspace name * @param blacklist : The list of properties we don't want to show -& @param version : The version of the post-processing algorithm */ DataProcessorPostprocessingAlgorithm::DataProcessorPostprocessingAlgorithm( const std::string &name, const std::string &prefix, - const std::set<std::string> &blacklist, int version) - : DataProcessorProcessingAlgorithmBase(name, blacklist, version), - m_prefix(prefix) { + const std::set<std::string> &blacklist) + : DataProcessorProcessingAlgorithmBase(name, blacklist), m_prefix(prefix) { auto inputStrListProperties = getInputStrListProperties(); if (inputStrListProperties.size() != 1) diff --git a/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorPreprocessingAlgorithm.cpp b/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorPreprocessingAlgorithm.cpp index fe50c78c44b8c29f7d508036a67ba10436d4db24..da0f974773574df5a9aa51676084bf0ac443afb2 100644 --- a/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorPreprocessingAlgorithm.cpp +++ b/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorPreprocessingAlgorithm.cpp @@ -7,14 +7,12 @@ namespace MantidWidgets { * @param name : The name of the pre-processing algorithm * @param prefix : A prefix that will added to the output workspace name * @param blacklist : The list of properties we don't want to show - * @param version : The version of the pre-processing algorithm * algorithm in the processed workspace's name */ DataProcessorPreprocessingAlgorithm::DataProcessorPreprocessingAlgorithm( const std::string &name, const std::string &prefix, - const std::set<std::string> &blacklist, int version) - : DataProcessorProcessingAlgorithmBase(name, blacklist, version), - m_prefix(prefix) { + const std::set<std::string> &blacklist) + : DataProcessorProcessingAlgorithmBase(name, blacklist), m_prefix(prefix) { auto inputWsProperties = getInputWsProperties(); diff --git a/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorProcessingAlgorithm.cpp b/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorProcessingAlgorithm.cpp index f39e6154617099ff15edf2d4cf60ac5955940523..94a761c70147d18ebd698e0e131288a12743d350 100644 --- a/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorProcessingAlgorithm.cpp +++ b/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorProcessingAlgorithm.cpp @@ -8,13 +8,11 @@ namespace MantidWidgets { * @param prefix : The list of prefixes that will be used for the output * workspaces' names * @param blacklist : The list of properties we do not want to show -* @param version : The version of this algorithm */ DataProcessorProcessingAlgorithm::DataProcessorProcessingAlgorithm( const std::string &name, const std::vector<std::string> &prefix, - const std::set<std::string> &blacklist, int version) - : DataProcessorProcessingAlgorithmBase(name, blacklist, version), - m_prefix(prefix) { + const std::set<std::string> &blacklist) + : DataProcessorProcessingAlgorithmBase(name, blacklist), m_prefix(prefix) { m_inputProperties = getInputWsProperties(); if (!m_inputProperties.size()) diff --git a/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorProcessingAlgorithmBase.cpp b/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorProcessingAlgorithmBase.cpp index f553a0a64b1e806093e97fcb23a8a07bd33cb846..b2bd6c5bd2f75827ec74d4c28b7940c21bb023f8 100644 --- a/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorProcessingAlgorithmBase.cpp +++ b/MantidQt/MantidWidgets/src/DataProcessorUI/DataProcessorProcessingAlgorithmBase.cpp @@ -5,18 +5,16 @@ namespace MantidWidgets { /** Constructor */ DataProcessorProcessingAlgorithmBase::DataProcessorProcessingAlgorithmBase( - const std::string &name, const std::set<std::string> &blacklist, - int version) - : m_algName(name), m_algVersion(version), m_blacklist(blacklist), - m_inputWsProperties(), m_inputStrListProperties(), - m_OutputWsProperties() { + const std::string &name, const std::set<std::string> &blacklist) + : m_algName(name), m_blacklist(blacklist), m_inputWsProperties(), + m_inputStrListProperties(), m_OutputWsProperties() { countWsProperties(); } /** Default constructor (nothing to do) */ DataProcessorProcessingAlgorithmBase::DataProcessorProcessingAlgorithmBase() - : m_algName(), m_algVersion(-1), m_blacklist(), m_inputWsProperties(), + : m_algName(), m_blacklist(), m_inputWsProperties(), m_inputStrListProperties(), m_OutputWsProperties() {} /** Destructor */ @@ -26,7 +24,7 @@ DataProcessorProcessingAlgorithmBase::~DataProcessorProcessingAlgorithmBase() {} void DataProcessorProcessingAlgorithmBase::countWsProperties() { Mantid::API::IAlgorithm_sptr alg = - Mantid::API::AlgorithmManager::Instance().create(m_algName, m_algVersion); + Mantid::API::AlgorithmManager::Instance().create(m_algName); auto properties = alg->getProperties(); for (auto &prop : properties) { diff --git a/MantidQt/MantidWidgets/src/DataProcessorUI/GenericDataProcessorPresenter.cpp b/MantidQt/MantidWidgets/src/DataProcessorUI/GenericDataProcessorPresenter.cpp index ca3e1fee8ec99333a25493e35fa8579a1cb6f5f7..a23ca821561b9fbfc0ff82f381c815f286a639f1 100644 --- a/MantidQt/MantidWidgets/src/DataProcessorUI/GenericDataProcessorPresenter.cpp +++ b/MantidQt/MantidWidgets/src/DataProcessorUI/GenericDataProcessorPresenter.cpp @@ -48,8 +48,8 @@ namespace MantidWidgets { */ GenericDataProcessorPresenter::GenericDataProcessorPresenter( const DataProcessorWhiteList &whitelist, - const std::map<std::string, DataProcessorPreprocessingAlgorithm> & - preprocessMap, + const std::map<std::string, DataProcessorPreprocessingAlgorithm> + &preprocessMap, const DataProcessorProcessingAlgorithm &processor, const DataProcessorPostprocessingAlgorithm &postprocessor, const std::map<std::string, std::string> &postprocessMap, @@ -111,8 +111,8 @@ GenericDataProcessorPresenter::GenericDataProcessorPresenter( */ GenericDataProcessorPresenter::GenericDataProcessorPresenter( const DataProcessorWhiteList &whitelist, - const std::map<std::string, DataProcessorPreprocessingAlgorithm> & - preprocessMap, + const std::map<std::string, DataProcessorPreprocessingAlgorithm> + &preprocessMap, const DataProcessorProcessingAlgorithm &processor) : GenericDataProcessorPresenter(whitelist, preprocessMap, processor, DataProcessorPostprocessingAlgorithm()) {} @@ -179,8 +179,7 @@ void GenericDataProcessorPresenter::acceptViews( // Provide autocompletion hints for the options column. We use the algorithm's // properties minus those we blacklist. We blacklist any useless properties or // ones we're handling that the user should'nt touch. - IAlgorithm_sptr alg = AlgorithmManager::Instance().create( - m_processor.name(), m_processor.version()); + IAlgorithm_sptr alg = AlgorithmManager::Instance().create(m_processor.name()); m_view->setOptionsHintStrategy( new AlgorithmHintStrategy(alg, m_processor.blacklist()), m_columns - 1); @@ -319,8 +318,8 @@ void GenericDataProcessorPresenter::postProcessGroup( if (AnalysisDataService::Instance().doesExist(outputWSName)) AnalysisDataService::Instance().remove(outputWSName); - IAlgorithm_sptr alg = AlgorithmManager::Instance().create( - m_postprocessor.name(), m_postprocessor.version()); + IAlgorithm_sptr alg = + AlgorithmManager::Instance().create(m_postprocessor.name()); alg->initialize(); alg->setProperty(m_postprocessor.inputProperty(), inputWSNames); alg->setProperty(m_postprocessor.outputProperty(), outputWSName); @@ -395,8 +394,8 @@ Workspace_sptr GenericDataProcessorPresenter::prepareRunWorkspace( * but that doesn't preserve history nicely, so we'll just take care of tidying * up in the event of failure. */ - IAlgorithm_sptr alg = AlgorithmManager::Instance().create( - preprocessor.name(), preprocessor.version()); + IAlgorithm_sptr alg = + AlgorithmManager::Instance().create(preprocessor.name()); alg->initialize(); alg->setProperty( preprocessor.lhsProperty(), @@ -577,8 +576,7 @@ GenericDataProcessorPresenter::reduceRow(const std::vector<std::string> &data) { /* Create the processing algorithm */ - IAlgorithm_sptr alg = AlgorithmManager::Instance().create( - m_processor.name(), m_processor.version()); + IAlgorithm_sptr alg = AlgorithmManager::Instance().create(m_processor.name()); alg->initialize(); /* Read input properties from the table */ diff --git a/MantidQt/MantidWidgets/test/DataProcessorUI/DataProcessorGenerateNotebookTest.h b/MantidQt/MantidWidgets/test/DataProcessorUI/DataProcessorGenerateNotebookTest.h index 49fb221a21fe95e72cccab8452f55fdceee704f0..7b4561c00154e006c1f5d969f811466b23d4c601 100644 --- a/MantidQt/MantidWidgets/test/DataProcessorUI/DataProcessorGenerateNotebookTest.h +++ b/MantidQt/MantidWidgets/test/DataProcessorUI/DataProcessorGenerateNotebookTest.h @@ -32,8 +32,8 @@ private: DataProcessorPreprocessingAlgorithm( "CreateTransmissionWorkspaceAuto", "TRANS_", std::set<std::string>{"FirstTransmissionRun", - "SecondTransmissionRun", "OutputWorkspace"}, - 1)}}; + "SecondTransmissionRun", + "OutputWorkspace"})}}; } // Creates a reflectometry processing algorithm @@ -41,11 +41,10 @@ private: return DataProcessorProcessingAlgorithm( "ReflectometryReductionOneAuto", - std::vector<std::string>{"IvsQ_", "IvsLam_"}, + std::vector<std::string>{"IvsQ_binned_", "IvsQ_", "IvsLam_"}, std::set<std::string>{"ThetaIn", "ThetaOut", "InputWorkspace", "OutputWorkspace", "OutputWorkspaceWavelength", - "FirstTransmissionRun", "SecondTransmissionRun"}, - 1); + "FirstTransmissionRun", "SecondTransmissionRun"}); } DataProcessorPostprocessingAlgorithm reflPostprocessor() { @@ -63,8 +62,8 @@ private: whitelist.addElement("Angle", "ThetaIn", ""); whitelist.addElement("Transmission Run(s)", "FirstTransmissionRun", "", true, "TRANS_"); - whitelist.addElement("Q min", "MomentumTransferMinimum", ""); - whitelist.addElement("Q max", "MomentumTransferMaximum", ""); + whitelist.addElement("Q min", "MomentumTransferMin", ""); + whitelist.addElement("Q max", "MomentumTransferMax", ""); whitelist.addElement("dQ/Q", "MomentumTransferStep", ""); whitelist.addElement("Scale", "ScaleFactor", ""); whitelist.addElement("Options", "Options", ""); @@ -123,10 +122,17 @@ public: std::vector<std::string> notebookLines; boost::split(notebookLines, generatedNotebook, boost::is_any_of("\n")); const std::string result[] = { - "{", " \"metadata\" : {", " \"name\" : \"Mantid Notebook\"", - " },", " \"nbformat\" : 3,", " \"nbformat_minor\" : 0,", - " \"worksheets\" : [", " {", " \"cells\" : [", - " {", " \"cell_type\" : \"markdown\",", + "{", + " \"metadata\" : {", + " \"name\" : \"Mantid Notebook\"", + " },", + " \"nbformat\" : 3,", + " \"nbformat_minor\" : 0,", + " \"worksheets\" : [", + " {", + " \"cells\" : [", + " {", + " \"cell_type\" : \"markdown\",", }; // Check that the first 10 lines are output as expected @@ -219,7 +225,8 @@ public: "0 | 12345 | 0.5 | | 0.1 | 1.6 | 0.04 | 1 | ", "0 | 12346 | 1.5 | | 1.4 | 2.9 | 0.04 | 1 | ", "1 | 24681 | 0.5 | | 0.1 | 1.6 | 0.04 | 1 | ", - "1 | 24682 | 1.5 | | 1.4 | 2.9 | 0.04 | 1 | ", ""}; + "1 | 24682 | 1.5 | | 1.4 | 2.9 | 0.04 | 1 | ", + ""}; int i = 0; for (const auto &line : notebookLines) { @@ -278,7 +285,8 @@ public: // The python code that does the loading const std::string result[] = { - "RUN1 = Load(Filename = 'INST_RUN1')", "RUN1_RUN2_RUN3 = RUN1", + "RUN1 = Load(Filename = 'INST_RUN1')", + "RUN1_RUN2_RUN3 = RUN1", "RUN2 = Load(Filename = 'INST_RUN2')", "RUN1_RUN2_RUN3 = WeightedMean(InputWorkspace1 = 'RUN1_RUN2_RUN3', " "InputWorkspace2 = 'RUN2', Property1 = 1, Property2 = 2)", @@ -317,11 +325,9 @@ public: const std::string result[] = { "TOF_12346 = Load(Filename = 'INSTRUMENT12346')", - "IvsQ_TOF_12346, IvsLam_TOF_12346, _ = " - "ReflectometryReductionOneAuto(InputWorkspace = 'TOF_12346', " - "ThetaIn = " - "1.5, MomentumTransferMinimum = 1.4, MomentumTransferMaximum = " - "2.9, " + "IvsQ_binned_TOF_12346, IvsQ_TOF_12346, IvsLam_TOF_12346 = " + "ReflectometryReductionOneAuto(InputWorkspace = 'TOF_12346', ThetaIn = " + "1.5, MomentumTransferMin = 1.4, MomentumTransferMax = 2.9, " "MomentumTransferStep = 0.04, ScaleFactor = 1)", ""}; @@ -330,7 +336,7 @@ public: int i = 0; for (const auto &line : notebookLines) { - TS_ASSERT_EQUALS(line, result[i++]) + TS_ASSERT_EQUALS(line, result[i++]); } } @@ -364,18 +370,21 @@ public: userPreProcessingOptions, ""); const std::string result[] = { - "RUN_1000 = Load(Filename = 'INST1000')", "RUN_1000_1001 = RUN_1000", + "RUN_1000 = Load(Filename = 'INST1000')", + "RUN_1000_1001 = RUN_1000", "RUN_1001 = Load(Filename = 'INST1001')", "RUN_1000_1001 = Plus(LHSWorkspace = 'RUN_1000_1001', RHSWorkspace = " "'RUN_1001', Property=prop)", - "IvsQ_1000_1001_angle_0.5, IvsLam_1000_1001_angle_0.5, _ = " + "IvsQ_binned_1000_1001_angle_0.5, IvsQ_1000_1001_angle_0.5, " + "IvsLam_1000_1001_angle_0.5 = " "ReflectometryReductionOneAuto(InputWorkspace = 'RUN_1000_1001', " "ThetaIn = 0.5)", ""}; // Check the names of the reduced workspaces - TS_ASSERT_EQUALS(boost::get<1>(output), - "IvsQ_1000_1001_angle_0.5, IvsLam_1000_1001_angle_0.5"); + TS_ASSERT_EQUALS(boost::get<1>(output), "IvsQ_binned_1000_1001_angle_0.5, " + "IvsQ_1000_1001_angle_0.5, " + "IvsLam_1000_1001_angle_0.5"); // Check the python code std::vector<std::string> notebookLines; @@ -401,13 +410,9 @@ public: reflProcessor(), emptyPreProcessingOptions, ""); const std::string result[] = { - "IvsQ_TOF_12346, IvsLam_TOF_12346, _ = " - "ReflectometryReductionOneAuto(InputWorkspace = " - "12346, " - "ThetaIn = " - "1.5, MomentumTransferMinimum = 1.4, " - "MomentumTransferMaximum = " - "2.9, " + "IvsQ_binned_TOF_12346, IvsQ_TOF_12346, IvsLam_TOF_12346 = " + "ReflectometryReductionOneAuto(InputWorkspace = 12346, ThetaIn = 1.5, " + "MomentumTransferMin = 1.4, MomentumTransferMax = 2.9, " "MomentumTransferStep = 0.04, ScaleFactor = 1)", ""}; @@ -516,10 +521,9 @@ public: "#Post-process workspaces", "IvsQ_TOF_12345_TOF_12346, _ = " "Stitch1DMany(InputWorkspaces = " - "'IvsQ_TOF_12345, IvsQ_TOF_12346', Params = " - "'0.1, -0.04, 2.9', StartOverlaps = '1.4, " - "0.1, " - "1.4', EndOverlaps = '1.6, 2.9, 1.6')", + "'IvsQ_binned_TOF_12345, IvsQ_binned_TOF_12346', Params = " + "'0.1, -0.04, 2.9', StartOverlaps = '1.4, 0.1, 1.4', EndOverlaps = " + "'1.6, 2.9, 1.6')", ""}; std::vector<std::string> notebookLines; @@ -541,10 +545,9 @@ public: result = {"#Post-process workspaces", "IvsQ_TOF_24681_TOF_24682, _ = " "Stitch1DMany(InputWorkspaces = " - "'IvsQ_TOF_24681, IvsQ_TOF_24682', Params = " - "'0.1, -0.04, 2.9', StartOverlaps = '1.4, " - "0.1, " - "1.4', EndOverlaps = '1.6, 2.9, 1.6')", + "'IvsQ_binned_TOF_24681, IvsQ_binned_TOF_24682', Params = '0.1, " + "-0.04, 2.9', StartOverlaps = '1.4, 0.1, 1.4', EndOverlaps = " + "'1.6, 2.9, 1.6')", ""}; boost::split(notebookLines, boost::get<0>(output), boost::is_any_of("\n")); @@ -572,8 +575,8 @@ public: void testPlotsString() { std::vector<std::string> unprocessed_ws; - unprocessed_ws.emplace_back("TEST_WS1_1, TEST_WS1_2"); - unprocessed_ws.emplace_back("TEST_WS2_1, TEST_WS2_2"); + unprocessed_ws.emplace_back("IvsQ_binned_1, IvsQ_1, IvsLam_1"); + unprocessed_ws.emplace_back("IvsQ_binned_2, IvsQ_2, IvsLam_2"); std::vector<std::string> postprocessed_ws; postprocessed_ws.emplace_back("TEST_WS3"); @@ -585,19 +588,20 @@ public: const std::string result[] = { "#Group workspaces to be plotted on same axes", - "IvsQ_groupWS = GroupWorkspaces(InputWorkspaces = 'TEST_WS1_1, " - "TEST_WS2_1')", - "IvsLam_groupWS = GroupWorkspaces(InputWorkspaces = 'TEST_WS1_2, " - "TEST_WS2_2')", - "#Plot workspaces", "fig = plots([IvsQ_groupWS, IvsLam_groupWS, " - "TEST_WS3_TEST_WS4], title=['IvsQ_groupWS', " - "'IvsLam_groupWS', 'TEST_WS3_TEST_WS4'], " - "legendLocation=[1, 1, 4])", + "IvsQ_binned_groupWS = GroupWorkspaces(InputWorkspaces = " + "'IvsQ_binned_1, IvsQ_binned_2')", + "IvsQ_groupWS = GroupWorkspaces(InputWorkspaces = 'IvsQ_1, IvsQ_2')", + "IvsLam_groupWS = GroupWorkspaces(InputWorkspaces = 'IvsLam_1, " + "IvsLam_2')", + "#Plot workspaces", + "fig = plots([IvsQ_binned_groupWS, IvsQ_groupWS, IvsLam_groupWS, " + "TEST_WS3_TEST_WS4], title=['IvsQ_binned_groupWS', 'IvsQ_groupWS', " + "'IvsLam_groupWS', 'TEST_WS3_TEST_WS4'], legendLocation=[1, 1, 4])", ""}; std::vector<std::string> notebookLines; boost::split(notebookLines, output, boost::is_any_of("\n")); - + std::cout << "\n"; int i = 0; for (const auto &line : notebookLines) { TS_ASSERT_EQUALS(line, result[i++]) @@ -607,8 +611,8 @@ public: void testPlotsStringNoPostprocessing() { // Reduced workspaces std::vector<std::string> unprocessed_ws; - unprocessed_ws.emplace_back("TEST_WS1_1, TEST_WS1_2"); - unprocessed_ws.emplace_back("TEST_WS2_1, TEST_WS2_2"); + unprocessed_ws.emplace_back("IvsQ_binned_1, IvsQ_1, IvsLam_1"); + unprocessed_ws.emplace_back("IvsQ_binned_2, IvsQ_2, IvsLam_2"); // Post-processed ws (empty) std::string postprocessed_ws; @@ -617,13 +621,15 @@ public: const std::string result[] = { "#Group workspaces to be plotted on same axes", - "IvsQ_groupWS = GroupWorkspaces(InputWorkspaces = 'TEST_WS1_1, " - "TEST_WS2_1')", - "IvsLam_groupWS = GroupWorkspaces(InputWorkspaces = 'TEST_WS1_2, " - "TEST_WS2_2')", - "#Plot workspaces", "fig = plots([IvsQ_groupWS, IvsLam_groupWS, ], " - "title=['IvsQ_groupWS', 'IvsLam_groupWS', ''], " - "legendLocation=[1, 1, 4])", + "IvsQ_binned_groupWS = GroupWorkspaces(InputWorkspaces = " + "'IvsQ_binned_1, IvsQ_binned_2')", + "IvsQ_groupWS = GroupWorkspaces(InputWorkspaces = 'IvsQ_1, IvsQ_2')", + "IvsLam_groupWS = GroupWorkspaces(InputWorkspaces = 'IvsLam_1, " + "IvsLam_2')", + "#Plot workspaces", + "fig = plots([IvsQ_binned_groupWS, IvsQ_groupWS, IvsLam_groupWS, ], " + "title=['IvsQ_binned_groupWS', 'IvsQ_groupWS', 'IvsLam_groupWS', ''], " + "legendLocation=[1, 1, 4])", ""}; std::vector<std::string> notebookLines; @@ -692,76 +698,75 @@ public: boost::split(notebookLines, generatedNotebook, boost::is_any_of("\n")); const std::string loadAndReduceStringFirstGroup = - " \"input\" : \"#Load and reduce\\n12345 = " - "Load(Filename = \'INTER12345\')\\nIvsQ_TOF_12345, " - "IvsLam_TOF_12345, _ = " - "ReflectometryReductionOneAuto(InputWorkspace = \'12345\', " - "ThetaIn = 0.5, MomentumTransferMinimum = 0.1, " - "MomentumTransferMaximum = 1.6, MomentumTransferStep = " - "0.04, ScaleFactor = 1, AnalysisMode = " - "MultiDetectorAnalysis)\\n#Load and reduce\\n12346 = " - "Load(Filename = \'INTER12346\')\\nIvsQ_TOF_12346, " - "IvsLam_TOF_12346, _ = " - "ReflectometryReductionOneAuto(InputWorkspace = \'12346\', " - "ThetaIn = 1.5, MomentumTransferMinimum = 1.4, " - "MomentumTransferMaximum = 2.9, MomentumTransferStep = " - "0.04, ScaleFactor = 1, AnalysisMode = " + " \"input\" : \"#Load and reduce\\n12345 = Load(Filename " + "= \'INTER12345\')\\nIvsQ_binned_TOF_12345, IvsQ_TOF_12345, " + "IvsLam_TOF_12345 = ReflectometryReductionOneAuto(InputWorkspace = " + "\'12345\', ThetaIn = 0.5, MomentumTransferMin = 0.1, " + "MomentumTransferMax = 1.6, MomentumTransferStep = 0.04, ScaleFactor = " + "1, AnalysisMode = MultiDetectorAnalysis)\\n#Load and reduce\\n12346 = " + "Load(Filename = \'INTER12346\')\\nIvsQ_binned_TOF_12346, " + "IvsQ_TOF_12346, IvsLam_TOF_12346 = " + "ReflectometryReductionOneAuto(InputWorkspace = \'12346\', ThetaIn = " + "1.5, MomentumTransferMin = 1.4, MomentumTransferMax = 2.9, " + "MomentumTransferStep = 0.04, ScaleFactor = 1, AnalysisMode = " "MultiDetectorAnalysis)\\n\","; TS_ASSERT_EQUALS(notebookLines[48], loadAndReduceStringFirstGroup); const std::string postProcessStringFirstGroup = " \"input\" : \"#Post-process " "workspaces\\nIvsQ_TOF_12345_TOF_12346, _ = " - "Stitch1DMany(InputWorkspaces = \'IvsQ_TOF_12345, IvsQ_TOF_12346\', " + "Stitch1DMany(InputWorkspaces = \'IvsQ_binned_TOF_12345, " + "IvsQ_binned_TOF_12346\', " "Params=0.04)\","; TS_ASSERT_EQUALS(notebookLines[56], postProcessStringFirstGroup); const std::string groupWorkspacesStringFirstGroup = " \"input\" : \"#Group workspaces to be plotted on same " - "axes\\nIvsQ_groupWS = GroupWorkspaces(InputWorkspaces = " - "\'IvsQ_TOF_12345, IvsQ_TOF_12346\')\\nIvsLam_groupWS = " - "GroupWorkspaces(InputWorkspaces = \'IvsLam_TOF_12345, " - "IvsLam_TOF_12346\')\\n#Plot workspaces\\nfig = plots([IvsQ_groupWS, " - "IvsLam_groupWS, IvsQ_TOF_12345_TOF_12346], title=[\'IvsQ_groupWS\', " - "\'IvsLam_groupWS\', \'IvsQ_TOF_12345_TOF_12346\'], legendLocation=" - "[1, 1, 4])\\n\","; + "axes\\nIvsQ_binned_groupWS = GroupWorkspaces(InputWorkspaces = " + "\'IvsQ_binned_TOF_12345, IvsQ_binned_TOF_12346\')\\nIvsQ_groupWS = " + "GroupWorkspaces(InputWorkspaces = \'IvsQ_TOF_12345, " + "IvsQ_TOF_12346\')\\nIvsLam_groupWS = GroupWorkspaces(InputWorkspaces " + "= \'IvsLam_TOF_12345, IvsLam_TOF_12346\')\\n#Plot workspaces\\nfig = " + "plots([IvsQ_binned_groupWS, IvsQ_groupWS, IvsLam_groupWS, " + "IvsQ_TOF_12345_TOF_12346], title=[\'IvsQ_binned_groupWS\', " + "\'IvsQ_groupWS\', \'IvsLam_groupWS\', \'IvsQ_TOF_12345_TOF_12346\'], " + "legendLocation=[1, 1, 4])\\n\","; ; TS_ASSERT_EQUALS(notebookLines[64], groupWorkspacesStringFirstGroup); const std::string loadAndReduceStringSecondGroup = - " \"input\" : \"#Load and reduce\\n24681 = " - "Load(Filename = \'INTER24681\')\\nIvsQ_TOF_24681, " - "IvsLam_TOF_24681, _ = " - "ReflectometryReductionOneAuto(InputWorkspace = \'24681\', " - "ThetaIn = 0.5, MomentumTransferMinimum = 0.1, " - "MomentumTransferMaximum = 1.6, MomentumTransferStep = " - "0.04, ScaleFactor = 1, AnalysisMode = " - "MultiDetectorAnalysis)\\n#Load and reduce\\n24682 = " - "Load(Filename = \'INTER24682\')\\nIvsQ_TOF_24682, " - "IvsLam_TOF_24682, _ = " - "ReflectometryReductionOneAuto(InputWorkspace = \'24682\', " - "ThetaIn = 1.5, MomentumTransferMinimum = 1.4, " - "MomentumTransferMaximum = 2.9, MomentumTransferStep = " - "0.04, ScaleFactor = 1, AnalysisMode = " + " \"input\" : \"#Load and reduce\\n24681 = Load(Filename " + "= \'INTER24681\')\\nIvsQ_binned_TOF_24681, IvsQ_TOF_24681, " + "IvsLam_TOF_24681 = ReflectometryReductionOneAuto(InputWorkspace = " + "\'24681\', ThetaIn = 0.5, MomentumTransferMin = 0.1, " + "MomentumTransferMax = 1.6, MomentumTransferStep = 0.04, ScaleFactor = " + "1, AnalysisMode = MultiDetectorAnalysis)\\n#Load and reduce\\n24682 = " + "Load(Filename = \'INTER24682\')\\nIvsQ_binned_TOF_24682, " + "IvsQ_TOF_24682, IvsLam_TOF_24682 = " + "ReflectometryReductionOneAuto(InputWorkspace = \'24682\', ThetaIn = " + "1.5, MomentumTransferMin = 1.4, MomentumTransferMax = 2.9, " + "MomentumTransferStep = 0.04, ScaleFactor = 1, AnalysisMode = " "MultiDetectorAnalysis)\\n\","; TS_ASSERT_EQUALS(notebookLines[77], loadAndReduceStringSecondGroup); const std::string postProcessStringSecondGroup = " \"input\" : \"#Post-process " "workspaces\\nIvsQ_TOF_24681_TOF_24682, _ = " - "Stitch1DMany(InputWorkspaces = \'IvsQ_TOF_24681, IvsQ_TOF_24682\', " - "Params=0.04)\","; + "Stitch1DMany(InputWorkspaces = \'IvsQ_binned_TOF_24681, " + "IvsQ_binned_TOF_24682\', Params=0.04)\","; TS_ASSERT_EQUALS(notebookLines[85], postProcessStringSecondGroup); const std::string groupWorkspacesStringSecondGroup = " \"input\" : \"#Group workspaces to be plotted on same " - "axes\\nIvsQ_groupWS = GroupWorkspaces(InputWorkspaces = " - "\'IvsQ_TOF_24681, IvsQ_TOF_24682\')\\nIvsLam_groupWS = " - "GroupWorkspaces(InputWorkspaces = \'IvsLam_TOF_24681, " - "IvsLam_TOF_24682\')\\n#Plot workspaces\\nfig = plots([IvsQ_groupWS, " - "IvsLam_groupWS, IvsQ_TOF_24681_TOF_24682], title=[\'IvsQ_groupWS\', " - "\'IvsLam_groupWS\', \'IvsQ_TOF_24681_TOF_24682\'], legendLocation=" - "[1, 1, 4])\\n\","; + "axes\\nIvsQ_binned_groupWS = GroupWorkspaces(InputWorkspaces = " + "\'IvsQ_binned_TOF_24681, IvsQ_binned_TOF_24682\')\\nIvsQ_groupWS = " + "GroupWorkspaces(InputWorkspaces = \'IvsQ_TOF_24681, " + "IvsQ_TOF_24682\')\\nIvsLam_groupWS = GroupWorkspaces(InputWorkspaces " + "= \'IvsLam_TOF_24681, IvsLam_TOF_24682\')\\n#Plot workspaces\\nfig = " + "plots([IvsQ_binned_groupWS, IvsQ_groupWS, IvsLam_groupWS, " + "IvsQ_TOF_24681_TOF_24682], title=[\'IvsQ_binned_groupWS\', " + "\'IvsQ_groupWS\', \'IvsLam_groupWS\', \'IvsQ_TOF_24681_TOF_24682\'], " + "legendLocation=[1, 1, 4])\\n\","; ; TS_ASSERT_EQUALS(notebookLines[93], groupWorkspacesStringSecondGroup); @@ -801,14 +806,12 @@ public: // First group std::string loadAndReduceString = - " \"input\" : \"#Load and reduce\\n12345 = " - "Load(Filename = \'INTER12345\')\\nIvsQ_TOF_12345, " - "IvsLam_TOF_12345, _ = " - "ReflectometryReductionOneAuto(InputWorkspace = \'12345\', " - "ThetaIn = 0.5, MomentumTransferMinimum = 0.1, " - "MomentumTransferMaximum = 1.6, MomentumTransferStep = " - "0.04, ScaleFactor = 1, AnalysisMode = " - "MultiDetectorAnalysis)\\n\","; + " \"input\" : \"#Load and reduce\\n12345 = Load(Filename " + "= \'INTER12345\')\\nIvsQ_binned_TOF_12345, IvsQ_TOF_12345, " + "IvsLam_TOF_12345 = ReflectometryReductionOneAuto(InputWorkspace = " + "\'12345\', ThetaIn = 0.5, MomentumTransferMin = 0.1, " + "MomentumTransferMax = 1.6, MomentumTransferStep = 0.04, ScaleFactor = " + "1, AnalysisMode = MultiDetectorAnalysis)\\n\","; TS_ASSERT_EQUALS(notebookLines[48], loadAndReduceString); std::string postProcessString = " \"input\" : \"\","; @@ -816,25 +819,25 @@ public: std::string groupWorkspacesString = " \"input\" : \"#Group workspaces to be plotted on same " - "axes\\nIvsQ_groupWS = GroupWorkspaces(InputWorkspaces = " + "axes\\nIvsQ_binned_groupWS = GroupWorkspaces(InputWorkspaces = " + "\'IvsQ_binned_TOF_12345\')\\nIvsQ_groupWS = " + "GroupWorkspaces(InputWorkspaces = " "\'IvsQ_TOF_12345\')\\nIvsLam_groupWS = " "GroupWorkspaces(InputWorkspaces = \'IvsLam_TOF_12345\')\\n#Plot " - "workspaces\\nfig = plots([IvsQ_groupWS, IvsLam_groupWS, ], " - "title=[\'IvsQ_groupWS\', \'IvsLam_groupWS\', \'\'], " - "legendLocation=[1, 1, 4])\\n\","; + "workspaces\\nfig = plots([IvsQ_binned_groupWS, IvsQ_groupWS, " + "IvsLam_groupWS, ], title=[\'IvsQ_binned_groupWS\', \'IvsQ_groupWS\', " + "\'IvsLam_groupWS\', \'\'], legendLocation=[1, 1, 4])\\n\","; TS_ASSERT_EQUALS(notebookLines[64], groupWorkspacesString); // Second group loadAndReduceString = - " \"input\" : \"#Load and reduce\\n12346 = " - "Load(Filename = \'INTER12346\')\\nIvsQ_TOF_12346, " - "IvsLam_TOF_12346, _ = " - "ReflectometryReductionOneAuto(InputWorkspace = \'12346\', " - "ThetaIn = 1.5, MomentumTransferMinimum = 1.4, " - "MomentumTransferMaximum = 2.9, MomentumTransferStep = " - "0.04, ScaleFactor = 1, AnalysisMode = " - "MultiDetectorAnalysis)\\n\","; + " \"input\" : \"#Load and reduce\\n12346 = Load(Filename " + "= \'INTER12346\')\\nIvsQ_binned_TOF_12346, IvsQ_TOF_12346, " + "IvsLam_TOF_12346 = ReflectometryReductionOneAuto(InputWorkspace = " + "\'12346\', ThetaIn = 1.5, MomentumTransferMin = 1.4, " + "MomentumTransferMax = 2.9, MomentumTransferStep = 0.04, ScaleFactor = " + "1, AnalysisMode = MultiDetectorAnalysis)\\n\","; TS_ASSERT_EQUALS(notebookLines[77], loadAndReduceString); postProcessString = " \"input\" : \"\","; @@ -842,12 +845,14 @@ public: groupWorkspacesString = " \"input\" : \"#Group workspaces to be plotted on same " - "axes\\nIvsQ_groupWS = GroupWorkspaces(InputWorkspaces = " + "axes\\nIvsQ_binned_groupWS = GroupWorkspaces(InputWorkspaces = " + "\'IvsQ_binned_TOF_12346\')\\nIvsQ_groupWS = " + "GroupWorkspaces(InputWorkspaces = " "\'IvsQ_TOF_12346\')\\nIvsLam_groupWS = " "GroupWorkspaces(InputWorkspaces = \'IvsLam_TOF_12346\')\\n#Plot " - "workspaces\\nfig = plots([IvsQ_groupWS, IvsLam_groupWS, ], " - "title=[\'IvsQ_groupWS\', \'IvsLam_groupWS\', \'\'], " - "legendLocation=[1, 1, 4])\\n\","; + "workspaces\\nfig = plots([IvsQ_binned_groupWS, IvsQ_groupWS, " + "IvsLam_groupWS, ], title=[\'IvsQ_binned_groupWS\', \'IvsQ_groupWS\', " + "\'IvsLam_groupWS\', \'\'], legendLocation=[1, 1, 4])\\n\","; TS_ASSERT_EQUALS(notebookLines[93], groupWorkspacesString); } }; diff --git a/MantidQt/MantidWidgets/test/DataProcessorUI/DataProcessorProcessingAlgorithmTest.h b/MantidQt/MantidWidgets/test/DataProcessorUI/DataProcessorProcessingAlgorithmTest.h index bdcdeaebf0ceb20d3161b8debe6b60401942ecca..0abf18ed68cfb0336ddf912ac9f68107e85d4da2 100644 --- a/MantidQt/MantidWidgets/test/DataProcessorUI/DataProcessorProcessingAlgorithmTest.h +++ b/MantidQt/MantidWidgets/test/DataProcessorUI/DataProcessorProcessingAlgorithmTest.h @@ -57,30 +57,38 @@ public: std::string algName = "ReflectometryReductionOneAuto"; - // ReflectometryReductionOneAuto has two output ws properties - // We should provide two prefixes, one for each ws + // ReflectometryReductionOneAuto has three output ws properties + // We should provide three prefixes, one for each ws std::vector<std::string> prefixes; - prefixes.push_back("IvsQ_"); + prefixes.push_back("IvsQ_binned_"); // This should throw - TS_ASSERT_THROWS(DataProcessorProcessingAlgorithm( - algName, prefixes, std::set<std::string>(), 1), + TS_ASSERT_THROWS(DataProcessorProcessingAlgorithm(algName, prefixes, + std::set<std::string>()), + std::invalid_argument); + + prefixes.push_back("IvsQ_"); + // This should also throw + TS_ASSERT_THROWS(DataProcessorProcessingAlgorithm(algName, prefixes, + std::set<std::string>()), std::invalid_argument); // But this should be OK prefixes.push_back("IvsLam_"); TS_ASSERT_THROWS_NOTHING(DataProcessorProcessingAlgorithm( - algName, prefixes, std::set<std::string>(), 1)); + algName, prefixes, std::set<std::string>())); auto alg = DataProcessorProcessingAlgorithm(algName, prefixes, - std::set<std::string>(), 1); + std::set<std::string>()); TS_ASSERT_EQUALS(alg.name(), "ReflectometryReductionOneAuto"); - TS_ASSERT_EQUALS(alg.numberOfOutputProperties(), 2); - TS_ASSERT_EQUALS(alg.prefix(0), "IvsQ_"); - TS_ASSERT_EQUALS(alg.prefix(1), "IvsLam_"); + TS_ASSERT_EQUALS(alg.numberOfOutputProperties(), 3); + TS_ASSERT_EQUALS(alg.prefix(0), "IvsQ_binned_"); + TS_ASSERT_EQUALS(alg.prefix(1), "IvsQ_"); + TS_ASSERT_EQUALS(alg.prefix(2), "IvsLam_"); TS_ASSERT_EQUALS(alg.inputPropertyName(0), "InputWorkspace"); TS_ASSERT_EQUALS(alg.inputPropertyName(1), "FirstTransmissionRun"); TS_ASSERT_EQUALS(alg.inputPropertyName(2), "SecondTransmissionRun"); - TS_ASSERT_EQUALS(alg.outputPropertyName(0), "OutputWorkspace"); - TS_ASSERT_EQUALS(alg.outputPropertyName(1), "OutputWorkspaceWavelength"); + TS_ASSERT_EQUALS(alg.outputPropertyName(0), "OutputWorkspaceBinned"); + TS_ASSERT_EQUALS(alg.outputPropertyName(1), "OutputWorkspace"); + TS_ASSERT_EQUALS(alg.outputPropertyName(2), "OutputWorkspaceWavelength"); } // Add more tests for specific algorithms here diff --git a/MantidQt/MantidWidgets/test/DataProcessorUI/GenericDataProcessorPresenterTest.h b/MantidQt/MantidWidgets/test/DataProcessorUI/GenericDataProcessorPresenterTest.h index 0f16ef80484dad2f40082a94b4480a886ad1097b..f4d24729d31c59fbc442a746abc6a63d18654af2 100644 --- a/MantidQt/MantidWidgets/test/DataProcessorUI/GenericDataProcessorPresenterTest.h +++ b/MantidQt/MantidWidgets/test/DataProcessorUI/GenericDataProcessorPresenterTest.h @@ -31,8 +31,8 @@ private: whitelist.addElement("Angle", "ThetaIn", ""); whitelist.addElement("Transmission Run(s)", "FirstTransmissionRun", "", true, "TRANS_"); - whitelist.addElement("Q min", "MomentumTransferMinimum", ""); - whitelist.addElement("Q max", "MomentumTransferMaximum", ""); + whitelist.addElement("Q min", "MomentumTransferMin", ""); + whitelist.addElement("Q max", "MomentumTransferMax", ""); whitelist.addElement("dQ/Q", "MomentumTransferStep", ""); whitelist.addElement("Scale", "ScaleFactor", ""); return whitelist; @@ -50,19 +50,18 @@ private: DataProcessorPreprocessingAlgorithm( "CreateTransmissionWorkspaceAuto", "TRANS_", std::set<std::string>{"FirstTransmissionRun", - "SecondTransmissionRun", "OutputWorkspace"}, - 1)}}; + "SecondTransmissionRun", + "OutputWorkspace"})}}; } DataProcessorProcessingAlgorithm createReflectometryProcessor() { return DataProcessorProcessingAlgorithm( "ReflectometryReductionOneAuto", - std::vector<std::string>{"IvsQ_", "IvsLam_"}, + std::vector<std::string>{"IvsQ_binned_", "IvsQ_", "IvsLam_"}, std::set<std::string>{"ThetaIn", "ThetaOut", "InputWorkspace", "OutputWorkspace", "OutputWorkspaceWavelength", - "FirstTransmissionRun", "SecondTransmissionRun"}, - 1); + "FirstTransmissionRun", "SecondTransmissionRun"}); } DataProcessorPostprocessingAlgorithm createReflectometryPostprocessor() { @@ -132,7 +131,7 @@ private: << "1.6" << "0.04" << "1" - << "ProcessingInstructions='0', CorrectDetectorPositions=0"; + << "ProcessingInstructions='0'"; row = ws->appendRow(); row << "0" << "12346" @@ -1038,9 +1037,13 @@ public: presenter.notify(DataProcessorPresenter::ProcessFlag); // Check output workspaces were created as expected + TS_ASSERT( + AnalysisDataService::Instance().doesExist("IvsQ_binned_TOF_12345")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsQ_TOF_12345")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsLam_TOF_12345")); TS_ASSERT(AnalysisDataService::Instance().doesExist("TOF_12345")); + TS_ASSERT( + AnalysisDataService::Instance().doesExist("IvsQ_binned_TOF_12346")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsQ_TOF_12346")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsLam_TOF_12346")); TS_ASSERT(AnalysisDataService::Instance().doesExist("TOF_12346")); @@ -1049,9 +1052,11 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + AnalysisDataService::Instance().remove("IvsQ_binned_TOF_12345"); AnalysisDataService::Instance().remove("IvsQ_TOF_12345"); AnalysisDataService::Instance().remove("IvsLam_TOF_12345"); AnalysisDataService::Instance().remove("TOF_12345"); + AnalysisDataService::Instance().remove("IvsQ_binned_TOF_12346"); AnalysisDataService::Instance().remove("IvsQ_TOF_12346"); AnalysisDataService::Instance().remove("IvsLam_TOF_12346"); AnalysisDataService::Instance().remove("TOF_12346"); @@ -1073,7 +1078,7 @@ public: auto ws = createPrefilledWorkspace("TestWorkspace", presenter.getWhiteList()); - ws->String(0, QMinCol) = ""; + ws->String(0, ThetaCol) = ""; ws->String(1, ScaleCol) = ""; EXPECT_CALL(mockDataProcessorView, getWorkspaceToOpen()) .Times(1) @@ -1118,13 +1123,17 @@ public: TS_ASSERT_EQUALS(ws->rowCount(), 4); TS_ASSERT_EQUALS(ws->String(0, RunCol), "12345"); TS_ASSERT_EQUALS(ws->String(1, RunCol), "12346"); - TS_ASSERT(ws->String(0, QMinCol) != ""); + TS_ASSERT(ws->String(0, ThetaCol) != ""); TS_ASSERT(ws->String(1, ScaleCol) != ""); // Check output workspaces were created as expected + TS_ASSERT( + AnalysisDataService::Instance().doesExist("IvsQ_binned_TOF_12345")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsQ_TOF_12345")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsLam_TOF_12345")); TS_ASSERT(AnalysisDataService::Instance().doesExist("TOF_12345")); + TS_ASSERT( + AnalysisDataService::Instance().doesExist("IvsQ_binned_TOF_12346")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsQ_TOF_12346")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsLam_TOF_12346")); TS_ASSERT(AnalysisDataService::Instance().doesExist("TOF_12346")); @@ -1133,9 +1142,11 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + AnalysisDataService::Instance().remove("IvsQ_binned_TOF_12345"); AnalysisDataService::Instance().remove("IvsQ_TOF_12345"); AnalysisDataService::Instance().remove("IvsLam_TOF_12345"); AnalysisDataService::Instance().remove("TOF_12345"); + AnalysisDataService::Instance().remove("IvsQ_binned_TOF_12346"); AnalysisDataService::Instance().remove("IvsQ_TOF_12346"); AnalysisDataService::Instance().remove("IvsLam_TOF_12346"); AnalysisDataService::Instance().remove("TOF_12346"); @@ -1199,9 +1210,13 @@ public: presenter.notify(DataProcessorPresenter::ProcessFlag); // Check output workspaces were created as expected + TS_ASSERT( + AnalysisDataService::Instance().doesExist("IvsQ_binned_TOF_12345")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsQ_TOF_12345")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsLam_TOF_12345")); TS_ASSERT(AnalysisDataService::Instance().doesExist("TOF_12345")); + TS_ASSERT( + AnalysisDataService::Instance().doesExist("IvsQ_binned_TOF_12346")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsQ_TOF_12346")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsLam_TOF_12346")); TS_ASSERT(AnalysisDataService::Instance().doesExist("TOF_12346")); @@ -1210,9 +1225,11 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + AnalysisDataService::Instance().remove("IvsQ_binned_TOF_12345"); AnalysisDataService::Instance().remove("IvsQ_TOF_12345"); AnalysisDataService::Instance().remove("IvsLam_TOF_12345"); AnalysisDataService::Instance().remove("TOF_12345"); + AnalysisDataService::Instance().remove("IvsQ_binned_TOF_12346"); AnalysisDataService::Instance().remove("IvsQ_TOF_12346"); AnalysisDataService::Instance().remove("IvsLam_TOF_12346"); AnalysisDataService::Instance().remove("TOF_12346"); @@ -1223,6 +1240,7 @@ public: } void testProcessWithNotebook() { + NiceMock<MockDataProcessorView> mockDataProcessorView; NiceMock<MockProgressableView> mockProgress; NiceMock<MockMainPresenter> mockMainPresenter; @@ -1271,9 +1289,11 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + AnalysisDataService::Instance().remove("IvsQ_binned_TOF_12345"); AnalysisDataService::Instance().remove("IvsQ_TOF_12345"); AnalysisDataService::Instance().remove("IvsLam_TOF_12345"); AnalysisDataService::Instance().remove("TOF_12345"); + AnalysisDataService::Instance().remove("IvsQ_binned_TOF_12346"); AnalysisDataService::Instance().remove("IvsQ_TOF_12346"); AnalysisDataService::Instance().remove("IvsLam_TOF_12346"); AnalysisDataService::Instance().remove("TOF_12346"); @@ -1308,7 +1328,7 @@ public: << "1.6" << "0.04" << "1" - << "ProcessingInstructions='0', CorrectDetectorPositions=0"; + << "ProcessingInstructions='0'"; row = ws->appendRow(); row << "1" << "dataB" @@ -1318,7 +1338,7 @@ public: << "2.9" << "0.04" << "1" - << "ProcessingInstructions='0', CorrectDetectorPositions=0"; + << "ProcessingInstructions='0'"; createTOFWorkspace("dataA"); createTOFWorkspace("dataB"); @@ -1354,6 +1374,10 @@ public: presenter.notify(DataProcessorPresenter::ProcessFlag); // Check output workspaces were created as expected + TS_ASSERT( + AnalysisDataService::Instance().doesExist("IvsQ_binned_TOF_dataA")); + TS_ASSERT( + AnalysisDataService::Instance().doesExist("IvsQ_binned_TOF_dataB")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsQ_TOF_dataA")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsQ_TOF_dataB")); TS_ASSERT(AnalysisDataService::Instance().doesExist("IvsLam_TOF_dataA")); @@ -1365,6 +1389,8 @@ public: AnalysisDataService::Instance().remove("TestWorkspace"); AnalysisDataService::Instance().remove("dataA"); AnalysisDataService::Instance().remove("dataB"); + AnalysisDataService::Instance().remove("IvsQ_binned_TOF_dataA"); + AnalysisDataService::Instance().remove("IvsQ_binned_TOF_dataB"); AnalysisDataService::Instance().remove("IvsQ_TOF_dataA"); AnalysisDataService::Instance().remove("IvsQ_TOF_dataB"); AnalysisDataService::Instance().remove("IvsLam_TOF_dataA"); @@ -2246,8 +2272,7 @@ public: rowlist[1].insert(1); const std::string expected = - "0\t12345\t0.5\t\t0.1\t1.6\t0.04\t1\tProcessingInstructions='0', " - "CorrectDetectorPositions=0\n" + "0\t12345\t0.5\t\t0.1\t1.6\t0.04\t1\tProcessingInstructions='0'\n" "0\t12346\t1.5\t\t1.4\t2.9\t0.04\t1\tProcessingInstructions='0'\n" "1\t24681\t0.5\t\t0.1\t1.6\t0.04\t1\t\n" "1\t24682\t1.5\t\t1.4\t2.9\t0.04\t1\t"; @@ -2329,8 +2354,7 @@ public: rowlist[1].insert(0); const std::string expected = - "0\t12345\t0.5\t\t0.1\t1.6\t0.04\t1\tProcessingInstructions='0', " - "CorrectDetectorPositions=0\n" + "0\t12345\t0.5\t\t0.1\t1.6\t0.04\t1\tProcessingInstructions='0'\n" "0\t12346\t1.5\t\t1.4\t2.9\t0.04\t1\tProcessingInstructions='0'\n" "1\t24681\t0.5\t\t0.1\t1.6\t0.04\t1\t"; @@ -2657,6 +2681,7 @@ public: } void testPlotRowWarn() { + NiceMock<MockDataProcessorView> mockDataProcessorView; MockProgressableView mockProgress; NiceMock<MockMainPresenter> mockMainPresenter; @@ -2696,6 +2721,7 @@ public: TS_ASSERT(Mock::VerifyAndClearExpectations(&mockDataProcessorView)); TS_ASSERT(Mock::VerifyAndClearExpectations(&mockMainPresenter)); } + void testPlotEmptyRow() { NiceMock<MockDataProcessorView> mockDataProcessorView; MockProgressableView mockProgress; @@ -3040,8 +3066,8 @@ public: .Times(1) .WillRepeatedly(Return("TestWorkspace")); presenter.notify(DataProcessorPresenter::OpenTableFlag); - createTOFWorkspace("IvsQ_TOF_12345", "12345"); - createTOFWorkspace("IvsQ_TOF_12346", "12346"); + createTOFWorkspace("IvsQ_binned_TOF_12345", "12345"); + createTOFWorkspace("IvsQ_binned_TOF_12346", "12346"); std::map<int, std::set<int>> rowlist; rowlist[0].insert(0); @@ -3059,18 +3085,17 @@ public: std::string pythonCode = "base_graph = None\nbase_graph = " - "plotSpectrum(\"IvsQ_TOF_12345\", 0, True, window = " - "base_graph)\nbase_graph = plotSpectrum(\"IvsQ_TOF_12346\", 0, " - "True, window = " - "base_graph)\nbase_graph.activeLayer().logLogAxes()\n"; + "plotSpectrum(\"IvsQ_binned_TOF_12345\", 0, True, window = " + "base_graph)\nbase_graph = plotSpectrum(\"IvsQ_binned_TOF_12346\", 0, " + "True, window = base_graph)\nbase_graph.activeLayer().logLogAxes()\n"; EXPECT_CALL(mockMainPresenter, runPythonAlgorithm(pythonCode)).Times(1); presenter.notify(DataProcessorPresenter::PlotRowFlag); // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); - AnalysisDataService::Instance().remove("IvsQ_TOF_12345"); - AnalysisDataService::Instance().remove("IvsQ_TOF_12346"); + AnalysisDataService::Instance().remove("IvsQ_binned_TOF_12345"); + AnalysisDataService::Instance().remove("IvsQ_binned_TOF_12346"); TS_ASSERT(Mock::VerifyAndClearExpectations(&mockDataProcessorView)); TS_ASSERT(Mock::VerifyAndClearExpectations(&mockMainPresenter)); @@ -3223,9 +3248,11 @@ public: // Tidy up AnalysisDataService::Instance().remove("TestWorkspace"); + AnalysisDataService::Instance().remove("IvsQ_binned_TOF_12345"); AnalysisDataService::Instance().remove("IvsQ_TOF_12345"); AnalysisDataService::Instance().remove("IvsLam_TOF_12345"); AnalysisDataService::Instance().remove("12345"); + AnalysisDataService::Instance().remove("IvsQ_binned_TOF_12346"); AnalysisDataService::Instance().remove("IvsQ_TOF_12346"); AnalysisDataService::Instance().remove("IvsLam_TOF_12346"); AnalysisDataService::Instance().remove("12346");