Commit 43c301a6 authored by Owen Arnold's avatar Owen Arnold
Browse files

refs #5626. Compute the error.

parent dd9b1f2b
......@@ -153,6 +153,7 @@ namespace Mantid
outIntensity[i] = values[i];
}
denominatorWS->dataY(wsIndex) = outIntensity;
denominatorWS->dataE(wsIndex) = MantidVec(nInputBins, 0);
}
/**
......@@ -174,7 +175,7 @@ namespace Mantid
const size_t nHistograms = inWS->getNumberHistograms();
if(m_parallelExecution == true)
{
PARALLEL_FOR2(inWS, denominatorWS)
PARALLEL_FOR2(inWS, denominatorWS)
for(int wsIndex = 0; wsIndex < nHistograms; ++wsIndex)
{
PARALLEL_START_INTERUPT_REGION
......
......@@ -376,12 +376,15 @@ public:
TS_ASSERT_EQUALS(4, xValues.size());
const MantidVec& yInputValues = inputWS->readY(wsIndex);
const MantidVec& eInputValues = inputWS->readE(wsIndex);
for(size_t binIndex = 0; binIndex < (xValues.size() - 1); ++binIndex)
{
const double wavelength = (xValues[binIndex] + xValues[binIndex+1])/2;
const double expectedValue = yInputValues[binIndex] / ( (2*wavelength) + 1 ); // According to the equation written into the instrument parameter file for the instrument component link.
TS_ASSERT_EQUALS(expectedValue, yValues[binIndex]);
const double expectedError = (eInputValues[binIndex] * expectedValue) / yInputValues[binIndex]; // e = Ein/Ydenom so, since Yout = Yin/Ydenom, e = Ein * Yout / Yin
TS_ASSERT_EQUALS(expectedError, eValues[binIndex]);
}
}
}
......@@ -422,6 +425,7 @@ public:
const MantidVec& yInputValues = inputWS->readY(wsIndex);
const MantidVec& xInputValues = inputWS->readX(wsIndex);
const MantidVec& eInputValues = inputWS->readE(wsIndex);
for(size_t binIndex = 0; binIndex < (xInputValues.size() - 1); ++binIndex)
{
......@@ -431,6 +435,10 @@ public:
TS_ASSERT_EQUALS(expectedValue, yValuesParallel[binIndex]);
// Compare results from different execution types.
TS_ASSERT_EQUALS(yValuesSequential[binIndex], yValuesParallel[binIndex]);
// Compare the errors calculated.
const double expectedError = (eInputValues[binIndex] * expectedValue) / yInputValues[binIndex]; // e = Ein/Ydenom so, since Yout = Yin/Ydenom, e = Ein * Yout / Yin
TS_ASSERT_EQUALS(expectedError, eValuesParallel[binIndex]);
TS_ASSERT_EQUALS(expectedError, eValuesSequential[binIndex]);
}
}
}
......@@ -457,12 +465,15 @@ public:
TS_ASSERT_EQUALS(4, xValues.size());
const MantidVec& yInputValues = inputWS->readY(wsIndex);
const MantidVec& eInputValues = inputWS->readE(wsIndex);
for(size_t binIndex = 0; binIndex < (xValues.size() - 1); ++binIndex)
{
const double wavelength = (xValues[binIndex] + xValues[binIndex+1])/2;
const double expectedValue = yInputValues[binIndex] / ( (1*wavelength) + static_cast<double>(wsIndex) ); // According to the equation written into the instrument parameter file for the detector component link.
const double expectedError = (eInputValues[binIndex] * expectedValue) / yInputValues[binIndex]; // e = Ein/Ydenom so, since Yout = Yin/Ydenom, e = Ein * Yout / Yin
TS_ASSERT_EQUALS(expectedValue, yValues[binIndex]);
TS_ASSERT_EQUALS(expectedError, eValues[binIndex]);
}
}
}
......@@ -496,12 +507,15 @@ public:
TS_ASSERT_EQUALS(4, xValues.size());
const MantidVec& yInputValues = completeWS->readY(wsIndex);
const MantidVec& eInputValues = completeWS->readE(wsIndex);
for(size_t binIndex = 0; binIndex < (xValues.size() - 1); ++binIndex)
{
const double wavelength = (xValues[binIndex] + xValues[binIndex+1])/2;
const double expectedValue = yInputValues[binIndex] / ( (1*static_cast<double>(wsIndex)*wavelength) + 3.0 ); // According to the equation written into the instrument parameter file for the detector component link.
const double expectedError = (eInputValues[binIndex] * expectedValue) / yInputValues[binIndex]; // e = Ein/Ydenom so, since Yout = Yin/Ydenom, e = Ein * Yout / Yin
TS_ASSERT_EQUALS(expectedValue, yValues[binIndex]);
TS_ASSERT_EQUALS(expectedError, eValues[binIndex]);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment