def _get_calculate_transmission_state(trans_entries, fit_entries): state = StateCalculateTransmission() if trans_entries is None: trans_entries = {} trans_settings = {"transmission_radius_on_detector": 12., "transmission_roi_files": ["test.xml"], "transmission_mask_files": ["test.xml"], "default_transmission_monitor": 3, "transmission_monitor": 4, "default_incident_monitor": 1, "incident_monitor": 2, "prompt_peak_correction_min": 123., "prompt_peak_correction_max": 1234., "rebin_type": RebinType.REBIN, "wavelength_low": [1.], "wavelength_high": [2.7], "wavelength_step": 0.5, "wavelength_step_type": RangeStepType.LIN, "use_full_wavelength_range": True, "wavelength_full_range_low": 12., "wavelength_full_range_high": 434., "background_TOF_general_start": 1.4, "background_TOF_general_stop": 24.5, "background_TOF_monitor_start": {"1": 123, "2": 123}, "background_TOF_monitor_stop": {"1": 234, "2": 2323}, "background_TOF_roi_start": 12., "background_TOF_roi_stop": 123.} for key, value in list(trans_settings.items()): if key in trans_entries: value = trans_entries[key] if value is not None: # If the value is None, then don't set it setattr(state, key, value) fit_settings = {"fit_type": FitType.POLYNOMIAL, "polynomial_order": 1, "wavelength_low": 12., "wavelength_high": 232.} if fit_entries is None: fit_entries = {} StateCalculateTransmissionTest._set_fit(state, fit_settings, fit_entries, DataType.SAMPLE) StateCalculateTransmissionTest._set_fit(state, fit_settings, fit_entries, DataType.CAN) return state
def __init__(self): super(StateAdjustment, self).__init__() self.calculate_transmission: StateCalculateTransmission = StateCalculateTransmission( ) self.normalize_to_monitor: StateNormalizeToMonitor = StateNormalizeToMonitor( ) self.wavelength_and_pixel_adjustment: StateWavelengthAndPixelAdjustment = StateWavelengthAndPixelAdjustment( ) self.wide_angle_correction: bool = False self.calibration = None # : Str()
def test_convert_step_type_does_not_change_NOT_SET(self): state = StateCalculateTransmission() state.wavelength_step_type = RangeStepType.NOT_SET self.assertEqual(state.wavelength_step_type_lin_log, RangeStepType.NOT_SET)
def test_convert_step_type_from_RANGE_LOG_to_LOG(self): state = StateCalculateTransmission() state.wavelength_step_type = RangeStepType.RANGE_LOG self.assertEqual(state.wavelength_step_type_lin_log, RangeStepType.LOG)