From 3173ab05041bc2aa863958bc9971087112e058e8 Mon Sep 17 00:00:00 2001 From: Will Barnes Date: Mon, 18 Mar 2024 12:21:49 -0400 Subject: [PATCH] include 5 and 6 orders --- .../instrument/configuration/moxsi_short.py | 6 +++--- .../instrument/configuration/moxsi_slot.py | 6 +++--- mocksipipeline/instrument/optics/response.py | 19 +++++++++++++++++-- 3 files changed, 23 insertions(+), 8 deletions(-) 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