diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ApplyPaalmanPingsCorrection.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ApplyPaalmanPingsCorrection.py index 525db109bfc34a1bfc05a30e1cce7d45388c2892..1c896ac246aa92f7229cb27df83b22e7999e8b29 100644 --- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ApplyPaalmanPingsCorrection.py +++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/ApplyPaalmanPingsCorrection.py @@ -247,6 +247,12 @@ class ApplyPaalmanPingsCorrection(PythonAlgorithm): Do a simple container subtraction (when no corrections are given). """ + + logger.information('Rebining can to ensure Minus') + RebinToWorkspace(WorkspaceToRebin=self._can_ws_name, + WorkspaceToMatch=self._sample_ws_name, + OutputWorkspace=self._can_ws_name) + logger.information('Using simple container subtraction') Minus(LHSWorkspace=self._sample_ws_name, diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ContainerSubtraction.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ContainerSubtraction.h index b3f48fd3fc24a9eeaf4b5be402237d8762b6ab4b..f929554b3d526fd796b244580bef85bc4c2a0d3d 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ContainerSubtraction.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Indirect/ContainerSubtraction.h @@ -28,8 +28,6 @@ private: virtual bool validate(); virtual void loadSettings(const QSettings &settings); - void addRebinStep(QString toRebin, QString toMatch); - Ui::ContainerSubtraction m_uiForm; std::string m_originalSampleUnits; }; diff --git a/MantidQt/CustomInterfaces/src/Indirect/ContainerSubtraction.cpp b/MantidQt/CustomInterfaces/src/Indirect/ContainerSubtraction.cpp index 7a649c3335f2bba2f2dc6214c9b20f78236b563e..232b30f2e68a48b666aa3ff54bf8adc56bfb86ad 100644 --- a/MantidQt/CustomInterfaces/src/Indirect/ContainerSubtraction.cpp +++ b/MantidQt/CustomInterfaces/src/Indirect/ContainerSubtraction.cpp @@ -36,8 +36,6 @@ void ContainerSubtraction::run() { sampleWsName.toStdString()); m_originalSampleUnits = sampleWs->getAxis(0)->unit()->unitID(); - - // If not in wavelength then do conversion if (m_originalSampleUnits != "Wavelength") { g_log.information( @@ -61,6 +59,13 @@ void ContainerSubtraction::run() { scaleX->setProperty("Factor", m_uiForm.spShift->value()); scaleX->setProperty("Operation", "Add"); scaleX->execute(); + IAlgorithm_sptr rebinAlg = + AlgorithmManager::Instance().create("RebinToWorkspace"); + rebinAlg->initialize(); + rebinAlg->setProperty("WorkspaceToRebin", canWs); + rebinAlg->setProperty("WorkspaceToMatch", sampleWs); + rebinAlg->setProperty("OutputWorkspace", canWsName.toStdString()); + rebinAlg->execute(); } // If not in wavelength then do conversion @@ -88,9 +93,7 @@ void ContainerSubtraction::run() { QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton); - if (result == QMessageBox::Yes) { - addRebinStep(sampleWsName, canWsName); - } else { + if (result != QMessageBox::Yes) { m_batchAlgoRunner->clearQueue(); g_log.error("Cannot apply absorption corrections using a sample and " "container with different binning."); @@ -125,28 +128,6 @@ void ContainerSubtraction::run() { m_pythonExportWsName = outputWsName.toStdString(); } -/** - * Adds a rebin to workspace step to the calculation for when using a sample and - *container that - * have different binning. - * - * @param toRebin - * @param toMatch - */ -void ContainerSubtraction::addRebinStep(QString toRebin, QString toMatch) { - API::BatchAlgorithmRunner::AlgorithmRuntimeProps rebinProps; - rebinProps["WorkspaceToMatch"] = toMatch.toStdString(); - - IAlgorithm_sptr rebinAlg = - AlgorithmManager::Instance().create("RebinToWorkspace"); - rebinAlg->initialize(); - - rebinAlg->setProperty("WorkspaceToRebin", toRebin.toStdString()); - rebinAlg->setProperty("OutputWorkspace", toRebin.toStdString()); - - m_batchAlgoRunner->addAlgorithm(rebinAlg, rebinProps); -} - /** * Validates the user input in the UI * @return if the input was valid