Commit 4e6d609b authored by Mathieu Tillet's avatar Mathieu Tillet
Browse files

Add tests for D11B and D22B loader

parent 391d3fab
......@@ -99,6 +99,59 @@ public:
checkTimeFormat(outputWS);
}
void test_D11B() {
LoadILLSANS alg;
alg.setChild(true);
alg.initialize();
TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("Filename", "027194.nxs"))
TS_ASSERT_THROWS_NOTHING(
alg.setPropertyValue("OutputWorkspace", "__unused_for_child"))
TS_ASSERT_THROWS_NOTHING(alg.execute())
TS_ASSERT(alg.isExecuted())
MatrixWorkspace_const_sptr outputWS = alg.getProperty("OutputWorkspace");
TS_ASSERT(outputWS)
TS_ASSERT_EQUALS(outputWS->getNumberHistograms(),
192 * 256 + 2 * 32 * 256 + 2)
TS_ASSERT_EQUALS(outputWS->blocksize(), 1)
TS_ASSERT(outputWS->detectorInfo().isMonitor(192 * 256 + 2 * 32 * 256))
TS_ASSERT(outputWS->detectorInfo().isMonitor(192 * 256 + 2 * 32 * 256 + 1))
TS_ASSERT(outputWS->isHistogramData())
TS_ASSERT(!outputWS->isDistribution())
const auto &instrument = outputWS->getInstrument();
// TODO SET CORRECT COORDINATES
IComponent_const_sptr component =
instrument->getComponentByName("detector");
V3D pos = component->getPos();
TS_ASSERT_DELTA(pos.X(), 0, 1E-5)
TS_ASSERT_DELTA(pos.Y(), 0, 1E-5)
TS_ASSERT_DELTA(pos.Z(), 20.007, 1E-3)
component = instrument->getComponentByName("detector_left");
pos = component->getPos();
TS_ASSERT_DELTA(pos.X(), 0, 1E-5)
TS_ASSERT_DELTA(pos.Y(), 0, 1E-5)
TS_ASSERT_DELTA(pos.Z(), 0, 1E-5)
component = instrument->getComponentByName("detector_right");
pos = component->getPos();
TS_ASSERT_DELTA(pos.X(), 0, 1E-5)
TS_ASSERT_DELTA(pos.Y(), 0, 1E-5)
TS_ASSERT_DELTA(pos.Z(), 0, 1E-5)
const auto &xAxis = outputWS->x(0).rawData();
const auto &spec = outputWS->y(3630).rawData();
const auto &err = outputWS->e(3630).rawData();
TS_ASSERT_EQUALS(xAxis.size(), 2)
TS_ASSERT_DELTA(xAxis[0], 6.685, 1E-5)
TS_ASSERT_DELTA(xAxis[1], 7.315, 1E-5)
TS_ASSERT_EQUALS(spec[0], 246)
TS_ASSERT_DELTA(err[0], sqrt(246), 1E-5)
const auto unit = outputWS->getAxis(0)->unit()->unitID();
TS_ASSERT_EQUALS(unit, "Wavelength");
checkTimeFormat(outputWS);
}
void test_D22() {
LoadILLSANS alg;
alg.setChild(true);
......@@ -135,6 +188,51 @@ public:
checkTimeFormat(outputWS);
}
void test_d22B() {
LoadILLSANS alg;
alg.setChild(true);
alg.initialize();
TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("Filename", "375508.nxs"))
TS_ASSERT_THROWS_NOTHING(
alg.setPropertyValue("OutputWorkspace", "__unused_for_child"))
TS_ASSERT_THROWS_NOTHING(alg.execute())
TS_ASSERT(alg.isExecuted())
MatrixWorkspace_const_sptr outputWS = alg.getProperty("OutputWorkspace");
TS_ASSERT(outputWS)
TS_ASSERT_EQUALS(outputWS->getNumberHistograms(), 128 * 256 + 96 * 256 + 2)
TS_ASSERT_EQUALS(outputWS->blocksize(), 1)
TS_ASSERT(outputWS->detectorInfo().isMonitor(128 * 256 + 96 * 256))
TS_ASSERT(outputWS->detectorInfo().isMonitor(128 * 256 + 96 * 256 + 1))
TS_ASSERT(outputWS->isHistogramData())
TS_ASSERT(!outputWS->isDistribution())
const auto &instrument = outputWS->getInstrument();
// TODO SET CORRECT COORDINATES
IComponent_const_sptr comp = instrument->getComponentByName("detector");
V3D pos = comp->getPos();
TS_ASSERT_DELTA(pos.X(), -0.35, 0.01)
TS_ASSERT_DELTA(pos.Y(), -0.35, 0.01)
TS_ASSERT_DELTA(pos.Z(), 8, 0.01)
comp = instrument->getComponentByName("detector_right");
pos = comp->getPos();
TS_ASSERT_DELTA(pos.X(), 0, 0.01)
TS_ASSERT_DELTA(pos.Y(), -0.35, 0.01)
TS_ASSERT_DELTA(pos.Z(), 0, 0.01)
const auto &xAxis = outputWS->x(0).rawData();
const auto &spec = outputWS->y(1280).rawData();
const auto &err = outputWS->e(1280).rawData();
TS_ASSERT_EQUALS(xAxis.size(), 2)
TS_ASSERT_DELTA(xAxis[0], 6.65, 1E-5)
TS_ASSERT_DELTA(xAxis[1], 7.35, 1E-5)
TS_ASSERT_EQUALS(spec[0], 10)
TS_ASSERT_DELTA(err[0], sqrt(10), 1E-5)
const auto unit = outputWS->getAxis(0)->unit()->unitID();
TS_ASSERT_EQUALS(unit, "Wavelength");
checkTimeFormat(outputWS);
}
void test_D16() {
LoadILLSANS alg;
alg.setChild(true);
......
e38f1cd76ab0db5a381434b195c55b67
8a4668039bb895376a804cd30162c8c0
Markdown is supported
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