From 9a3ff9ef2999978ca0c6e906037cff387973092b Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Fri, 23 Jan 2015 11:30:34 +0000 Subject: [PATCH] Rebin the diff workspaces before minus Refs #10802 --- .../CustomInterfaces/src/DataComparison.cpp | 13 ++++++++++++- .../docs/source/interfaces/DataComparison.rst | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/DataComparison.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/DataComparison.cpp index 851a8598adaa..ac2b4b17b2ce 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/DataComparison.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/DataComparison.cpp @@ -452,12 +452,23 @@ void DataComparison::plotDiffWorkspace() extractWs2Alg->execute(); MatrixWorkspace_sptr ws2SpecWs = extractWs2Alg->getProperty("OutputWorkspace"); + // Rebin the second workspace to the first + // (needed for identical binning for Minus algorithm) + IAlgorithm_sptr rebinAlg = AlgorithmManager::Instance().create("RebinToWorkspace"); + rebinAlg->setChild(true); + rebinAlg->initialize(); + rebinAlg->setProperty("WorkspaceToRebin", ws2SpecWs); + rebinAlg->setProperty("WorkspaceToMatch", ws1SpecWs); + rebinAlg->setProperty("OutputWorkspace", "__ws2_spec_rebin"); + rebinAlg->execute(); + MatrixWorkspace_sptr rebinnedWs2SpecWs = rebinAlg->getProperty("OutputWorkspace"); + // Subtract the two extracted spectra IAlgorithm_sptr minusAlg = AlgorithmManager::Instance().create("Minus"); minusAlg->setChild(true); minusAlg->initialize(); minusAlg->setProperty("LHSWorkspace", ws1SpecWs); - minusAlg->setProperty("RHSWorkspace", ws2SpecWs); + minusAlg->setProperty("RHSWorkspace", rebinnedWs2SpecWs); minusAlg->setProperty("OutputWorkspace", "__diff"); minusAlg->execute(); MatrixWorkspace_sptr diffWorkspace = minusAlg->getProperty("OutputWorkspace"); diff --git a/Code/Mantid/docs/source/interfaces/DataComparison.rst b/Code/Mantid/docs/source/interfaces/DataComparison.rst index 73ae42a747f1..41f566ebf94d 100644 --- a/Code/Mantid/docs/source/interfaces/DataComparison.rst +++ b/Code/Mantid/docs/source/interfaces/DataComparison.rst @@ -14,6 +14,9 @@ The data comparison interface provides a method of comparing the spectra of multiple :ref:`MatrixWorkspace ` (either pre loaded into Mantid or loaded via the interface its self) using a preview plot. +Note that data in this plot is not normalised to bin width as it is by default +in Mantid plot windows. + Add Data --------