def test_sample_and_can_corrections_with_can_shift(self): corr = ApplyPaalmanPingsCorrection(SampleWorkspace=self._sample_ws, CorrectionsWorkspace=self._corrections_ws, CanWorkspace=self._can_ws, CanShiftFactor = 0.03) self._verify_workspace(corr, 'sample_and_can_corrections')
def test_sample_and_can_corrections(self): corr = ApplyPaalmanPingsCorrection( SampleWorkspace=self._sample_ws, CorrectionsWorkspace=self._corrections_ws, CanWorkspace=self._can_ws) self._verify_workspace(corr, 'sample_and_can_corrections')
def test_sample_and_can_corrections_with_can_scale(self): corr = ApplyPaalmanPingsCorrection( SampleWorkspace='sample_ws', CorrectionsWorkspace='corrections_ws', CanWorkspace='can_ws', CanScaleFactor=0.9) self._verify_workspace(corr, 'sample_and_can_corrections')
def test_two_factor_approximation(self): two_corrections = self._create_group_of_factors(self._corrections_ws, ['acc', 'ass']) corr = ApplyPaalmanPingsCorrection(SampleWorkspace=self._sample_ws, CorrectionsWorkspace=two_corrections, CanWorkspace=self._can_ws, CanShiftFactor = 0.03) DeleteWorkspace(two_corrections) self._verify_workspace(corr, 'sample_and_can_corrections')
def test_fixed_window_scan(self): out_ws = ApplyPaalmanPingsCorrection( SampleWorkspace=mtd['fapi'][0], CorrectionsWorkspace='fws_corrections', OutputWorkspace='wsfapicorr') self.assertTrue(out_ws) self.assertTrue(isinstance(out_ws, MatrixWorkspace)) self.assertEquals(out_ws.blocksize(), mtd['fapi'][0].blocksize()) self.assertEquals(out_ws.getNumberHistograms(), mtd['fapi'][0].getNumberHistograms()) self.assertEquals( out_ws.getAxis(0).getUnit().unitID(), mtd['fapi'][0].getAxis(0).getUnit().unitID())
def test_container_rebinning_enabled(self): xs = numpy.array([0.0, 1.0, 0.0, 1.1]) ys = numpy.array([2.2, 3.3]) sample_1 = CreateWorkspace(DataX=xs, DataY=ys, NSpec=2, UnitX='Wavelength') xs = numpy.array([-1.0, 0.0, 1.0, 2.0, -1.0, 0.0, 1.0, 2.0]) ys = numpy.array([0.101, 0.102, 0.103, 0.104, 0.105, 0.106]) container_1 = CreateWorkspace(DataX=xs, DataY=ys, NSpec=2, UnitX='Wavelength') corrected = ApplyPaalmanPingsCorrection(SampleWorkspace=sample_1, CanWorkspace=container_1, RebinCanToSample=True) self.assertTrue(numpy.all(sample_1.extractY() > corrected.extractY())) DeleteWorkspace(sample_1) DeleteWorkspace(container_1) DeleteWorkspace(corrected)
def test_container_input_workspace_not_unintentionally_rebinned(self): xs = numpy.array([0.0, 1.0, 0.0, 1.1]) ys = numpy.array([2.2, 3.3]) sample_1 = CreateWorkspace(DataX=xs, DataY=ys, NSpec=2, UnitX='Wavelength') ys = numpy.array([0.11, 0.22]) container_1 = CreateWorkspace(DataX=xs, DataY=ys, NSpec=2, UnitX='Wavelength') corrected = ApplyPaalmanPingsCorrection(SampleWorkspace=sample_1, CanWorkspace=container_1) numHisto = container_1.getNumberHistograms() for i in range(numHisto): container_xs = container_1.readX(i) for j in range(len(container_xs)): self.assertEqual(container_xs[j], xs[i * numHisto + j]) DeleteWorkspace(sample_1) DeleteWorkspace(container_1) DeleteWorkspace(corrected)
def test_fixed_window_scan(self): Load(Filename='ILL/IN16B/mc-abs-corr-q.nxs', OutputWorkspace='fws_corrections_ass') GroupWorkspaces(InputWorkspaces=['fws_corrections_ass'], OutputWorkspace='fws_corrections') in_ws = Load(Filename='ILL/IN16B/fapi-fws-q.nxs', OutputWorkspace='fapi') out_ws = ApplyPaalmanPingsCorrection( SampleWorkspace=in_ws[0], CorrectionsWorkspace='fws_corrections', OutputWorkspace='wsfapicorr') self.assertTrue(out_ws) self.assertTrue(isinstance(out_ws, MatrixWorkspace)) self.assertEquals(out_ws.blocksize(), in_ws[0].blocksize()) self.assertEquals(out_ws.getNumberHistograms(), in_ws[0].getNumberHistograms()) self.assertEquals( out_ws.getAxis(0).getUnit().unitID(), in_ws[0].getAxis(0).getUnit().unitID())
def test_can_subtraction(self): corr = ApplyPaalmanPingsCorrection(SampleWorkspace=self._sample_ws, CanWorkspace=self._can_ws) self._verify_workspace(corr, 'can_subtraction')
def test_sample_corrections_only(self): corr = ApplyPaalmanPingsCorrection( SampleWorkspace=self._sample_ws, CorrectionsWorkspace=self._corrections_ws) self._verify_workspace(corr, 'sample_corrections_only')
def test_can_subtraction_with_can_scale(self): corr = ApplyPaalmanPingsCorrection(SampleWorkspace=self._sample_ws, CanWorkspace=self._can_ws, CanScaleFactor=0.9) self._verify_workspace(corr, 'can_subtraction')
def test_can_subtraction_with_can_shift(self): corr = ApplyPaalmanPingsCorrection(SampleWorkspace='sample_ws', CanWorkspace='can_ws', CanShiftFactor=0.03) self._verify_workspace(corr, 'can_subtraction')