コード例 #1
0
 def test_that_get_transmission_output_name_returns_correct_name_for_user_specified_workspace(self):
     # Arrange
     state = SANSFunctionsTest._get_state()
     state.save.user_specified_output_name = "test_output"
     # Act
     output_workspace, group_output_name = get_transmission_output_name(state)
     # Assert
     self.assertEqual(output_workspace, "test_output_trans_Sample")
     self.assertEqual(group_output_name, 'test_output_trans')
コード例 #2
0
 def test_that_get_transmission_output_name_returns_correct_name_for_CAN(self):
     # Arrange
     state = SANSFunctionsTest._get_state()
     state.save.user_specified_output_name = ''
     # Act
     output_workspace, group_output_name = get_transmission_output_name(state, data_type=DataType.Can)
     # Assert
     self.assertEqual(output_workspace, "12345_trans_Can_1.0_10.0")
     self.assertEqual(group_output_name, '12345_trans_1.0_10.0')
コード例 #3
0
 def test_that_get_transmission_output_name_returns_correct_name(self):
     # Arrange
     state = SANSFunctionsTest._get_state()
     state.save.user_specified_output_name = ''
     # Act
     output_workspace, group_output_name = get_transmission_output_name(state)
     # Assert
     self.assertEqual(output_workspace, "12345_trans_Sample_1.0_10.0")
     self.assertEqual(group_output_name, "12345_trans_1.0_10.0")
コード例 #4
0
 def test_that_get_transmission_output_name_returns_correct_name(self):
     # Arrange
     state = SANSFunctionsTest._get_state()
     state.save.user_specified_output_name = ''
     # Act
     output_workspace, group_output_name = get_transmission_output_name(state)
     # Assert
     self.assertEqual(output_workspace, "12345_trans_Sample_1.0_10.0")
     self.assertEqual(group_output_name, "12345_trans_1.0_10.0")
コード例 #5
0
 def test_that_get_transmission_output_name_returns_correct_name_for_CAN(self):
     # Arrange
     state = SANSFunctionsTest._get_state()
     state.save.user_specified_output_name = ''
     # Act
     output_workspace, group_output_name = get_transmission_output_name(state, data_type=DataType.Can)
     # Assert
     self.assertEqual(output_workspace, "12345_trans_Can_1.0_10.0")
     self.assertEqual(group_output_name, '12345_trans_1.0_10.0')
コード例 #6
0
 def test_that_get_transmission_output_name_returns_correct_name_for_user_specified_workspace(self):
     # Arrange
     state = SANSFunctionsTest._get_state()
     state.save.user_specified_output_name = "test_output"
     # Act
     output_workspace, group_output_name = get_transmission_output_name(state)
     # Assert
     self.assertEqual(output_workspace, "test_output_trans_Sample")
     self.assertEqual(group_output_name, 'test_output_trans')
コード例 #7
0
 def test_that_get_transmission_output_name_returns_correct_name_for_user_specified_workspace(
         self):
     # Arrange
     state = SANSFunctionsTest._get_state()
     state.save.user_specified_output_name = "test_output"
     # Act
     output_workspace, _ = get_transmission_output_name(
         state, ISISReductionMode.LAB)
     # Assert
     self.assertEqual(output_workspace, "test_output_trans")
コード例 #8
0
 def test_that_get_transmission_output_name_returns_correct_name_for_user_specified_workspace_for_CAN(self):
     # Arrange
     state = SANSFunctionsTest._get_state()
     state.save.user_specified_output_name = "test_output"
     # Act
     wav_range = state.wavelength.wavelength_interval.wavelength_full_range
     output_workspace, group_output_name = get_transmission_output_name(state, wav_range=wav_range,
                                                                        data_type=DataType.CAN)
     # Assert
     self.assertEqual(output_workspace, "test_output_trans_Can")
     self.assertEqual(group_output_name, 'test_output_trans')
コード例 #9
0
 def test_that_get_transmission_output_name_returns_correct_name(self):
     # Arrange
     state = SANSFunctionsTest._get_state()
     state.save.user_specified_output_name = ''
     # Act
     output_workspace, _ = get_transmission_output_name(
         state, ISISReductionMode.LAB)
     # Assert
     self.assertEqual(
         output_workspace,
         "12345_trans_Sample_12.0_34.0Phi12.0_56.0_t4.57_T12.37")
コード例 #10
0
    def test_that_get_transmission_output_name_returns_correct_name_for_wavelength_slices(self):
        state = self._get_state()
        state.save.user_specified_output_name = ''
        state.reduction.reduction_mode = ISISReductionMode.Merged
        multi_reduction_type = {"period": False,
                                "event_slice": False,
                                "wavelength_range": True}

        output_name, group_output_name = get_transmission_output_name(state, multi_reduction_type=multi_reduction_type)

        self.assertEqual(output_name, '12345_trans_Sample_1.0_10.0_12.0_34.0')
        self.assertEqual(group_output_name, '12345_trans_1.0_10.0')
コード例 #11
0
    def test_that_get_transmission_output_name_returns_correct_name_for_wavelength_slices(self):
        state = self._get_state()
        state.save.user_specified_output_name = ''
        state.reduction.reduction_mode = ISISReductionMode.Merged
        multi_reduction_type = {"period": False,
                                "event_slice": False,
                                "wavelength_range": True}

        output_name, group_output_name = get_transmission_output_name(state, multi_reduction_type=multi_reduction_type)

        self.assertEqual(output_name, '12345_trans_Sample_1.0_10.0_12.0_34.0')
        self.assertEqual(group_output_name, '12345_trans_1.0_10.0')
コード例 #12
0
    def test_that_get_transmission_output_name_returns_correct_name_for_wavelength_slices_with_user_specified(self):
        state = self._get_state()
        state.save.user_specified_output_name = 'user_output_name'
        state.reduction.reduction_mode = ReductionMode.MERGED
        multi_reduction_type = {"period": False,
                                "event_slice": False,
                                "wavelength_range": True}

        wav_range = state.wavelength.wavelength_interval.wavelength_full_range
        output_name, group_output_name = get_transmission_output_name(state, wav_range=wav_range,
                                                                      multi_reduction_type=multi_reduction_type)

        self.assertEqual(output_name, 'user_output_name_trans_Sample_12.0_34.0')
        self.assertEqual(group_output_name, 'user_output_name_trans')
コード例 #13
0
    def test_that_get_transmission_output_name_returns_correct_name_for_wavelength_slices_for_CAN_unfitted(self):
        state = self._get_state()
        state.save.user_specified_output_name = ''
        state.reduction.reduction_mode = ReductionMode.MERGED
        multi_reduction_type = {"period": False,
                                "event_slice": False,
                                "wavelength_range": True}

        output_name, group_output_name = get_transmission_output_name(state,
                                                                      multi_reduction_type=multi_reduction_type,
                                                                      data_type=DataType.CAN, fitted=False)

        self.assertEqual(output_name, '12345_trans_Can_unfitted_1.0_10.0')
        self.assertEqual(group_output_name, '12345_trans_1.0_10.0')
コード例 #14
0
    def _get_output_workspace_name(self,
                                   state,
                                   reduction_mode=None,
                                   data_type=None,
                                   can=False,
                                   sample=False,
                                   transmission=False,
                                   fitted=False):
        """
        Get the output names for the sliced workspaces (within the group workspaces, which are already named).

        :param state: a SANS state object
        :param reduction_mode: an optional ISISReductionMode enum: "HAB", "LAB", "Merged", or "All"
        :param data_type: an optional DataType enum: "Sample" or "Can"
        :param can: optional bool. If true then creating name for a can workspace
        :param sample: optional bool. If true then creating name for a sample workspace. Sample and can cannot both be
                       true
        :param transmission: optional bool. If true then creating name for a transmission workspace
        :param fitted: optional bool. If true then workspace is a fitted transmission workspace, otherwise unfitted
        :return: name of the workspace
        """
        _multi = {
            "event_slice": True,
            "period": self.getProperty("Period").value,
            "wavelength_range": self.getProperty("WavelengthRange").value
        }

        if not transmission:
            _suffix = ""
            if can:
                if reduction_mode == ISISReductionMode.HAB:
                    _suffix = "_hab_can"
                elif reduction_mode == ISISReductionMode.LAB:
                    _suffix = "_lab_can"
            elif sample:
                if reduction_mode == ISISReductionMode.HAB:
                    _suffix = "_hab_sample"
                elif reduction_mode == ISISReductionMode.LAB:
                    _suffix = "_lab_sample"
            return get_output_name(state,
                                   reduction_mode,
                                   True,
                                   suffix=_suffix,
                                   multi_reduction_type=_multi)[0]
        else:
            return get_transmission_output_name(state, data_type, _multi,
                                                fitted)[0]