From f1abec7714f10c08dc6bce6851f1208ae5c553eb Mon Sep 17 00:00:00 2001 From: Marco Rocchietti Date: Tue, 22 Oct 2024 13:08:53 -0300 Subject: [PATCH 01/20] Update configurations with default values applied by salobj.DefaultingValidator in BaseCalsys.load_calibration_config_file --- python/lsst/ts/observatory/control/base_calsys.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/lsst/ts/observatory/control/base_calsys.py b/python/lsst/ts/observatory/control/base_calsys.py index 5a5c1721..a0cc9cf5 100644 --- a/python/lsst/ts/observatory/control/base_calsys.py +++ b/python/lsst/ts/observatory/control/base_calsys.py @@ -240,7 +240,9 @@ def load_calibration_config_file(self, filename: str | None = None) -> None: validation_errors = "" for item in self.calibration_config: try: - config_validator.validate(self.calibration_config[item]) + self.calibration_config[item] = config_validator.validate( + self.calibration_config[item] + ) except jsonschema.ValidationError as e: validation_errors += f"\t{item} failed validation: {e.message}.\n" self.log.exception(f"{item} failed validation.") From 7715310e13335ace3a008f9604f67d8efcfea1c6 Mon Sep 17 00:00:00 2001 From: Marco Rocchietti Date: Thu, 24 Oct 2024 17:55:07 -0300 Subject: [PATCH 02/20] Remove attributes from atcalsys.yaml that match default values. --- .../lsst/ts/observatory/control/data/atcalsys.yaml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/python/lsst/ts/observatory/control/data/atcalsys.yaml b/python/lsst/ts/observatory/control/data/atcalsys.yaml index b0154c72..6f542359 100644 --- a/python/lsst/ts/observatory/control/data/atcalsys.yaml +++ b/python/lsst/ts/observatory/control/data/atcalsys.yaml @@ -44,7 +44,6 @@ at_whitelight_r: use_camera: true atspec_filter: SDSSr_65mm atspec_grating: empty_1 - wavelength: 500.0 monochromator_grating: MIRROR exit_slit: 5.0 entrance_slit: 5.0 @@ -83,10 +82,6 @@ ptc_1: use_electrometer: true atspec_filter: SDSSr_65mm atspec_grating: empty_1 - wavelength: 500.0 - monochromator_grating: null - exit_slit: 7.0 - entrance_slit: 7.0 electrometer_integration_time: 0.1 electrometer_mode: CURRENT electrometer_range: -1 @@ -167,10 +162,6 @@ ptc_2: use_electrometer: true atspec_filter: SDSSr_65mm atspec_grating: empty_1 - wavelength: 500.0 - monochromator_grating: null - exit_slit: 7.0 - entrance_slit: 7.0 electrometer_integration_time: 0.1 electrometer_mode: CURRENT electrometer_range: -1 @@ -250,10 +241,6 @@ ptc_3: use_electrometer: true atspec_filter: SDSSr_65mm atspec_grating: empty_1 - wavelength: 500.0 - monochromator_grating: null - exit_slit: 7.0 - entrance_slit: 7.0 electrometer_integration_time: 0.1 electrometer_mode: CURRENT electrometer_range: -1 From 4fdac1f5b84e8653fd84b04d0831092184105115 Mon Sep 17 00:00:00 2001 From: Marco Rocchietti Date: Thu, 24 Oct 2024 18:06:25 -0300 Subject: [PATCH 03/20] Add first round of new default values to atcalsys_schema.yaml and clean up atcalsys.yaml configs --- .../ts/observatory/control/data/atcalsys.yaml | 35 ------------------- .../control/data/atcalsys_schema.yaml | 8 +++++ 2 files changed, 8 insertions(+), 35 deletions(-) diff --git a/python/lsst/ts/observatory/control/data/atcalsys.yaml b/python/lsst/ts/observatory/control/data/atcalsys.yaml index 6f542359..cf7152c8 100644 --- a/python/lsst/ts/observatory/control/data/atcalsys.yaml +++ b/python/lsst/ts/observatory/control/data/atcalsys.yaml @@ -3,55 +3,35 @@ scan_g: calib_type: Mono - use_camera: true atspec_filter: SDSSg_65mm atspec_grating: empty_1 wavelength: 475.0 wavelength_width: 250 - wavelength_resolution: 5.0 monochromator_grating: RED exit_slit: 5.0 entrance_slit: 5.0 - electrometer_integration_time: 0.1 - electrometer_mode: CURRENT - electrometer_range: -1 - use_fiberspectrograph: true - use_electrometer: true exposure_times: - 15.0 scan_r: calib_type: Mono - use_camera: true atspec_filter: SDSSr_65mm atspec_grating: empty_1 wavelength: 625.0 wavelength_width: 250 - wavelength_resolution: 5.0 monochromator_grating: RED exit_slit: 5.0 entrance_slit: 5.0 - electrometer_integration_time: 0.1 - electrometer_mode: CURRENT - electrometer_range: -1 - use_fiberspectrograph: true - use_electrometer: true exposure_times: - 15.0 at_whitelight_r: calib_type: WhiteLight - use_camera: true atspec_filter: SDSSr_65mm atspec_grating: empty_1 monochromator_grating: MIRROR exit_slit: 5.0 entrance_slit: 5.0 - electrometer_integration_time: 0.1 - electrometer_mode: CURRENT - electrometer_range: -1 - use_fiberspectrograph: true - use_electrometer: true exposure_times: - 6.0 - 6.0 @@ -77,14 +57,9 @@ at_whitelight_r: ptc_1: calib_type: WhiteLight - use_camera: true use_fiberspectrograph: false - use_electrometer: true atspec_filter: SDSSr_65mm atspec_grating: empty_1 - electrometer_integration_time: 0.1 - electrometer_mode: CURRENT - electrometer_range: -1 exposure_times: - 14.40 - 14.40 @@ -157,14 +132,9 @@ ptc_1: ptc_2: calib_type: WhiteLight - use_camera: true use_fiberspectrograph: false - use_electrometer: true atspec_filter: SDSSr_65mm atspec_grating: empty_1 - electrometer_integration_time: 0.1 - electrometer_mode: CURRENT - electrometer_range: -1 exposure_times: - 15.35 - 15.35 @@ -236,14 +206,9 @@ ptc_2: ptc_3: calib_type: WhiteLight - use_camera: true use_fiberspectrograph: false - use_electrometer: true atspec_filter: SDSSr_65mm atspec_grating: empty_1 - electrometer_integration_time: 0.1 - electrometer_mode: CURRENT - electrometer_range: -1 exposure_times: - 0.52 - 0.52 diff --git a/python/lsst/ts/observatory/control/data/atcalsys_schema.yaml b/python/lsst/ts/observatory/control/data/atcalsys_schema.yaml index ef3d7821..c27ebb49 100644 --- a/python/lsst/ts/observatory/control/data/atcalsys_schema.yaml +++ b/python/lsst/ts/observatory/control/data/atcalsys_schema.yaml @@ -14,6 +14,7 @@ properties: use_camera: description: Indicates whether the operation requires a camera. type: boolean + default: true atspec_filter: description: Name of the filter to select for the spectrograph. type: string @@ -32,6 +33,7 @@ properties: monochromator for the flat-field calibration sequence when using monochromatic light. type: number + default: 0.0 wavelength_resolution: description: >- Optional. When using a monochromatic light source, it defines the @@ -39,6 +41,7 @@ properties: defined by `wavelength_width` and is centered around the `wavelength` attribute. type: number + default: 5.0 monochromator_grating: description: >- Select the grating of the monochromator that will be in the path of @@ -75,6 +78,7 @@ properties: (default) integration = 1PLC; High Accuracy integration=10PLC. Here the integration is set in seconds. type: number + default: 0.1 electrometer_mode: description: >- Set electrometer to use different modes. The units recorded will be Amps @@ -86,6 +90,7 @@ properties: - CHARGE - VOLTAGE - RESISTANCE + default: CURRENT electrometer_range: description: >- Set measurement range, which effects the accuracy of measurements and the @@ -99,14 +104,17 @@ properties: from 0 to 21e-3 Amps, Resistance from 0 to 100e18 Ohms, Charge from 0 to +2.1e-6 Coulombs. type: number + default: -1 use_fiberspectrograph: description: >- Identifies if the fiberspectrograph will be used in the exposure. type: boolean + default: true use_electrometer: description: >- Identifies if the electrometer will be used in the exposure. type: boolean + default: true exposure_times: description: >- List of Camera exposure times, in secs From 051fca41eee8a6dfdea3e7d0f4e163067d1eb594 Mon Sep 17 00:00:00 2001 From: Marco Rocchietti Date: Fri, 25 Oct 2024 14:06:14 -0300 Subject: [PATCH 04/20] Add logging for default values applied in BaseCalsys.load_calibration_config_file --- python/lsst/ts/observatory/control/base_calsys.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/python/lsst/ts/observatory/control/base_calsys.py b/python/lsst/ts/observatory/control/base_calsys.py index a0cc9cf5..fc0a75ef 100644 --- a/python/lsst/ts/observatory/control/base_calsys.py +++ b/python/lsst/ts/observatory/control/base_calsys.py @@ -238,7 +238,9 @@ def load_calibration_config_file(self, filename: str | None = None) -> None: config_validator = salobj.DefaultingValidator(schema=yaml.safe_load(f)) validation_errors = "" + log_defaults = "" for item in self.calibration_config: + config_original = dict(self.calibration_config[item]) try: self.calibration_config[item] = config_validator.validate( self.calibration_config[item] @@ -246,10 +248,17 @@ def load_calibration_config_file(self, filename: str | None = None) -> None: except jsonschema.ValidationError as e: validation_errors += f"\t{item} failed validation: {e.message}.\n" self.log.exception(f"{item} failed validation.") + config_with_defaults = self.calibration_config[item] + defaulted_attributes = set(config_with_defaults) - set(config_original) + log_defaults += f"\n{item}:\n" + "\n".join( + f" {attr}: {config_with_defaults[attr]}" + for attr in defaulted_attributes + ) if validation_errors: raise RuntimeError( f"Failed schema validation:\n{validation_errors}Check logs for more information." ) + self.log.debug(f"\n=== Applied Default Values ===\n{log_defaults}\n") def get_calibration_configuration(self, name: str) -> dict[str, typing.Any]: """Returns the configuration attributes given a configuration From 7785fb696bfe1f728915dd910cee8c806cfea084 Mon Sep 17 00:00:00 2001 From: Marco Rocchietti Date: Fri, 25 Oct 2024 14:25:49 -0300 Subject: [PATCH 05/20] Add second round of new default values to atcalsys_schema.yaml and clean up atcalsys.yaml configs --- .../lsst/ts/observatory/control/data/atcalsys.yaml | 14 -------------- .../observatory/control/data/atcalsys_schema.yaml | 3 +++ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/python/lsst/ts/observatory/control/data/atcalsys.yaml b/python/lsst/ts/observatory/control/data/atcalsys.yaml index cf7152c8..02b001fa 100644 --- a/python/lsst/ts/observatory/control/data/atcalsys.yaml +++ b/python/lsst/ts/observatory/control/data/atcalsys.yaml @@ -4,7 +4,6 @@ scan_g: calib_type: Mono atspec_filter: SDSSg_65mm - atspec_grating: empty_1 wavelength: 475.0 wavelength_width: 250 monochromator_grating: RED @@ -15,8 +14,6 @@ scan_g: scan_r: calib_type: Mono - atspec_filter: SDSSr_65mm - atspec_grating: empty_1 wavelength: 625.0 wavelength_width: 250 monochromator_grating: RED @@ -26,8 +23,6 @@ scan_r: - 15.0 at_whitelight_r: - calib_type: WhiteLight - atspec_filter: SDSSr_65mm atspec_grating: empty_1 monochromator_grating: MIRROR exit_slit: 5.0 @@ -56,10 +51,7 @@ at_whitelight_r: - 6.0 ptc_1: - calib_type: WhiteLight use_fiberspectrograph: false - atspec_filter: SDSSr_65mm - atspec_grating: empty_1 exposure_times: - 14.40 - 14.40 @@ -131,10 +123,7 @@ ptc_1: - 0.93 ptc_2: - calib_type: WhiteLight use_fiberspectrograph: false - atspec_filter: SDSSr_65mm - atspec_grating: empty_1 exposure_times: - 15.35 - 15.35 @@ -205,10 +194,7 @@ ptc_2: ptc_3: - calib_type: WhiteLight use_fiberspectrograph: false - atspec_filter: SDSSr_65mm - atspec_grating: empty_1 exposure_times: - 0.52 - 0.52 diff --git a/python/lsst/ts/observatory/control/data/atcalsys_schema.yaml b/python/lsst/ts/observatory/control/data/atcalsys_schema.yaml index c27ebb49..99e66027 100644 --- a/python/lsst/ts/observatory/control/data/atcalsys_schema.yaml +++ b/python/lsst/ts/observatory/control/data/atcalsys_schema.yaml @@ -11,6 +11,7 @@ properties: enum: - Mono - WhiteLight + default: WhiteLight use_camera: description: Indicates whether the operation requires a camera. type: boolean @@ -18,9 +19,11 @@ properties: atspec_filter: description: Name of the filter to select for the spectrograph. type: string + default: SDSSr_65mm atspec_grating: description: Name of the grating to select for the spectrograph. type: string + default: empty_1 wavelength: description: >- Center wavelength value in nm, used for configuring the monochromator From 22461227720c2fa8e755b141e76ebfb7c1c6f20b Mon Sep 17 00:00:00 2001 From: Marco Rocchietti Date: Fri, 25 Oct 2024 16:16:03 -0300 Subject: [PATCH 06/20] Add first round of new default values to mtcalsys_schema.yaml and clean up mtcalsys.yaml configs --- .../ts/observatory/control/data/mtcalsys.yaml | 49 ------------------- .../control/data/mtcalsys_schema.yaml | 7 +++ 2 files changed, 7 insertions(+), 49 deletions(-) diff --git a/python/lsst/ts/observatory/control/data/mtcalsys.yaml b/python/lsst/ts/observatory/control/data/mtcalsys.yaml index d7de56c2..fe295d35 100644 --- a/python/lsst/ts/observatory/control/data/mtcalsys.yaml +++ b/python/lsst/ts/observatory/control/data/mtcalsys.yaml @@ -3,25 +3,17 @@ whitelight_u: calib_type: WhiteLight - use_camera: true mtcamera_filter: u led_name: - M385L3 wavelength: 385.0 led_location: 210.21 led_focus: 50.68 - use_electrometer: true - use_fiberspectrograph_red: true - use_fiberspectrograph_blue: true - electrometer_integration_time: 0.1 - electrometer_mode: CURRENT - electrometer_range: -1 exposure_times: - 15.0 whitelight_g: calib_type: WhiteLight - use_camera: true mtcamera_filter: g led_name: - M455L4 @@ -29,18 +21,11 @@ whitelight_g: wavelength: 480.0 led_location: 9.15 led_focus: 17.029 - use_electrometer: true - use_fiberspectrograph_red: true - use_fiberspectrograph_blue: true - electrometer_integration_time: 0.1 - electrometer_mode: CURRENT - electrometer_range: -1 exposure_times: - 15.0 whitelight_r: calib_type: WhiteLight - use_camera: true mtcamera_filter: r led_name: - M565L3 @@ -48,18 +33,11 @@ whitelight_r: wavelength: 612.5 led_location: 70.40 led_focus: 16.279 - use_electrometer: true - use_fiberspectrograph_red: true - use_fiberspectrograph_blue: true - electrometer_integration_time: 0.1 - electrometer_mode: CURRENT - electrometer_range: -1 exposure_times: - 15.0 whitelight_i: calib_type: WhiteLight - use_camera: true mtcamera_filter: i led_name: - M730L5 @@ -67,18 +45,11 @@ whitelight_i: wavelength: 755.0 led_location: 237.36 led_focus: 15.829 - use_electrometer: true - use_fiberspectrograph_red: true - use_fiberspectrograph_blue: true - electrometer_integration_time: 0.1 - electrometer_mode: CURRENT - electrometer_range: -1 exposure_times: - 15.0 whitelight_z: calib_type: WhiteLight - use_camera: true mtcamera_filter: z led_name: - M850L3 @@ -86,47 +57,27 @@ whitelight_z: wavelength: 895.0 led_location: 299.034 led_focus: 15.505 - use_electrometer: true - use_fiberspectrograph_red: true - use_fiberspectrograph_blue: true - electrometer_integration_time: 0.1 - electrometer_mode: CURRENT - electrometer_range: -1 exposure_times: - 15.0 whitelight_y: calib_type: WhiteLight - use_camera: true mtcamera_filter: y led_name: - M970L4 wavelength: 970.0 led_location: 174.91 led_focus: 15.380 - use_electrometer: true - use_fiberspectrograph_red: true - use_fiberspectrograph_blue: true - electrometer_integration_time: 0.1 - electrometer_mode: CURRENT - electrometer_range: -1 exposure_times: - 15.0 scan_r: calib_type: Mono - use_camera: true mtcamera_filter: r led_location: 174.91 led_focus: 15.380 wavelength: 625.0 wavelength_width: 250 wavelength_resolution: 5.0 - use_electrometer: true - use_fiberspectrograph_red: true - use_fiberspectrograph_blue: true - electrometer_integration_time: 0.1 - electrometer_mode: CURRENT - electrometer_range: -1 exposure_times: - 15.0 diff --git a/python/lsst/ts/observatory/control/data/mtcalsys_schema.yaml b/python/lsst/ts/observatory/control/data/mtcalsys_schema.yaml index 27d6f56f..563779a3 100644 --- a/python/lsst/ts/observatory/control/data/mtcalsys_schema.yaml +++ b/python/lsst/ts/observatory/control/data/mtcalsys_schema.yaml @@ -14,6 +14,7 @@ properties: use_camera: description: Indicates whether the operation requires a camera. type: boolean + default: true mtcamera_filter: description: The filter name to install. type: string @@ -63,16 +64,19 @@ properties: use_electrometer: description: Identifies if the electrometer will be used in the exposure. type: boolean + default: true use_fiberspectrograph_red: description: >- Identifies if the fiberspectrograph for red color will be used in the exposure. type: boolean + default: true use_fiberspectrograph_blue: description: >- Identifies if the fiberspectrograph for blue color will be used in the exposure. type: boolean + default: true electrometer_integration_time: description: >- Integration time in seconds (166.67e-6 to 200e-3) for each sample. @@ -86,6 +90,7 @@ properties: (default) integration = 1PLC; High Accuracy integration=10PLC. Here the integration is set in seconds. type: number + default: 0.1 electrometer_mode: description: >- Set electrometer to use different modes. The units recorded will be Amps @@ -97,6 +102,7 @@ properties: - CHARGE - VOLTAGE - RESISTANCE + default: CURRENT electrometer_range: description: >- Set measurement range, which effects the accuracy of measurements and the @@ -110,6 +116,7 @@ properties: from 0 to 21e-3 Amps, Resistance from 0 to 100e18 Ohms, Charge from 0 to +2.1e-6 Coulombs. type: number + default: -1 exposure_times: description: List of Camera exposure times, in secs. type: array From a2c4bc182bdebe2636d2a0d88b4c3157a8900375 Mon Sep 17 00:00:00 2001 From: Marco Rocchietti Date: Fri, 25 Oct 2024 17:01:05 -0300 Subject: [PATCH 07/20] Add second round of new default values to mtcalsys_schema.yaml and clean up mtcalsys.yaml configs --- .../lsst/ts/observatory/control/data/mtcalsys.yaml | 12 ------------ .../ts/observatory/control/data/mtcalsys_schema.yaml | 4 ++++ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/python/lsst/ts/observatory/control/data/mtcalsys.yaml b/python/lsst/ts/observatory/control/data/mtcalsys.yaml index fe295d35..97c95218 100644 --- a/python/lsst/ts/observatory/control/data/mtcalsys.yaml +++ b/python/lsst/ts/observatory/control/data/mtcalsys.yaml @@ -2,7 +2,6 @@ # Created 2024-07-15 whitelight_u: - calib_type: WhiteLight mtcamera_filter: u led_name: - M385L3 @@ -13,7 +12,6 @@ whitelight_u: - 15.0 whitelight_g: - calib_type: WhiteLight mtcamera_filter: g led_name: - M455L4 @@ -25,8 +23,6 @@ whitelight_g: - 15.0 whitelight_r: - calib_type: WhiteLight - mtcamera_filter: r led_name: - M565L3 - M660L4 @@ -37,7 +33,6 @@ whitelight_r: - 15.0 whitelight_i: - calib_type: WhiteLight mtcamera_filter: i led_name: - M730L5 @@ -49,7 +44,6 @@ whitelight_i: - 15.0 whitelight_z: - calib_type: WhiteLight mtcamera_filter: z led_name: - M850L3 @@ -61,21 +55,15 @@ whitelight_z: - 15.0 whitelight_y: - calib_type: WhiteLight mtcamera_filter: y led_name: - M970L4 wavelength: 970.0 - led_location: 174.91 - led_focus: 15.380 exposure_times: - 15.0 scan_r: calib_type: Mono - mtcamera_filter: r - led_location: 174.91 - led_focus: 15.380 wavelength: 625.0 wavelength_width: 250 wavelength_resolution: 5.0 diff --git a/python/lsst/ts/observatory/control/data/mtcalsys_schema.yaml b/python/lsst/ts/observatory/control/data/mtcalsys_schema.yaml index 563779a3..71999181 100644 --- a/python/lsst/ts/observatory/control/data/mtcalsys_schema.yaml +++ b/python/lsst/ts/observatory/control/data/mtcalsys_schema.yaml @@ -11,6 +11,7 @@ properties: enum: - Mono - WhiteLight + default: WhiteLight use_camera: description: Indicates whether the operation requires a camera. type: boolean @@ -18,6 +19,7 @@ properties: mtcamera_filter: description: The filter name to install. type: string + default: r led_name: description: List of LED serial numbers to be turned on. type: array @@ -56,11 +58,13 @@ properties: Absolute distance to move the horizontal linear stage between LED modules, expressed in mm. type: number + default: 174.91 led_focus: description: >- Absolute distance in nm for the horizontal linear stage to move a lens to focus the laser light from the fiber. type: number + default: 15.380 use_electrometer: description: Identifies if the electrometer will be used in the exposure. type: boolean From eb635d8bdbad5ead6eaa53b4783e609c014c1002 Mon Sep 17 00:00:00 2001 From: Marco Rocchietti Date: Fri, 25 Oct 2024 17:05:15 -0300 Subject: [PATCH 08/20] Set default value for `wavelength` attribute in `mtcalsys_schema.yaml`. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Current configurations don’t share values for this attribute, so the default is set to 400.0 based on the `MTCalsys.prepare_for_flat` method, which uses this value. --- python/lsst/ts/observatory/control/data/mtcalsys_schema.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/python/lsst/ts/observatory/control/data/mtcalsys_schema.yaml b/python/lsst/ts/observatory/control/data/mtcalsys_schema.yaml index 71999181..5db4116d 100644 --- a/python/lsst/ts/observatory/control/data/mtcalsys_schema.yaml +++ b/python/lsst/ts/observatory/control/data/mtcalsys_schema.yaml @@ -40,6 +40,7 @@ properties: description: >- Center wavelength value in nm, used for configuring the Tunable Laser type: number + default: 400.0 wavelength_width: description: >- Optional. Defines the width of the wavelength scan range to configure the From e481e873c5867a79bb40e9cb0766b7fa16ea847d Mon Sep 17 00:00:00 2001 From: Marco Rocchietti Date: Fri, 25 Oct 2024 17:31:02 -0300 Subject: [PATCH 09/20] Add news fragments. --- doc/news/DM-46983.bugfix.rst | 1 + doc/news/DM-46983.feature.1.rst | 1 + doc/news/DM-46983.feature.2.rst | 1 + doc/news/DM-46983.feature.3.rst | 2 ++ doc/news/DM-46983.feature.4.rst | 2 ++ 5 files changed, 7 insertions(+) create mode 100644 doc/news/DM-46983.bugfix.rst create mode 100644 doc/news/DM-46983.feature.1.rst create mode 100644 doc/news/DM-46983.feature.2.rst create mode 100644 doc/news/DM-46983.feature.3.rst create mode 100644 doc/news/DM-46983.feature.4.rst diff --git a/doc/news/DM-46983.bugfix.rst b/doc/news/DM-46983.bugfix.rst new file mode 100644 index 00000000..640ab6ac --- /dev/null +++ b/doc/news/DM-46983.bugfix.rst @@ -0,0 +1 @@ +In ``BaseCalsys.load_calibration_config_file``, fix schema validation to update configurations with default values applied by ``salobj.DefaultingValidator``. diff --git a/doc/news/DM-46983.feature.1.rst b/doc/news/DM-46983.feature.1.rst new file mode 100644 index 00000000..645517da --- /dev/null +++ b/doc/news/DM-46983.feature.1.rst @@ -0,0 +1 @@ +Add new default values for ``ATCalsys`` configurations in ``atcalsys_schema.yaml``. diff --git a/doc/news/DM-46983.feature.2.rst b/doc/news/DM-46983.feature.2.rst new file mode 100644 index 00000000..40a25e37 --- /dev/null +++ b/doc/news/DM-46983.feature.2.rst @@ -0,0 +1 @@ +Cleanup of ``ATCalsys`` configuration file ``atcalsys.yaml`` by removing attributes that use default values. diff --git a/doc/news/DM-46983.feature.3.rst b/doc/news/DM-46983.feature.3.rst new file mode 100644 index 00000000..d40a303b --- /dev/null +++ b/doc/news/DM-46983.feature.3.rst @@ -0,0 +1,2 @@ +Add new default values for ``MTCalsys`` configurations in ``mtcalsys_schema.yaml``. + diff --git a/doc/news/DM-46983.feature.4.rst b/doc/news/DM-46983.feature.4.rst new file mode 100644 index 00000000..f3422032 --- /dev/null +++ b/doc/news/DM-46983.feature.4.rst @@ -0,0 +1,2 @@ +Cleanup of ``MTCalsys`` configuration file ``mtcalsys.yaml`` by removing attributes that use default values. + From c6228ad7b0d19eb087dda4d8e2a6981bb10f3ff8 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Thu, 24 Oct 2024 23:54:25 -0700 Subject: [PATCH 10/20] In maintel/mtcs.py, update close_mirror_covers to stop tracking before closing the covers. --- python/lsst/ts/observatory/control/maintel/mtcs.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/lsst/ts/observatory/control/maintel/mtcs.py b/python/lsst/ts/observatory/control/maintel/mtcs.py index 4d270fbb..5993e0de 100644 --- a/python/lsst/ts/observatory/control/maintel/mtcs.py +++ b/python/lsst/ts/observatory/control/maintel/mtcs.py @@ -793,6 +793,9 @@ async def close_m1_cover(self) -> None: If mirror covers state is neither DEPLOYED nor RETRACTED. If mirror system state is FAULT. """ + + await self.stop_tracking() + self.rem.mtmount.evt_mirrorCoversMotionState.flush() cover_state = await self.rem.mtmount.evt_mirrorCoversMotionState.aget( timeout=self.fast_timeout From 6d7875320a8b08103a9561757058f6a1ddabd664 Mon Sep 17 00:00:00 2001 From: gmegh Date: Sat, 26 Oct 2024 12:27:14 -0700 Subject: [PATCH 11/20] In maintel/comcam.py avoid filter change if filter is in place --- python/lsst/ts/observatory/control/maintel/comcam.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/lsst/ts/observatory/control/maintel/comcam.py b/python/lsst/ts/observatory/control/maintel/comcam.py index eb95455c..f6808860 100644 --- a/python/lsst/ts/observatory/control/maintel/comcam.py +++ b/python/lsst/ts/observatory/control/maintel/comcam.py @@ -204,8 +204,9 @@ async def setup_instrument(self, **kwargs: typing.Union[int, float, str]) -> Non """ self.check_kwargs(**kwargs) - if "filter" in kwargs and kwargs["filter"] is not None: - await self.setup_filter(filter=str(kwargs["filter"])) + filter_value = kwargs.get("filter", None) + if filter_value is not None and str(filter_value) != self.get_current_filter(): + await self.setup_filter(filter=str(filter_value)) async def setup_filter( self, filter: typing.Union[str, None] From 6c94f02072fc638b2e2fbe0758534f7c926bc29a Mon Sep 17 00:00:00 2001 From: gmegh Date: Sat, 26 Oct 2024 12:49:26 -0700 Subject: [PATCH 12/20] Add await to get_current_filter in setup_instrument --- python/lsst/ts/observatory/control/maintel/comcam.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/lsst/ts/observatory/control/maintel/comcam.py b/python/lsst/ts/observatory/control/maintel/comcam.py index f6808860..75ebbac7 100644 --- a/python/lsst/ts/observatory/control/maintel/comcam.py +++ b/python/lsst/ts/observatory/control/maintel/comcam.py @@ -205,7 +205,10 @@ async def setup_instrument(self, **kwargs: typing.Union[int, float, str]) -> Non self.check_kwargs(**kwargs) filter_value = kwargs.get("filter", None) - if filter_value is not None and str(filter_value) != self.get_current_filter(): + if ( + filter_value is not None + and str(filter_value) != await self.get_current_filter() + ): await self.setup_filter(filter=str(filter_value)) async def setup_filter( From b6ab47fa38f8748769f359c94055d0258ad9af9a Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Tue, 29 Oct 2024 15:04:30 -0700 Subject: [PATCH 13/20] In maintel/mtcs.py, update offset_camera_hexapod to use MTAOS offsetDOF to offset the camera hexapod. --- python/lsst/ts/observatory/control/maintel/mtcs.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/python/lsst/ts/observatory/control/maintel/mtcs.py b/python/lsst/ts/observatory/control/maintel/mtcs.py index 5993e0de..820c0d5a 100644 --- a/python/lsst/ts/observatory/control/maintel/mtcs.py +++ b/python/lsst/ts/observatory/control/maintel/mtcs.py @@ -2231,8 +2231,15 @@ async def offset_camera_hexapod( Should the hexapod movement be synchronized? Default True. """ - await self.rem.mthexapod_1.cmd_offset.set_start( - x=x, y=y, z=z, u=u, v=v, w=w, sync=sync, timeout=self.long_timeout + offset_dof_data = self.rem.mtaos.cmd_offsetDOF.DataType() + offset_dof_data.value[5] = -z + offset_dof_data.value[6] = -x + offset_dof_data.value[7] = y + offset_dof_data.value[8] = -u * 3600 + offset_dof_data.value[9] = -v * 3600 + + await self.rem.mtaos.cmd_offsetDOF.start( + data=offset_dof_data, timeout=self.long_timeout ) await self._handle_in_position( From 3acc92cd551dc2c70e68594c5a9c2df9e34c6c62 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Tue, 29 Oct 2024 15:05:09 -0700 Subject: [PATCH 14/20] In maintel/mtcs.py, update offset_m2_hexapod to use MTAOS offsetDOF to offset the m2 hexapod. --- python/lsst/ts/observatory/control/maintel/mtcs.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/python/lsst/ts/observatory/control/maintel/mtcs.py b/python/lsst/ts/observatory/control/maintel/mtcs.py index 820c0d5a..83fc4003 100644 --- a/python/lsst/ts/observatory/control/maintel/mtcs.py +++ b/python/lsst/ts/observatory/control/maintel/mtcs.py @@ -2281,8 +2281,15 @@ async def offset_m2_hexapod( Should the hexapod movement be synchronized? Default True. """ - await self.rem.mthexapod_2.cmd_offset.set_start( - x=x, y=y, z=z, u=u, v=v, w=w, sync=sync, timeout=self.long_timeout + offset_dof_data = self.rem.mtaos.cmd_offsetDOF.DataType() + offset_dof_data.value[0] = -z + offset_dof_data.value[1] = x + offset_dof_data.value[2] = -y + offset_dof_data.value[3] = -u * 3600 + offset_dof_data.value[4] = -v * 3600 + + await self.rem.mtaos.cmd_offsetDOF.start( + data=offset_dof_data, timeout=self.long_timeout ) await self._handle_in_position( From 096c59fdb00fe4cb805f863fefb34f54c7ae4285 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Tue, 29 Oct 2024 23:36:55 -0700 Subject: [PATCH 15/20] In maintel/mtcs.py, update flush_offset_events and offset_done method to take rotator into account. --- python/lsst/ts/observatory/control/maintel/mtcs.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/lsst/ts/observatory/control/maintel/mtcs.py b/python/lsst/ts/observatory/control/maintel/mtcs.py index 83fc4003..b6424df1 100644 --- a/python/lsst/ts/observatory/control/maintel/mtcs.py +++ b/python/lsst/ts/observatory/control/maintel/mtcs.py @@ -977,10 +977,14 @@ def flush_offset_events(self) -> None: """Abstract method to flush events before and offset is performed.""" self.rem.mtmount.evt_elevationInPosition.flush() self.rem.mtmount.evt_azimuthInPosition.flush() + self.rem.mtrotator.evt_inPosition.flush() async def offset_done(self) -> None: """Wait for offset events.""" - await self.wait_for_mtmount_inposition(timeout=self.tel_settle_time) + await asyncio.gather( + self.wait_for_mtmount_inposition(timeout=self.tel_settle_time), + self.wait_for_rotator_inposition(timeout=self.long_long_timeout), + ) async def get_bore_sight_angle(self) -> float: """Get the instrument bore sight angle with respect to the telescope From fa4f17f57e9de29b5f3ba94769ae080cc211d6eb Mon Sep 17 00:00:00 2001 From: gmegh Date: Thu, 31 Oct 2024 18:04:33 -0700 Subject: [PATCH 16/20] Fix MTCS offset_m2_hexapod decentering signs --- python/lsst/ts/observatory/control/maintel/mtcs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/lsst/ts/observatory/control/maintel/mtcs.py b/python/lsst/ts/observatory/control/maintel/mtcs.py index b6424df1..72fb8f8d 100644 --- a/python/lsst/ts/observatory/control/maintel/mtcs.py +++ b/python/lsst/ts/observatory/control/maintel/mtcs.py @@ -2287,8 +2287,8 @@ async def offset_m2_hexapod( offset_dof_data = self.rem.mtaos.cmd_offsetDOF.DataType() offset_dof_data.value[0] = -z - offset_dof_data.value[1] = x - offset_dof_data.value[2] = -y + offset_dof_data.value[1] = -x + offset_dof_data.value[2] = y offset_dof_data.value[3] = -u * 3600 offset_dof_data.value[4] = -v * 3600 From 294555aaacffb915954cbb69f81d77ab0f3ea515 Mon Sep 17 00:00:00 2001 From: gmegh Date: Thu, 31 Oct 2024 19:40:21 -0700 Subject: [PATCH 17/20] Remove sign flips and arcsec conversion from offset_hexapod functions --- .../lsst/ts/observatory/control/maintel/mtcs.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/python/lsst/ts/observatory/control/maintel/mtcs.py b/python/lsst/ts/observatory/control/maintel/mtcs.py index 72fb8f8d..136b1bdb 100644 --- a/python/lsst/ts/observatory/control/maintel/mtcs.py +++ b/python/lsst/ts/observatory/control/maintel/mtcs.py @@ -2236,11 +2236,11 @@ async def offset_camera_hexapod( """ offset_dof_data = self.rem.mtaos.cmd_offsetDOF.DataType() - offset_dof_data.value[5] = -z - offset_dof_data.value[6] = -x + offset_dof_data.value[5] = z + offset_dof_data.value[6] = x offset_dof_data.value[7] = y - offset_dof_data.value[8] = -u * 3600 - offset_dof_data.value[9] = -v * 3600 + offset_dof_data.value[8] = u + offset_dof_data.value[9] = v await self.rem.mtaos.cmd_offsetDOF.start( data=offset_dof_data, timeout=self.long_timeout @@ -2286,11 +2286,11 @@ async def offset_m2_hexapod( """ offset_dof_data = self.rem.mtaos.cmd_offsetDOF.DataType() - offset_dof_data.value[0] = -z - offset_dof_data.value[1] = -x + offset_dof_data.value[0] = z + offset_dof_data.value[1] = x offset_dof_data.value[2] = y - offset_dof_data.value[3] = -u * 3600 - offset_dof_data.value[4] = -v * 3600 + offset_dof_data.value[3] = u + offset_dof_data.value[4] = v await self.rem.mtaos.cmd_offsetDOF.start( data=offset_dof_data, timeout=self.long_timeout From 41a846a665e1b48445b1646eca009eb32ddaf1a1 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Mon, 4 Nov 2024 15:47:07 -0700 Subject: [PATCH 18/20] Update mock/mtcs_async_mock to mock the MTAOS offsetDOF command. --- .../control/mock/mtcs_async_mock.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/python/lsst/ts/observatory/control/mock/mtcs_async_mock.py b/python/lsst/ts/observatory/control/mock/mtcs_async_mock.py index fe7b2ac7..4950908f 100644 --- a/python/lsst/ts/observatory/control/mock/mtcs_async_mock.py +++ b/python/lsst/ts/observatory/control/mock/mtcs_async_mock.py @@ -201,6 +201,7 @@ async def setup_mocks(self) -> None: await self.setup_mtm2() await self.setup_mthexapod_1() await self.setup_mthexapod_2() + await self.setup_mtaos() async def setup_mtmount(self) -> None: """Augment MTMount.""" @@ -385,6 +386,18 @@ async def setup_mthexapod_2(self) -> None: self.mtcs.rem.mthexapod_2.configure_mock(**hexapod_2_mocks) + async def setup_mtaos(self) -> None: + + offset_dof_field_info = self.get_sample("MTAOS", "cmd_offsetDOF") + mtaos_mocks = { + "cmd_offsetDOF.DataType.return_value": types.SimpleNamespace( + value=np.zeros(offset_dof_field_info.value.count) + ), + "cmd_offsetDOF.start.side_effect": self.mtaos_cmd_offset_dof, + } + + self.mtcs.rem.mtaos.configure_mock(**mtaos_mocks) + async def mtmount_evt_target_next( self, *args: typing.Any, **kwargs: typing.Any ) -> types.SimpleNamespace: @@ -1032,6 +1045,31 @@ async def mthexapod_1_cmd_offset( ) await asyncio.sleep(self.short_process_time) + async def mtaos_cmd_offset_dof( + self, *args: typing.Any, **kwargs: typing.Any + ) -> None: + self.log.info(f"{kwargs=}") + await self.mtcs.rem.mthexapod_1.cmd_move.set_start( + x=kwargs["data"].value[6], + y=kwargs["data"].value[7], + z=kwargs["data"].value[5], + u=kwargs["data"].value[8], + v=kwargs["data"].value[9], + w=0, + sync=True, + timeout=kwargs["timeout"], + ) + await self.mtcs.rem.mthexapod_2.cmd_move.set_start( + x=kwargs["data"].value[1], + y=kwargs["data"].value[2], + z=kwargs["data"].value[0], + u=kwargs["data"].value[3], + v=kwargs["data"].value[4], + w=0, + sync=True, + timeout=kwargs["timeout"], + ) + async def mthexapod_2_cmd_offset( self, *args: typing.Any, **kwargs: typing.Any ) -> None: From 3695999d507bdb9f9f706a5d23c43d64c3ee17a6 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Mon, 4 Nov 2024 15:48:28 -0700 Subject: [PATCH 19/20] Update MTCS unit tests form offset_camera_hexapod and offset_m2_hexapod to account now for the use of offsetDOF. --- tests/maintel/test_mtcs.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/maintel/test_mtcs.py b/tests/maintel/test_mtcs.py index 47696dd2..fa1a5530 100644 --- a/tests/maintel/test_mtcs.py +++ b/tests/maintel/test_mtcs.py @@ -2016,7 +2016,7 @@ async def test_offset_camera_hexapod(self) -> None: == hexapod_positions[axis] ) - self.mtcs.rem.mthexapod_1.cmd_offset.set_start.assert_awaited_with( + self.mtcs.rem.mthexapod_1.cmd_move.set_start.assert_awaited_with( **hexapod_positions, w=0.0, sync=True, timeout=self.mtcs.long_timeout ) @@ -2027,9 +2027,7 @@ async def test_offset_camera_hexapod(self) -> None: ) self.mtcs.rem.mthexapod_1.evt_inPosition.flush.assert_called() - self.mtcs.rem.mthexapod_1.evt_inPosition.next.assert_awaited_with( - timeout=self.mtcs.long_timeout, flush=False - ) + self.mtcs.rem.mthexapod_1.evt_inPosition.next.assert_awaited() async def test_offset_m2_hexapod(self) -> None: hexapod_positions = dict([(axis, np.random.rand()) for axis in "xyzuv"]) @@ -2042,7 +2040,7 @@ async def test_offset_m2_hexapod(self) -> None: == hexapod_positions[axis] ) - self.mtcs.rem.mthexapod_2.cmd_offset.set_start.assert_awaited_with( + self.mtcs.rem.mthexapod_2.cmd_move.set_start.assert_awaited_with( **hexapod_positions, w=0.0, sync=True, timeout=self.mtcs.long_timeout ) @@ -2053,9 +2051,7 @@ async def test_offset_m2_hexapod(self) -> None: ) self.mtcs.rem.mthexapod_2.evt_inPosition.flush.assert_called() - self.mtcs.rem.mthexapod_2.evt_inPosition.next.assert_awaited_with( - timeout=self.mtcs.long_timeout, flush=False - ) + self.mtcs.rem.mthexapod_2.evt_inPosition.next.assert_awaited() async def test_reset_camera_hexapod_position(self) -> None: self._mthexapod_1_evt_uncompensated_position.z = 10.0 From 07729ba36c8473936b8dcb8bbe834a8325219a27 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Mon, 4 Nov 2024 13:08:23 -0700 Subject: [PATCH 20/20] Add news fragments. --- doc/news/DM-46978.feature.1.rst | 1 + doc/news/DM-46978.feature.2.rst | 1 + doc/news/DM-46978.feature.3.rst | 1 + doc/news/DM-46978.feature.4.rst | 1 + doc/news/DM-46978.feature.5.rst | 1 + doc/news/DM-46978.feature.6.rst | 1 + doc/news/DM-46978.feature.rst | 1 + 7 files changed, 7 insertions(+) create mode 100644 doc/news/DM-46978.feature.1.rst create mode 100644 doc/news/DM-46978.feature.2.rst create mode 100644 doc/news/DM-46978.feature.3.rst create mode 100644 doc/news/DM-46978.feature.4.rst create mode 100644 doc/news/DM-46978.feature.5.rst create mode 100644 doc/news/DM-46978.feature.6.rst create mode 100644 doc/news/DM-46978.feature.rst diff --git a/doc/news/DM-46978.feature.1.rst b/doc/news/DM-46978.feature.1.rst new file mode 100644 index 00000000..ae40aa34 --- /dev/null +++ b/doc/news/DM-46978.feature.1.rst @@ -0,0 +1 @@ +In maintel/comcam.py avoid filter change if filter is in place. \ No newline at end of file diff --git a/doc/news/DM-46978.feature.2.rst b/doc/news/DM-46978.feature.2.rst new file mode 100644 index 00000000..b923c577 --- /dev/null +++ b/doc/news/DM-46978.feature.2.rst @@ -0,0 +1 @@ +In maintel/mtcs.py, update offset_camera_hexapod to use MTAOS offsetDOF to offset the camera hexapod. \ No newline at end of file diff --git a/doc/news/DM-46978.feature.3.rst b/doc/news/DM-46978.feature.3.rst new file mode 100644 index 00000000..d02f282f --- /dev/null +++ b/doc/news/DM-46978.feature.3.rst @@ -0,0 +1 @@ +In maintel/mtcs.py, update offset_m2_hexapod to use MTAOS offsetDOF to offset the m2 hexapod. \ No newline at end of file diff --git a/doc/news/DM-46978.feature.4.rst b/doc/news/DM-46978.feature.4.rst new file mode 100644 index 00000000..2654992c --- /dev/null +++ b/doc/news/DM-46978.feature.4.rst @@ -0,0 +1 @@ +In maintel/mtcs.py, update flush_offset_events and offset_done method to take rotator into account. \ No newline at end of file diff --git a/doc/news/DM-46978.feature.5.rst b/doc/news/DM-46978.feature.5.rst new file mode 100644 index 00000000..cc4fab9a --- /dev/null +++ b/doc/news/DM-46978.feature.5.rst @@ -0,0 +1 @@ +Fix MTCS offset_m2_hexapod decentering signs. \ No newline at end of file diff --git a/doc/news/DM-46978.feature.6.rst b/doc/news/DM-46978.feature.6.rst new file mode 100644 index 00000000..10ff488a --- /dev/null +++ b/doc/news/DM-46978.feature.6.rst @@ -0,0 +1 @@ +Remove sign flips and arcsec conversion from offset_hexapod functions. \ No newline at end of file diff --git a/doc/news/DM-46978.feature.rst b/doc/news/DM-46978.feature.rst new file mode 100644 index 00000000..8eeeadce --- /dev/null +++ b/doc/news/DM-46978.feature.rst @@ -0,0 +1 @@ +In maintel/mtcs.py, update close_mirror_covers to stop tracking before closing the covers. \ No newline at end of file