From eedb82bde6ce7b6ec62bb8d361b66c073ac31fa7 Mon Sep 17 00:00:00 2001 From: Marina Ganeva <m.ganeva@fz-juelich.de> Date: Wed, 12 Aug 2015 06:55:56 +0200 Subject: [PATCH] One more unittest. --- .../algorithms/DNSDetEffCorrVanaTest.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/DNSDetEffCorrVanaTest.py b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/DNSDetEffCorrVanaTest.py index eec28ef2ef5..17e3d41e71d 100644 --- a/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/DNSDetEffCorrVanaTest.py +++ b/Code/Mantid/Framework/PythonInterface/test/python/plugins/algorithms/DNSDetEffCorrVanaTest.py @@ -100,6 +100,31 @@ class DNSDetEffCorrVanaTest(unittest.TestCase): BkgWorkspace=self.__vanaws.getName()) return + def test_TwoTheta(self): + # check whether the 2theta angles the same as in the data workspace + outputWorkspaceName = "DNSDetCorrVanaTest_Test5" + # rotate detector bank to different angles + api.RotateInstrumentComponent(self.__dataws, "bank0", X=0, Y=1, Z=0, Angle=-7.53) + api.RotateInstrumentComponent(self.__vanaws, "bank0", X=0, Y=1, Z=0, Angle=-8.02) + api.RotateInstrumentComponent(self.__bkgrws, "bank0", X=0, Y=1, Z=0, Angle=-8.54) + # run correction + alg_test = run_algorithm("DNSDetEffCorrVana", InputWorkspace=self.__dataws.getName(), + OutputWorkspace=outputWorkspaceName, VanaWorkspace=self.__vanaws.getName(), + BkgWorkspace=self.__bkgrws.getName()) + self.assertTrue(alg_test.isExecuted()) + # check dimensions and angles + ws = AnalysisDataService.retrieve(outputWorkspaceName) + # dimensions + self.assertEqual(24, ws.getNumberHistograms()) + self.assertEqual(2, ws.getNumDims()) + # angles + tthetas = np.array([7.53 + i*5 for i in range(24)]) + for i in range(24): + det = ws.getDetector(i) + self.assertAlmostEqual(tthetas[i], np.degrees(ws.detectorSignedTwoTheta(det))) + + run_algorithm("DeleteWorkspace", Workspace=outputWorkspaceName) + return if __name__ == '__main__': unittest.main() -- GitLab