diff --git a/qt/scientific_interfaces/Indirect/IndirectDiffractionReduction.cpp b/qt/scientific_interfaces/Indirect/IndirectDiffractionReduction.cpp index ec2d71073c510754cddd45cef6b2a473e7eadd6a..9ca47fb18eee272f3aa303d94a4e59e9fb6b44d6 100644 --- a/qt/scientific_interfaces/Indirect/IndirectDiffractionReduction.cpp +++ b/qt/scientific_interfaces/Indirect/IndirectDiffractionReduction.cpp @@ -14,10 +14,6 @@ #include "MantidKernel/MultiFileNameParser.h" #include "MantidQtWidgets/Common/SignalBlocker.h" -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include "MantidQtWidgets/MplCpp/Plot.h" -#endif - using namespace Mantid::API; using namespace Mantid::Geometry; @@ -32,15 +28,6 @@ std::string toStdString(const QString &qString) { return qString.toStdString(); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -QStringList toQStringList(std::vector<std::string> const &input) { - QStringList output; - for (auto const &element : input) - output << QString::fromStdString(element); - return output; -} -#endif - } // namespace DECLARE_SUBWINDOW(IndirectDiffractionReduction) diff --git a/qt/scientific_interfaces/Indirect/Iqt.cpp b/qt/scientific_interfaces/Indirect/Iqt.cpp index 9e168e7b8dba5efefadb1a1403bf75746afc01a7..2c9f0d32e236f546d696dd5af3f9d5d5cf7eebfa 100644 --- a/qt/scientific_interfaces/Indirect/Iqt.cpp +++ b/qt/scientific_interfaces/Indirect/Iqt.cpp @@ -87,15 +87,6 @@ void addErrorMessage(UserInputValidator &uiv, std::string const &message) { uiv.addErrorMessage(QString::fromStdString(message) + "\n"); } -void cloneWorkspace(std::string const &workspaceName, - std::string const &cloneName) { - auto cloner = AlgorithmManager::Instance().create("CloneWorkspace"); - cloner->initialize(); - cloner->setProperty("InputWorkspace", workspaceName); - cloner->setProperty("OutputWorkspace", cloneName); - cloner->execute(); -} - bool isTechniqueDirect(MatrixWorkspace_const_sptr sampleWorkspace, MatrixWorkspace_const_sptr resWorkspace) { try { @@ -107,16 +98,6 @@ bool isTechniqueDirect(MatrixWorkspace_const_sptr sampleWorkspace, } } -void cropWorkspace(std::string const &name, std::string const &newName, - double const &cropValue) { - auto croper = AlgorithmManager::Instance().create("CropWorkspace"); - croper->initialize(); - croper->setProperty("InputWorkspace", name); - croper->setProperty("OutputWorkspace", newName); - croper->setProperty("XMin", cropValue); - croper->execute(); -} - /** * Calculate the number of bins in the sample & resolution workspaces * @param wsName The sample workspace name @@ -325,53 +306,6 @@ void Iqt::errorsClicked() { bool Iqt::isErrorsEnabled() { return m_uiForm.cbCalculateErrors->isChecked(); } -std::size_t Iqt::getXMinIndex(Mantid::MantidVec const &yData, - std::vector<double>::const_iterator iter) { - auto cropIndex = 0; - if (iter != yData.end()) { - auto const index = static_cast<int>(iter - yData.begin()); - cropIndex = index > 0 ? index - 1 : index; - } else - showMessageBox( - "Incorrect data provided for Tiled Plot: y values are out of range"); - return cropIndex; -} - -double Iqt::getXMinValue(MatrixWorkspace_const_sptr workspace, - std::size_t const &index) { - auto const firstSpectraYData = workspace->dataY(index); - auto const positionIter = - std::find_if(firstSpectraYData.begin(), firstSpectraYData.end(), - [&](double const &value) { return value < 1.0; }); - auto const cropIndex = getXMinIndex(firstSpectraYData, positionIter); - return workspace->dataX(index)[cropIndex]; -} - -// void Iqt::plotTiled() { -// setTiledPlotIsPlotting(true); -// -// auto const outWs = getADSMatrixWorkspace(m_pythonExportWsName); -// -// auto const tiledPlotWsName = outWs->getName() + "_tiled"; -// auto const firstTiledPlot = m_uiForm.spTiledPlotFirst->text().toInt(); -// auto const lastTiledPlot = m_uiForm.spTiledPlotLast->text().toInt(); -// -// // Clone workspace before cropping to keep in ADS -// if (!AnalysisDataService::Instance().doesExist(tiledPlotWsName)) -// cloneWorkspace(outWs->getName(), tiledPlotWsName); -// -// // Get first x value which corresponds to a y value below 1 -// auto const cropValue = -// getXMinValue(outWs, static_cast<std::size_t>(firstTiledPlot)); -// cropWorkspace(tiledPlotWsName, tiledPlotWsName, cropValue); -// -// auto const tiledPlotWs = getADSMatrixWorkspace(tiledPlotWsName); -// -// IndirectTab::plotTiled(tiledPlotWsName, firstTiledPlot, lastTiledPlot); -// -// setTiledPlotIsPlotting(false); -//} - /** * Ensure we have present and valid file/ws inputs. * diff --git a/qt/scientific_interfaces/Indirect/Iqt.h b/qt/scientific_interfaces/Indirect/Iqt.h index cd96833ee73ff1a54026fe0144b2d1731490b50c..7d08cf57099f40e51d4ef772df30eb08750f31c0 100644 --- a/qt/scientific_interfaces/Indirect/Iqt.h +++ b/qt/scientific_interfaces/Indirect/Iqt.h @@ -29,13 +29,6 @@ private: bool isErrorsEnabled(); - std::size_t getXMinIndex(Mantid::MantidVec const &firstSpectraYData, - std::vector<double>::const_iterator iter); - double getXMinValue(Mantid::API::MatrixWorkspace_const_sptr workspace, - std::size_t const &index); - - void plotResult(QString const &workspaceName); - void setRunEnabled(bool enabled); void setSaveResultEnabled(bool enabled); void setButtonsEnabled(bool enabled); diff --git a/qt/scientific_interfaces/Indirect/test/IndirectSettingsPresenterTest.h b/qt/scientific_interfaces/Indirect/test/IndirectSettingsPresenterTest.h index 8535b5edd980dfeb68a4566463519fbe938e2346..76543b742f276f8ee58dfa1f31a287c2e0f0287f 100644 --- a/qt/scientific_interfaces/Indirect/test/IndirectSettingsPresenterTest.h +++ b/qt/scientific_interfaces/Indirect/test/IndirectSettingsPresenterTest.h @@ -97,8 +97,7 @@ public: void test_that_calling_a_presenter_method_will_invoke_the_relevant_view_and_model_methods() { - QString const settingGroup("Indirect Settings"); - checkForLoadingOfSettings(settingGroup); + checkForLoadingOfSettings(); } ///---------------------------------------------------------------------- @@ -106,18 +105,12 @@ public: ///---------------------------------------------------------------------- void test_that_the_okClicked_signal_will_attempt_to_save_the_settings() { - QString const settingGroup("Indirect Settings"); - - checkForSavingOfSettings(settingGroup); - + checkForSavingOfSettings(); m_view->emitOkClicked(); } void test_that_the_applyClicked_signal_will_attempt_to_save_the_settings() { - QString const settingGroup("Indirect Settings"); - - checkForSavingOfSettings(settingGroup); - + checkForSavingOfSettings(); m_view->emitApplyClicked(); } @@ -136,17 +129,8 @@ public: m_view->emitApplyClicked(); } - ///---------------------------------------------------------------------- - /// Unit Tests that test the methods of the presenter - ///---------------------------------------------------------------------- - - void test_that_loadSettings_will_attempt_to_load_the_relevant_settings() { - QString const settingGroup("Indirect Settings"); - checkForLoadingOfSettings(settingGroup); - } - private: - void checkForLoadingOfSettings(QString const &settingGroup) { + void checkForLoadingOfSettings() { std::string const facility("ISIS"); ON_CALL(*m_model, getFacility()).WillByDefault(Return(facility)); @@ -161,7 +145,7 @@ private: m_presenter->loadSettings(); } - void checkForSavingOfSettings(QString const &settingGroup) { + void checkForSavingOfSettings() { std::string const facility("ISIS"); ON_CALL(*m_view, getSelectedFacility())