Skip to content
Snippets Groups Projects
Commit 8bb7170c authored by Anton Piccardo-Selg's avatar Anton Piccardo-Selg
Browse files

Refs #13314 Adapt unit test

parent cbd783d1
No related branches found
No related tags found
No related merge requests found
......@@ -133,9 +133,15 @@ void Q1D2::exec() {
MantidVec normSum(YOut.size(), 0.0);
// the error on the normalisation
MantidVec normError2(YOut.size(), 0.0);
// the averaged Q resolution
// the averaged Q resolution. We need the a named dummy variable although it
// won't be
// used since we only want to create a reference to DX if it is really
// required. Referencing
// DX sets a flag which might not be desirable.
MantidVec dummy;
MantidVec &qResolutionOut =
useQResolution ? outputWS->dataDx(0) : MantidVec();
useQResolution ? outputWS->dataDx(0) : outputWS->dataY(0);
const int numSpec = static_cast<int>(m_dataWS->getNumberHistograms());
Progress progress(this, 0.05, 1.0, numSpec + 1);
......@@ -279,7 +285,9 @@ void Q1D2::exec() {
WorkspaceFactory::Instance().create(outputWS);
ws_sumOfCounts->dataX(0) = outputWS->dataX(0);
ws_sumOfCounts->dataY(0) = outputWS->dataY(0);
ws_sumOfCounts->dataDx(0) = outputWS->dataDx(0);
if (useQResolution) {
ws_sumOfCounts->dataDx(0) = outputWS->dataDx(0);
}
for (size_t i = 0; i < outputWS->dataE(0).size(); i++) {
ws_sumOfCounts->dataE(0)[i] = sqrt(outputWS->dataE(0)[i]);
}
......@@ -287,7 +295,9 @@ void Q1D2::exec() {
MatrixWorkspace_sptr ws_sumOfNormFactors =
WorkspaceFactory::Instance().create(outputWS);
ws_sumOfNormFactors->dataX(0) = outputWS->dataX(0);
ws_sumOfNormFactors->dataDx(0) = outputWS->dataDx(0);
if (useQResolution) {
ws_sumOfNormFactors->dataDx(0) = outputWS->dataDx(0);
}
for (size_t i = 0; i < ws_sumOfNormFactors->dataY(0).size(); i++) {
ws_sumOfNormFactors->dataY(0)[i] = normSum[i];
ws_sumOfNormFactors->dataE(0)[i] = sqrt(normError2[i]);
......
......@@ -201,6 +201,8 @@ public:
TS_ASSERT_DELTA(result->readE(0)[2], 404981, 10)
TS_ASSERT_DELTA(result->readE(0)[10], 489710.39, 100)
TS_ASSERT(boost::math::isnan(result->readE(0)[7]))
TSM_ASSERT("Should not have a DX value", !result->hasDx(0))
}
void testInvalidPixelAdj() {
......@@ -397,6 +399,7 @@ public:
value2);
// Act
TSM_ASSERT("Resolution workspace should not be NULL", qResolution)
Mantid::Algorithms::Q1D2 Q1D;
TS_ASSERT_THROWS_NOTHING(Q1D.initialize());
TS_ASSERT(Q1D.isInitialized())
......@@ -426,6 +429,7 @@ public:
Mantid::API::AnalysisDataService::Instance().retrieve(
outputWS + "_sumOfCounts")))
TSM_ASSERT("Should have the x error flag set", result->hasDx(0));
// That output will be SUM_i(Yin_i*QRES_in_i)/(SUM_i(Y_in_i)) for each q
// value
// In our test workspace we set QRes_in_1 to 1, this means that all DX
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment