Ejemplo n.º 1
0
 def _create_state_wavelength() -> StateWavelength:
     obj = StateWavelength()
     wavelength_range = (1.0, 10.0)
     obj.wavelength_interval.wavelength_full_range = wavelength_range
     obj.wavelength_interval.selected_ranges = [wavelength_range]
     obj.wavelength_interval.wavelength_step = 2.0
     obj.wavelength_step_type = RangeStepType.LIN
     obj.rebin_type = RebinType.REBIN
     return obj
Ejemplo n.º 2
0
 def test_that_raises_when_lower_wavelength_is_smaller_than_high_wavelength(
         self):
     state = StateWavelength()
     state.wavelength_low = [2.]
     state.wavelength_high = [1.]
     state.wavelength_step = 2.
     with self.assertRaises(ValueError):
         state.validate()
Ejemplo n.º 3
0
    def __init__(self):

        super(AllStates, self).__init__()
        self.data : StateData = StateData()
        self.move: StateMove = StateMove()
        self.reduction: StateReductionMode = StateReductionMode()
        self.slice: StateSliceEvent = StateSliceEvent()
        self.mask: StateMask = StateMask()
        self.wavelength: StateWavelength = StateWavelength()
        self.save: StateSave = StateSave()
        self.scale: StateScale = StateScale()
        self.adjustment: StateAdjustment = StateAdjustment()
        self.convert_to_q: StateConvertToQ = StateConvertToQ()
        self.compatibility: StateCompatibility = StateCompatibility()
Ejemplo n.º 4
0
    def _create_state_objs(self, data_info):
        self.adjustment = StateAdjustment()
        self.compatibility = StateCompatibility()
        self.convert_to_q = StateConvertToQ()
        self.calculate_transmission = get_calculate_transmission(
            instrument=self.instrument)
        self.mask = get_mask_builder(data_info=data_info).build()
        self.move = get_move_builder(data_info=data_info).build()
        self.normalize_to_monitor = get_normalize_to_monitor_builder(
            data_info=data_info).build()
        self.reduction_mode = StateReductionMode()
        self.scale = StateScale()
        self.wavelength = StateWavelength()
        self.wavelength_and_pixel = get_wavelength_and_pixel_adjustment_builder(
            data_info=data_info).build()

        # Ensure they are linked up correctly
        self.adjustment.calculate_transmission = self.calculate_transmission
        self.adjustment.normalize_to_monitor = self.normalize_to_monitor
        self.adjustment.wavelength_and_pixel_adjustment = self.wavelength_and_pixel
Ejemplo n.º 5
0
 def test_convert_step_type_does_not_change_NOT_SET(self):
     state = StateWavelength()
     state.wavelength_step_type = RangeStepType.NOT_SET
     self.assertEqual(state.wavelength_step_type_lin_log,
                      RangeStepType.NOT_SET)
Ejemplo n.º 6
0
 def test_convert_step_type_from_RANGE_LOG_to_LOG(self):
     state = StateWavelength()
     state.wavelength_step_type = RangeStepType.RANGE_LOG
     self.assertEqual(state.wavelength_step_type_lin_log, RangeStepType.LOG)
Ejemplo n.º 7
0
    def test_that_raises_when_wavelength_entry_is_missing(self):
        # Arrange
        state = StateWavelength()
        with self.assertRaises(ValueError):
            state.validate()

        state.wavelength_low = [1.]
        with self.assertRaises(ValueError):
            state.validate()

        state.wavelength_high = [2.]
        with self.assertRaises(ValueError):
            state.validate()

        state.wavelength_step = 2.
        self.assertIsNone(state.validate())
Ejemplo n.º 8
0
 def test_that_is_sans_state_data_object(self):
     state = StateWavelength()
     self.assertTrue(isinstance(state, StateWavelength))