diff --git a/mocksipipeline/instrument/configuration/moxsi_short.py b/mocksipipeline/instrument/configuration/moxsi_short.py index aafc89e..0cbf713 100644 --- a/mocksipipeline/instrument/configuration/moxsi_short.py +++ b/mocksipipeline/instrument/configuration/moxsi_short.py @@ -8,7 +8,8 @@ from mocksipipeline.instrument.optics.aperture import CircularAperture from mocksipipeline.instrument.optics.configuration import short_design from mocksipipeline.instrument.optics.filter import ThinFilmFilter -from mocksipipeline.instrument.optics.response import Channel +from mocksipipeline.instrument.optics.response import (ALLOWED_SPECTRAL_ORDERS, + Channel) __all__ = [ 'moxsi_short', @@ -74,12 +75,11 @@ aperture=pinhole) # Set up spectrograms -orders = [-4, -3, -2, -1, 0, 1, 2, 3, 4] spectrogram_1_refpix = ((short_design.detector_shape[1] - 1) / 2, (short_design.detector_shape[0] / 2 - 1) / 2, 0) * u.pix spectrograms = [] -for order in orders: +for order in ALLOWED_SPECTRAL_ORDERS: chan = Channel(name='spectrogram_1', order=order, filters=[al_thin, al_oxide], diff --git a/mocksipipeline/instrument/configuration/moxsi_slot.py b/mocksipipeline/instrument/configuration/moxsi_slot.py index 3c18f4d..93c7929 100644 --- a/mocksipipeline/instrument/configuration/moxsi_slot.py +++ b/mocksipipeline/instrument/configuration/moxsi_slot.py @@ -9,7 +9,8 @@ SlotAperture) from mocksipipeline.instrument.optics.configuration import short_design from mocksipipeline.instrument.optics.filter import ThinFilmFilter -from mocksipipeline.instrument.optics.response import Channel +from mocksipipeline.instrument.optics.response import (ALLOWED_SPECTRAL_ORDERS, + Channel) __all__ = [ 'moxsi_slot', @@ -83,10 +84,9 @@ aperture=pinhole) # Set up spectrograms -orders = [-4, -3, -2, -1, 0, 1, 2, 3, 4] spectrograms_pinhole = [] spectrograms_slot = [] -for order in orders: +for order in ALLOWED_SPECTRAL_ORDERS: spectrograms_pinhole.append( Channel(name='spectrogram_pinhole', order=order, diff --git a/mocksipipeline/instrument/optics/response.py b/mocksipipeline/instrument/optics/response.py index e8d5a52..02c7fcc 100644 --- a/mocksipipeline/instrument/optics/response.py +++ b/mocksipipeline/instrument/optics/response.py @@ -15,6 +15,22 @@ from mocksipipeline.instrument.optics.filter import ThinFilmFilter +ALLOWED_SPECTRAL_ORDERS = [ + -6, + -5, + -4, + -3, + -2, + -1, + 0, + 1, + 2, + 3, + 4, + 5, + 6, +] + __all__ = [ 'Channel', ] @@ -96,8 +112,7 @@ def spectral_order(self): @spectral_order.setter def spectral_order(self, value): - allowed_spectral_orders = [-4, -3, -2, -1, 0, 1, 2, 3, 4] - if value not in allowed_spectral_orders: + if value not in ALLOWED_SPECTRAL_ORDERS: raise ValueError(f'{value} is not an allowed spectral order.') self._spectral_order = value