Skip to content

Commit

Permalink
Merge pull request #693 from TOMToolkit/fix/add_None_grating_for_Floyds
Browse files Browse the repository at this point in the history
remove grating for FLOYDS observations.
  • Loading branch information
jchate6 committed Oct 4, 2023
2 parents 82a3eac + 21b22d2 commit 4f0729b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tom_observations/facilities/lco.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,10 @@ def __init__(self, *args, **kwargs):
help_text='Rotation angle of slit. Only for Floyds `Slit Position Angle` rotator mode',
label='Rotator Angle', required=False
)
# Add None option and help text for SOAR Gratings
if self.fields.get(f'c_{j+1}_ic_{i+1}_grating', None):
self.fields[f'c_{j+1}_ic_{i+1}_grating'].help_text = 'Only for SOAR'
self.fields[f'c_{j+1}_ic_{i+1}_grating'].choices.insert(0, ('None', 'None'))
self.fields[f'c_{j+1}_ic_{i+1}_slit'].help_text = 'Only for Floyds'

def convert_old_observation_payload_to_fields(self, data):
Expand Down Expand Up @@ -725,6 +729,9 @@ def _build_instrument_config(self, instrument_type, configuration_id, id):
if instrument_config['rotator_mode'] == 'SKY':
instrument_config['extra_params'] = {'rotator_angle': self.cleaned_data.get(
f'c_{configuration_id}_ic_{id}_rotator_angle', 0)}
if 'FLOYDS' in instrument_type.upper():
# Remove grating from FLOYDS requests
instrument_config['optical_elements'].pop('grating', None)
# Clear out the optical elements for NRES
elif 'NRES' in instrument_type.upper():
instrument_config['optical_elements'] = {}
Expand Down

0 comments on commit 4f0729b

Please sign in to comment.