From 72cf3d077c02584227d9a716e83b118801f7eee2 Mon Sep 17 00:00:00 2001 From: Martyn Gigg Date: Thu, 13 Mar 2014 14:58:00 +0000 Subject: [PATCH] Copy errors across to corrected workspace for all cases. Refs #9166 --- .../src/CalculateGammaBackground.cpp | 2 ++ .../test/CalculateGammaBackgroundTest.h | 27 ++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Code/Mantid/Framework/CurveFitting/src/CalculateGammaBackground.cpp b/Code/Mantid/Framework/CurveFitting/src/CalculateGammaBackground.cpp index da9a7cd6c55d..ac197e5d6944 100644 --- a/Code/Mantid/Framework/CurveFitting/src/CalculateGammaBackground.cpp +++ b/Code/Mantid/Framework/CurveFitting/src/CalculateGammaBackground.cpp @@ -159,6 +159,8 @@ namespace Mantid // Copy X values m_backgroundWS->setX(outputIndex,m_inputWS->refX(inputIndex)); m_correctedWS->setX(outputIndex,m_inputWS->refX(inputIndex)); + // Copy errors to corrected + m_correctedWS->dataE(outputIndex) = m_inputWS->readE(inputIndex); try { diff --git a/Code/Mantid/Framework/CurveFitting/test/CalculateGammaBackgroundTest.h b/Code/Mantid/Framework/CurveFitting/test/CalculateGammaBackgroundTest.h index 83a7193ded27..86300604875d 100644 --- a/Code/Mantid/Framework/CurveFitting/test/CalculateGammaBackgroundTest.h +++ b/Code/Mantid/Framework/CurveFitting/test/CalculateGammaBackgroundTest.h @@ -45,7 +45,17 @@ class CalculateGammaBackgroundTest : public CxxTest::TestSuite TS_ASSERT_DELTA(corrX[npts/2], inX[npts/2],1e-08); TS_ASSERT_DELTA(corrX.back(),inX.back(),1e-08); - // Corrected matches input the detector is not defined as forward scatter range - Currently hardcoded in algorithm + // E values are zero for background & copy for corrected + const auto & backE(backgroundWS->readE(0)); + TS_ASSERT_DELTA(backE.front(), 0.0,1e-08); + TS_ASSERT_DELTA(backE[npts/2], 0.0,1e-08); + TS_ASSERT_DELTA(backE.back(), 0.0,1e-08); + const auto & corrE(correctedWS->readE(0)); + const auto & inE(inputWS->readE(0)); + TS_ASSERT_DELTA(corrE.front(),inE.front(),1e-08); + TS_ASSERT_DELTA(corrE[npts/2], inE[npts/2],1e-08); + TS_ASSERT_DELTA(corrE.back(),inE.back(),1e-08); + const auto & corrY(correctedWS->readY(0)); TS_ASSERT_DELTA(corrY.front(), -0.00253802, 1e-08); TS_ASSERT_DELTA(corrY[npts/2], 0.15060372, 1e-08); @@ -59,7 +69,7 @@ class CalculateGammaBackgroundTest : public CxxTest::TestSuite } - void xtest_Input_With_Spectrum_Number_Outside_Range_Leaves_Data_Uncorrected_And_Background_Zeroed() + void test_Input_With_Spectrum_Number_Outside_Range_Leaves_Data_Uncorrected_And_Background_Zeroed() { using namespace Mantid::API; auto inputWS = createTestWorkspaceWithFoilChanger(); //specNo=1 @@ -132,7 +142,18 @@ class CalculateGammaBackgroundTest : public CxxTest::TestSuite TS_ASSERT_DELTA(corrX[npts/2], inX[npts/2],1e-08); TS_ASSERT_DELTA(corrX.back(),inX.back(),1e-08); - // Corrected matches input the detector is not defined as forward scatter range - Currently hardcoded in algorithm + // E values are zero for background & copy for corrected + const auto & backE(backgroundWS->readE(0)); + TS_ASSERT_DELTA(backE.front(), 0.0,1e-08); + TS_ASSERT_DELTA(backE[npts/2], 0.0,1e-08); + TS_ASSERT_DELTA(backE.back(), 0.0,1e-08); + const auto & corrE(correctedWS->readE(0)); + const auto & inE(inputWS->readE(0)); + TS_ASSERT_DELTA(corrE.front(), inE.front(),1e-08); + TS_ASSERT_DELTA(corrE[npts/2], inE[npts/2],1e-08); + TS_ASSERT_DELTA(corrE.back(), inE.back(),1e-08); + + // Corrected values const auto & corrY(correctedWS->readY(0)); TS_ASSERT_DELTA(corrY.front(), -0.00253802, 1e-08); TS_ASSERT_DELTA(corrY[npts/2], 0.15060372, 1e-08);