From 3fc25044859e2b7b6f294e782e0b61b1b01aca0d Mon Sep 17 00:00:00 2001 From: Joseph Chatelain Date: Thu, 28 Sep 2023 03:59:27 -0700 Subject: [PATCH 1/2] remove grating for FLOYDS observations. --- tom_observations/facilities/lco.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tom_observations/facilities/lco.py b/tom_observations/facilities/lco.py index 7d038281e..9e2b5cc30 100644 --- a/tom_observations/facilities/lco.py +++ b/tom_observations/facilities/lco.py @@ -659,6 +659,9 @@ 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 + 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): @@ -725,6 +728,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'] = {} From 2072a6e3932ddac47d77a4fff27fe88a761b8eab Mon Sep 17 00:00:00 2001 From: Joseph Chatelain Date: Thu, 28 Sep 2023 04:46:14 -0700 Subject: [PATCH 2/2] fix LCO specific tests --- tom_observations/facilities/lco.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tom_observations/facilities/lco.py b/tom_observations/facilities/lco.py index 9e2b5cc30..358766547 100644 --- a/tom_observations/facilities/lco.py +++ b/tom_observations/facilities/lco.py @@ -660,8 +660,9 @@ def __init__(self, *args, **kwargs): label='Rotator Angle', required=False ) # Add None option and help text for SOAR Gratings - 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')) + 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):