def test_that_the_output_workspace_is_valid_when_using_cross_sections_and_formula_units_for_sample_and_can( self): """ Test simple run with sample and can workspace using cross sections. It also uses Formula units as the units for number density. """ FlatPlatePaalmanPingsCorrection( OutputWorkspace=self._corrections_ws_name, SampleWorkspace=self._sample_ws, SampleDensityType='Number Density', SampleNumberDensityUnit='Formula Units', SampleDensity=0.1, SampleCoherentXSection=0.039, SampleIncoherentXSection=56.052, SampleAttenuationXSection=0.222, CanWorkspace=self._can_ws, CanDensityType='Number Density', CanNumberDensityUnit='Formula Units', CanDensity=0.1, CanCoherentXSection=0.018, CanIncoherentXSection=5.08, CanAttenuationXSection=5.08) self._verify_workspaces_for_can()
def test_sampleAndCanDefaults(self): """ Test simple run with sample and can workspace using the default values. """ FlatPlatePaalmanPingsCorrection( OutputWorkspace=self._corrections_ws_name, SampleWorkspace=self._sample_ws, SampleChemicalFormula='H2-O', CanWorkspace=self._can_ws, CanChemicalFormula='V') self._verify_workspaces_for_can()
def test_efixed(self): """ Tests in the EFixed mode """ FlatPlatePaalmanPingsCorrection( OutputWorkspace=self._corrections_ws_name, SampleWorkspace=self._sample_empty_unit, SampleChemicalFormula='H2-O', Emode='Efixed') for workspace in mtd[self._corrections_ws_name]: self.assertEqual(workspace.blocksize(), 1) run = workspace.getRun() self.assertEqual(run.getLogData('emode').value, 'Efixed') self.assertAlmostEqual(run.getLogData('efixed').value, 5.)
def test_efixed_override(self): """ Tests in the Efixed mode with overridden Efixed value for point data """ FlatPlatePaalmanPingsCorrection( OutputWorkspace=self._corrections_ws_name, SampleWorkspace=self._empty_unit_point, SampleChemicalFormula='H2-O', Emode='Efixed', Efixed=7.5) for workspace in mtd[self._corrections_ws_name]: self.assertEqual(workspace.blocksize(), 1) run = workspace.getRun() self.assertEqual(run.getLogData('emode').value, 'Efixed') self.assertAlmostEqual(run.getLogData('efixed').value, 7.5)
def test_number_density_for_sample_can(self): """ Test simple run with sample and can workspace and number density for both """ FlatPlatePaalmanPingsCorrection( OutputWorkspace=self._corrections_ws_name, SampleWorkspace=self._sample_ws, SampleChemicalFormula='H2-O', SampleDensityType='Number Density', SampleDensity=0.5, CanWorkspace=self._can_ws, CanChemicalFormula='V', CanDensityType='Number Density', CanDensity=0.5) self._verify_workspaces_for_can()
def test_sampleOnly_indirect(self): """ Test simple run with sample workspace only for indirect mode """ FlatPlatePaalmanPingsCorrection( OutputWorkspace=self._corrections_ws_name, SampleWorkspace=self._sample_ws, SampleChemicalFormula='H2-O', SampleThickness=0.1, SampleAngle=45, NumberWavelengths=10, Emode='Indirect', Efixed=1.845) ass_ws_name = self._corrections_ws_name + '_ass' self._verify_workspace(ass_ws_name)
def test_that_the_output_workspace_is_valid_when_using_cross_sections_for_sample( self): """ Test simple run with sample workspace using cross sections. """ FlatPlatePaalmanPingsCorrection( OutputWorkspace=self._corrections_ws_name, SampleWorkspace=self._sample_ws, SampleDensityType='Number Density', SampleDensity=0.1, SampleCoherentXSection=0.039, SampleIncoherentXSection=56.052, SampleAttenuationXSection=0.222) ass_ws_name = self._corrections_ws_name + '_ass' self._verify_workspace(ass_ws_name)
def test_InterpolateDisabled(self): """ Tests that a workspace with a bin count equal to NumberWavelengths is created when interpolation is disabled. """ FlatPlatePaalmanPingsCorrection( OutputWorkspace=self._corrections_ws_name, SampleWorkspace=self._sample_ws, SampleChemicalFormula='H2-O', CanWorkspace=self._can_ws, CanChemicalFormula='V', NumberWavelengths=20, Interpolate=False) corrections_ws = mtd[self._corrections_ws_name] # Check each correction workspace has X binning matching NumberWavelengths for workspace in corrections_ws: self.assertEqual(workspace.blocksize(), 20)
def test_sampleAndCan(self): """ Test simple run with sample and can workspace. """ FlatPlatePaalmanPingsCorrection( OutputWorkspace=self._corrections_ws_name, SampleWorkspace=self._sample_ws, SampleChemicalFormula='H2-O', SampleThickness=0.1, SampleAngle=45, CanWorkspace=self._can_ws, CanChemicalFormula='V', CanFrontThickness=0.01, CanBackThickness=0.01, NumberWavelengths=10, Emode='Indirect', Efixed=1.845) self._verify_workspaces_for_can()