Commit 6debcd9e authored by Gagik Vardanyan's avatar Gagik Vardanyan
Browse files

adjusted unit tests for keeping the monitor

parent a199f404
......@@ -87,8 +87,8 @@ public:
const auto &spec6 = outputWS->y(6).rawData();
const auto &err6 = outputWS->e(6).rawData();
TS_ASSERT_EQUALS(xAxis.size(), 2)
TS_ASSERT_DELTA(xAxis[0], 5.72778, 1E-5)
TS_ASSERT_DELTA(xAxis[1], 6.26757, 1E-5)
TS_ASSERT_DELTA(xAxis[0], 5.73, 1E-5)
TS_ASSERT_DELTA(xAxis[1], 6.27, 1E-5)
TS_ASSERT_EQUALS(spec6[0], 20)
TS_ASSERT_DELTA(err6[0], sqrt(20), 1E-5)
const auto unit = outputWS->getAxis(0)->unit()->unitID();
......@@ -122,8 +122,8 @@ public:
const auto &spec6 = outputWS->y(6).rawData();
const auto &err6 = outputWS->e(6).rawData();
TS_ASSERT_EQUALS(xAxis.size(), 2)
TS_ASSERT_DELTA(xAxis[0], 4.75015, 1E-5)
TS_ASSERT_DELTA(xAxis[1], 5.25016, 1E-5)
TS_ASSERT_DELTA(xAxis[0], 4.75, 1E-5)
TS_ASSERT_DELTA(xAxis[1], 5.25, 1E-5)
TS_ASSERT_EQUALS(spec6[0], 45)
TS_ASSERT_DELTA(err6[0], sqrt(45), 1E-5)
const auto unit = outputWS->getAxis(0)->unit()->unitID();
......
......@@ -36,17 +36,17 @@ class SANSILLReductionTest(unittest.TestCase):
def test_absorber(self):
SANSILLReduction(Run='010462', ProcessAs='Absorber', OutputWorkspace='Cd')
self._check_output(mtd['Cd'], True, 1, 128*128)
self._check_output(mtd['Cd'], True, 1, 128*128+2)
self._check_process_flag(mtd['Cd'], 'Absorber')
def test_beam(self):
SANSILLReduction(Run='010414', ProcessAs='Beam', OutputWorkspace='Db', FluxOutputWorkspace='Fl')
self._check_output(mtd['Db'], True, 1, 128*128)
self._check_output(mtd['Db'], True, 1, 128*128+2)
self._check_process_flag(mtd['Db'], 'Beam')
run = mtd['Db'].getRun()
self.assertAlmostEqual(run.getLogData('BeamCenterX').value, -0.0048, delta=1e-4)
self.assertAlmostEqual(run.getLogData('BeamCenterX').value, 0.0048, delta=1e-4)
self.assertAlmostEqual(run.getLogData('BeamCenterY').value, -0.0027, delta=1e-4)
self._check_output(mtd['Fl'], False, 1, 128*128)
self._check_output(mtd['Fl'], False, 1, 128*128+2)
self._check_process_flag(mtd['Fl'], 'Beam')
self.assertAlmostEqual(mtd['Fl'].readY(0)[0], 6628249, delta=1)
self.assertAlmostEqual(mtd['Fl'].readE(0)[0], 8566, delta=1)
......@@ -54,62 +54,62 @@ class SANSILLReductionTest(unittest.TestCase):
def test_transmission(self):
SANSILLReduction(Run='010414', ProcessAs='Beam', OutputWorkspace='Db')
SANSILLReduction(Run='010585', ProcessAs='Transmission', BeamInputWorkspace='Db', OutputWorkspace='Tr')
self.assertAlmostEqual(mtd['Tr'].readY(0)[0], 0.640, delta=1e-3)
self.assertAlmostEqual(mtd['Tr'].readY(0)[0], 0.642, delta=1e-3)
self.assertAlmostEqual(mtd['Tr'].readE(0)[0], 0.0019, delta=1e-4)
self._check_process_flag(mtd['Tr'], 'Transmission')
def test_container(self):
SANSILLReduction(Run='010460', ProcessAs='Container', OutputWorkspace='can')
self._check_output(mtd['can'], True, 1, 128*128)
self._check_output(mtd['can'], True, 1, 128*128+2)
self._check_process_flag(mtd['can'], 'Container')
def test_reference(self):
SANSILLReduction(Run='010453', ProcessAs='Reference', SensitivityOutputWorkspace='sens', OutputWorkspace='water')
self._check_output(mtd['water'], True, 1, 128*128)
self._check_output(mtd['sens'], False, 1, 128*128)
self._check_output(mtd['water'], True, 1, 128*128+2)
self._check_output(mtd['sens'], False, 1, 128*128+2)
self._check_process_flag(mtd['water'], 'Reference')
self._check_process_flag(mtd['sens'], 'Sensitivity')
def test_sample(self):
SANSILLReduction(Run='010569', ProcessAs='Sample', OutputWorkspace='sample')
self._check_output(mtd['sample'], True, 1, 128*128)
self._check_output(mtd['sample'], True, 1, 128*128+2)
self._check_process_flag(mtd['sample'], 'Sample')
def test_absorber_tof(self):
# D33 VTOF
# actually this is a container run, not an absorber, but is fine for this test
SANSILLReduction(Run='093409', ProcessAs='Absorber', OutputWorkspace='absorber')
self._check_output(mtd['absorber'], True, 30, 256*256)
self._check_output(mtd['absorber'], True, 30, 256*256+2)
self._check_process_flag(mtd['absorber'], 'Absorber')
def test_beam_tof(self):
# D33 VTOF
SANSILLReduction(Run='093406', ProcessAs='Beam', OutputWorkspace='beam', FluxOutputWorkspace='flux')
self._check_output(mtd['beam'], True, 30, 256*256)
self._check_output(mtd['beam'], True, 30, 256*256+2)
self._check_process_flag(mtd['beam'], 'Beam')
run = mtd['beam'].getRun()
self.assertAlmostEqual(run.getLogData('BeamCenterX').value, -0.0025, delta=1e-4)
self.assertAlmostEqual(run.getLogData('BeamCenterY').value, 0.0009, delta=1e-4)
self._check_output(mtd['flux'], False, 30, 256*256)
self._check_output(mtd['flux'], False, 30, 256*256+2)
self._check_process_flag(mtd['flux'], 'Beam')
def test_transmission_tof(self):
# D33 VTOF
SANSILLReduction(Run='093406', ProcessAs='Beam', OutputWorkspace='beam')
SANSILLReduction(Run='093407', ProcessAs='Transmission', BeamInputWorkspace='beam', OutputWorkspace='ctr')
self._check_output(mtd['ctr'], False, 75, 1)
self._check_output(mtd['ctr'], False, 97, 1)
def test_reference_tof(self):
# D33 VTOF
# this is actually a sample run, not water, but is fine for this test
SANSILLReduction(Run='093410', ProcessAs='Reference', OutputWorkspace='ref')
self._check_output(mtd['ref'], True, 30, 256*256)
self._check_output(mtd['ref'], True, 30, 256*256+2)
self._check_process_flag(mtd['ref'], 'Reference')
def test_sample_tof(self):
# D33 VTOF, Pluronic F127
SANSILLReduction(Run='093410', ProcessAs='Sample', OutputWorkspace='sample')
self._check_output(mtd['sample'], True, 30, 256*256)
self._check_output(mtd['sample'], True, 30, 256*256+2)
self._check_process_flag(mtd['sample'], 'Sample')
def _check_process_flag(self, ws, value):
......
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