Example #1
0
    def _do_test_valid(self, settings, is_input_event=True, run_number=None):
        # Arrange
        dark_run_subtractor = DarkRunSubtraction()
        for setting in settings:
            dark_run_subtractor.add_setting(setting)

        # Create an actual scatter workspace
        scatter_workspace = None
        monitor_workspace = None
        if is_input_event:
            scatter_workspace, monitor_workspace = self._get_sample_workspaces(
                run_number)
        else:
            scatter_workspace, monitor_workspace = self._get_sample_workspace_histo(
            )

        # Execute the dark_run_subtractor
        try:
            start_spec = 9
            end_spec = 20  # Full specturm length
            scatter_workspace, monitor_workspace = dark_run_subtractor.execute(
                scatter_workspace, monitor_workspace, start_spec, end_spec,
                is_input_event)
        # pylint: disable=bare-except
        except:
            self.assertFalse(True,
                             "The DarkRunSubtraction executed with an error")
        return scatter_workspace, monitor_workspace
Example #2
0
 def test_that_raises_when_having_mixed_mean_settings_for_monitor_time(self):
     # Arrange
     dark_run_subtractor = DarkRunSubtraction()
     # When having two monitor settings with differing mean selections, this is inconsistent
     setting1 = self._get_dark_run_settings_object("222222", True, True, True, None)
     setting2 = self._get_dark_run_settings_object("222222", True, False, True, None)
     dark_run_subtractor.add_setting(setting1)
     dark_run_subtractor.add_setting(setting2)
     # Act + Assert
     self.assertRaises(RuntimeError, dark_run_subtractor.get_time_based_setting_detectors)
 def test_that_raises_when_detector_has_more_than_one_setting(self):
     # Arrange
     dark_run_subtractor = DarkRunSubtraction()
     # We have two settings with different run numbers for detecetor-type corrections
     setting1 = self._get_dark_run_settings_object("222222", True, False, False, None)
     setting2 = self._get_dark_run_settings_object("222222", True, False, False, None)
     dark_run_subtractor.add_setting(setting1)
     dark_run_subtractor.add_setting(setting2)
     # Act + Assert
     self.assertRaises(RuntimeError, dark_run_subtractor.get_time_based_setting_detectors)
Example #4
0
 def test_that_raises_when_detector_has_more_than_one_setting(self):
     # Arrange
     dark_run_subtractor = DarkRunSubtraction()
     # We have two settings with different run numbers for detecetor-type corrections
     setting1 = self._get_dark_run_settings_object("222222", True, False, False, None)
     setting2 = self._get_dark_run_settings_object("222222", True, False, False, None)
     dark_run_subtractor.add_setting(setting1)
     dark_run_subtractor.add_setting(setting2)
     # Act + Assert
     self.assertRaises(RuntimeError, dark_run_subtractor.get_time_based_setting_detectors)
 def test_that_raises_when_having_mixed_mean_settings_for_monitor_time(self):
     # Arrange
     dark_run_subtractor = DarkRunSubtraction()
     # When having two monitor settings with differing mean selections, this is inconsistent
     setting1 = self._get_dark_run_settings_object("222222", True, True, True, None)
     setting2 = self._get_dark_run_settings_object("222222", True, False, True, None)
     dark_run_subtractor.add_setting(setting1)
     dark_run_subtractor.add_setting(setting2)
     # Act + Assert
     self.assertRaises(RuntimeError, dark_run_subtractor.get_time_based_setting_detectors)
Example #6
0
    def _do_test_valid_transmission(self, settings, trans_ids):
        # Arrange
        dark_run_subtractor = DarkRunSubtraction()
        for setting in settings:
            dark_run_subtractor.add_setting(setting)

        # Create an actual scatter workspace
        transmission_workspace = self._get_transmission_workspace(trans_ids)

        # Execute the dark_run_subtractor - let exceptions flow to help track down errors
        transmission_workspace = dark_run_subtractor.execute_transmission(transmission_workspace, trans_ids)

        return transmission_workspace
    def _do_test_valid_transmission(self, settings, trans_ids):
        # Arrange
        dark_run_subtractor = DarkRunSubtraction()
        for setting in settings:
            dark_run_subtractor.add_setting(setting)

        # Create an actual scatter workspace
        transmission_workspace = self._get_transmission_workspace(trans_ids)

        # Execute the dark_run_subtractor - let exceptions flow to help track down errors
        transmission_workspace = dark_run_subtractor.execute_transmission(transmission_workspace, trans_ids)

        return transmission_workspace
Example #8
0
    def test_that_specifying_more_than_two_run_numbers_per_category_raises_error(self):
        # Arrange
        dark_run_subtractor = DarkRunSubtraction()
        # Time-based detectors
        setting1 = self._get_dark_run_settings_object("111111", True, False, False, None)
        setting2 = self._get_dark_run_settings_object("222222", True, False, False, None)
        # Uamp-based detectors
        setting3 = self._get_dark_run_settings_object("111111", False, False, False, None)
        setting4 = self._get_dark_run_settings_object("222222", False, False, False, None)
        # Time-based monitors
        setting5 = self._get_dark_run_settings_object("111111", True, False, True, None)
        setting6 = self._get_dark_run_settings_object("222222", True, False, True, None)
        # Uamp-based monitors
        setting7 = self._get_dark_run_settings_object("111111", False, False, True, None)
        setting8 = self._get_dark_run_settings_object("222222", False, False, True, None)

        dark_run_subtractor.add_setting(setting1)
        dark_run_subtractor.add_setting(setting2)
        dark_run_subtractor.add_setting(setting3)
        dark_run_subtractor.add_setting(setting4)
        dark_run_subtractor.add_setting(setting5)
        dark_run_subtractor.add_setting(setting6)
        dark_run_subtractor.add_setting(setting7)
        dark_run_subtractor.add_setting(setting8)
        # Act + Assert
        self.assertRaises(RuntimeError, dark_run_subtractor.get_time_based_setting_detectors)
        self.assertRaises(RuntimeError, dark_run_subtractor.get_uamp_based_setting_detectors)
        self.assertRaises(RuntimeError, dark_run_subtractor.get_time_based_setting_monitors)
        self.assertRaises(RuntimeError, dark_run_subtractor.get_uamp_based_setting_monitors)
    def test_that_specifying_more_than_two_run_numbers_per_category_raises_error(self):
        # Arrange
        dark_run_subtractor = DarkRunSubtraction()
        # Time-based detectors
        setting1 = self._get_dark_run_settings_object("111111", True, False, False, None)
        setting2 = self._get_dark_run_settings_object("222222", True, False, False, None)
        # Uamp-based detectors
        setting3 = self._get_dark_run_settings_object("111111", False, False, False, None)
        setting4 = self._get_dark_run_settings_object("222222", False, False, False, None)
        # Time-based monitors
        setting5 = self._get_dark_run_settings_object("111111", True, False, True, None)
        setting6 = self._get_dark_run_settings_object("222222", True, False, True, None)
        # Uamp-based monitors
        setting7 = self._get_dark_run_settings_object("111111", False, False, True, None)
        setting8 = self._get_dark_run_settings_object("222222", False, False, True, None)

        dark_run_subtractor.add_setting(setting1)
        dark_run_subtractor.add_setting(setting2)
        dark_run_subtractor.add_setting(setting3)
        dark_run_subtractor.add_setting(setting4)
        dark_run_subtractor.add_setting(setting5)
        dark_run_subtractor.add_setting(setting6)
        dark_run_subtractor.add_setting(setting7)
        dark_run_subtractor.add_setting(setting8)
        # Act + Assert
        self.assertRaises(RuntimeError, dark_run_subtractor.get_time_based_setting_detectors)
        self.assertRaises(RuntimeError, dark_run_subtractor.get_uamp_based_setting_detectors)
        self.assertRaises(RuntimeError, dark_run_subtractor.get_time_based_setting_monitors)
        self.assertRaises(RuntimeError, dark_run_subtractor.get_uamp_based_setting_monitors)
    def _do_test_valid_transmission(self, settings, trans_ids):
        # Arrange
        dark_run_subtractor = DarkRunSubtraction()
        for setting in settings:
            dark_run_subtractor.add_setting(setting)

        # Create an actual scatter workspace
        transmission_workspace = self._get_transmission_workspace(trans_ids)

        # Execute the dark_run_subtractor
        try:
            transmission_workspace = dark_run_subtractor.execute_transmission(transmission_workspace, trans_ids)
        # pylint: disable=bare-except
        except:
            self.assertFalse(True, "The DarkRunSubtraction executed with an error")
        return transmission_workspace
Example #11
0
    def _do_test_valid(self, settings, is_input_event= True, run_number = None) :
        # Arrange
        dark_run_subtractor = DarkRunSubtraction()
        for setting in settings:
            dark_run_subtractor.add_setting(setting)

        # Create an actual scatter workspace
        scatter_workspace = None
        monitor_workspace = None
        if is_input_event:
            scatter_workspace, monitor_workspace = self._get_sample_workspaces(run_number)
        else:
            scatter_workspace, monitor_workspace = self._get_sample_workspace_histo()

        # Execute the dark_run_subtractor - let exceptions flow to help track down errors
        start_spec = 9
        end_spec = 20 # Full spectrum length
        scatter_workspace, monitor_workspace = dark_run_subtractor.execute(scatter_workspace, monitor_workspace,
                                                                           start_spec, end_spec, is_input_event)

        return scatter_workspace, monitor_workspace
    def _do_test_valid(self, settings, is_input_event= True, run_number = None) :
        # Arrange
        dark_run_subtractor = DarkRunSubtraction()
        for setting in settings:
            dark_run_subtractor.add_setting(setting)

        # Create an actual scatter workspace
        scatter_workspace = None
        monitor_workspace = None
        if is_input_event:
            scatter_workspace, monitor_workspace = self._get_sample_workspaces(run_number)
        else:
            scatter_workspace, monitor_workspace = self._get_sample_workspace_histo()

        # Execute the dark_run_subtractor - let exceptions flow to help track down errors
        start_spec = 9
        end_spec = 20 # Full spectrum length
        scatter_workspace, monitor_workspace = dark_run_subtractor.execute(scatter_workspace, monitor_workspace,
                                                                           start_spec, end_spec, is_input_event)

        return scatter_workspace, monitor_workspace
    def _do_test_valid(self, settings, is_input_event= True, run_number = None) :
        # Arrange
        dark_run_subtractor = DarkRunSubtraction()
        for setting in settings:
            dark_run_subtractor.add_setting(setting)

        # Create an actual scatter workspace
        scatter_workspace = None
        monitor_workspace = None
        if is_input_event:
            scatter_workspace, monitor_workspace = self._get_sample_workspaces(run_number)
        else:
            scatter_workspace, monitor_workspace = self._get_sample_workspace_histo()

        # Execute the dark_run_subtractor
        try:
            start_spec = 9
            end_spec = 20 # Full specturm length
            scatter_workspace, monitor_workspace = dark_run_subtractor.execute(scatter_workspace, monitor_workspace,
                                                                               start_spec, end_spec, is_input_event)
        # pylint: disable=bare-except
        except:
            self.assertFalse(True, "The DarkRunSubtraction executed with an error")
        return scatter_workspace, monitor_workspace