コード例 #1
0
    def test_sampleAndCan(self):
        """
        Test simple run with sample and can workspace.
        """

        # Just pass if we can't actually run the algorithm
        if not is_supported_f2py_platform():
            return

        CylinderPaalmanPingsCorrection(
            OutputWorkspace=self._corrections_ws_name,
            SampleWorkspace=self._sample_ws,
            SampleChemicalFormula='H2-O',
            SampleInnerRadius=0.05,
            SampleOuterRadius=0.1,
            CanWorkspace=self._can_ws,
            CanChemicalFormula='V',
            CanOuterRadius=0.15,
            BeamHeight=0.1,
            BeamWidth=0.1,
            Emode='Indirect',
            Efixed=1.845,
            Version=1)

        self._verify_workspaces_for_can()
コード例 #2
0
    def test_sampleAndCanDefaults(self):
        """
        Test simple run with sample and can workspace using the default values.
        """

        CylinderPaalmanPingsCorrection(OutputWorkspace=self._corrections_ws_name,
                                       SampleWorkspace=self._sample_ws,
                                       SampleChemicalFormula='H2-O',
                                       CanWorkspace=self._can_ws,
                                       CanChemicalFormula='V')

        self._verify_workspaces_for_can()
コード例 #3
0
    def test_efixed(self):
        """
        Tests in the EFixed mode
        """
        CylinderPaalmanPingsCorrection(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.)
コード例 #4
0
    def test_efixed_override(self):
        """
        Tests in the Efixed mode with overridden Efixed value for point data
        """
        CylinderPaalmanPingsCorrection(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)
コード例 #5
0
    def test_that_the_output_workspace_is_valid_when_using_cross_sections_for_sample(self):
        """
        Test simple run with sample workspace using cross sections.
        """

        CylinderPaalmanPingsCorrection(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)
コード例 #6
0
    def test_sampleOnly_Direct(self):
        """
        Test simple run with sample workspace only for direct mode
        """

        CylinderPaalmanPingsCorrection(OutputWorkspace=self._corrections_ws_name,
                                       SampleWorkspace=self._sample_ws,
                                       SampleChemicalFormula='H2-O',
                                       SampleInnerRadius=0.05,
                                       SampleOuterRadius=0.1,
                                       Emode='Direct',
                                       Efixed=1.845)

        ass_ws_name = self._corrections_ws_name + '_ass'
        self._verify_workspace(ass_ws_name)
コード例 #7
0
    def test_mass_density_for_sample_can(self):
        """
        Test simple run with sample and can workspace and mass density for both
        """

        CylinderPaalmanPingsCorrection(OutputWorkspace=self._corrections_ws_name,
                                       SampleWorkspace=self._sample_ws,
                                       SampleChemicalFormula='H2-O',
                                       SampleDensityType='Mass Density',
                                       SampleDensity=0.5,
                                       CanWorkspace=self._can_ws,
                                       CanChemicalFormula='V',
                                       CanDensityType='Mass Density',
                                       CanDensity=0.5)

        self._verify_workspaces_for_can()
コード例 #8
0
    def test_sampleAndCanDefaults(self):
        """
        Test simple run with sample and can workspace using the default values.
        """

        # Just pass if we can't actually run the algorithm
        if not is_supported_f2py_platform():
            return

        CylinderPaalmanPingsCorrection(
            OutputWorkspace=self._corrections_ws_name,
            SampleWorkspace=self._sample_ws,
            SampleChemicalFormula='H2-O',
            CanWorkspace=self._can_ws,
            CanChemicalFormula='V',
            Version=1)

        self._verify_workspaces_for_can()
コード例 #9
0
    def test_InterpolateDisabled(self):
        """
        Tests that a workspace with a bin count equal to NumberWavelengths is created
        when interpolation is disabled.
        """

        CylinderPaalmanPingsCorrection(OutputWorkspace=self._corrections_ws_name,
                                       SampleWorkspace=self._sample_ws,
                                       SampleChemicalFormula='H2-O',
                                       CanWorkspace=self._can_ws,
                                       CanChemicalFormula='V',
                                       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(), 10)
コード例 #10
0
    def test_sampleAndCan(self):
        """
        Test simple run with sample and can workspace.
        """

        CylinderPaalmanPingsCorrection(OutputWorkspace=self._corrections_ws_name,
                                       SampleWorkspace=self._sample_ws,
                                       SampleChemicalFormula='H2-O',
                                       SampleInnerRadius=0.05,
                                       SampleOuterRadius=0.1,
                                       CanWorkspace=self._can_ws,
                                       CanChemicalFormula='V',
                                       CanOuterRadius=0.15,
                                       BeamHeight=0.1,
                                       BeamWidth=0.1,
                                       Emode='Indirect',
                                       Efixed=1.845)

        self._verify_workspaces_for_can()
コード例 #11
0
    def test_that_the_output_workspace_is_valid_when_using_cross_sections_for_sample_and_can(self):
        """
        Test simple run with sample and can workspace using cross sections.
        """

        CylinderPaalmanPingsCorrection(OutputWorkspace=self._corrections_ws_name,
                                       SampleWorkspace=self._sample_ws,
                                       SampleDensityType='Number Density',
                                       SampleDensity=0.1,
                                       SampleCoherentXSection=0.039,
                                       SampleIncoherentXSection=56.052,
                                       SampleAttenuationXSection=0.222,
                                       CanWorkspace=self._can_ws,
                                       CanDensityType='Number Density',
                                       CanDensity=0.1,
                                       CanCoherentXSection=0.018,
                                       CanIncoherentXSection=5.08,
                                       CanAttenuationXSection=5.08)

        self._verify_workspaces_for_can()
コード例 #12
0
    def test_sampleOnly(self):
        """
        Test simple run with sample workspace only.
        """

        # Just pass if we can't actually run the algorithm
        if not is_supported_f2py_platform():
            return

        CylinderPaalmanPingsCorrection(
            OutputWorkspace=self._corrections_ws_name,
            SampleWorkspace=self._sample_ws,
            SampleChemicalFormula='H2-O',
            SampleInnerRadius=0.05,
            SampleOuterRadius=0.1,
            Emode='Indirect',
            Efixed=1.845,
            Version=1)

        ass_ws_name = self._corrections_ws_name + '_ass'
        self._verify_workspace(ass_ws_name)
コード例 #13
0
    def test_InterpolateDisabled(self):
        """
        Tests that a workspace with a bin count equal to NumberWavelengths is created
        when interpolation is disabled.
        """

        # Just pass if we can't actually run the algorithm
        if not is_supported_f2py_platform():
            return

        CylinderPaalmanPingsCorrection(
            OutputWorkspace=self._corrections_ws_name,
            SampleWorkspace=self._sample_ws,
            SampleChemicalFormula='H2-O',
            CanWorkspace=self._can_ws,
            CanChemicalFormula='V',
            Interpolate=False,
            Version=1)

        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(), 10)