From ada8a1b93206a93b90315e91c0791167c8984f32 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Mon, 4 Nov 2024 19:32:11 -0700 Subject: [PATCH 01/12] In maintel/take_aos_sequence_comcam, fix ready_to_take_data. --- .../lsst/ts/standardscripts/maintel/take_aos_sequence_comcam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/lsst/ts/standardscripts/maintel/take_aos_sequence_comcam.py b/python/lsst/ts/standardscripts/maintel/take_aos_sequence_comcam.py index 1802f9ace..46ed26dc4 100644 --- a/python/lsst/ts/standardscripts/maintel/take_aos_sequence_comcam.py +++ b/python/lsst/ts/standardscripts/maintel/take_aos_sequence_comcam.py @@ -218,7 +218,7 @@ async def configure_camera(self) -> None: self.domain, log=self.log, intended_usage=ComCamUsages.TakeImage + ComCamUsages.StateTransition, - tcs_ready_to_take_data=self.mtcs.tcs_ready_to_take_data, + tcs_ready_to_take_data=self.mtcs.ready_to_take_data, ) await self.camera.start_task else: From 02752e18ce15bf33ede4b00705f7a3cb9b67e523 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Mon, 4 Nov 2024 19:36:56 -0700 Subject: [PATCH 02/12] In maintel/take_aos_sequence_comcam, use all topics from the camera. --- .../ts/standardscripts/maintel/take_aos_sequence_comcam.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/lsst/ts/standardscripts/maintel/take_aos_sequence_comcam.py b/python/lsst/ts/standardscripts/maintel/take_aos_sequence_comcam.py index 46ed26dc4..5a8eb7726 100644 --- a/python/lsst/ts/standardscripts/maintel/take_aos_sequence_comcam.py +++ b/python/lsst/ts/standardscripts/maintel/take_aos_sequence_comcam.py @@ -28,7 +28,7 @@ import yaml from lsst.ts import salobj -from lsst.ts.observatory.control.maintel.comcam import ComCam, ComCamUsages +from lsst.ts.observatory.control.maintel.comcam import ComCam from lsst.ts.observatory.control.maintel.mtcs import MTCS from ..base_block_script import BaseBlockScript @@ -217,7 +217,6 @@ async def configure_camera(self) -> None: self.camera = ComCam( self.domain, log=self.log, - intended_usage=ComCamUsages.TakeImage + ComCamUsages.StateTransition, tcs_ready_to_take_data=self.mtcs.ready_to_take_data, ) await self.camera.start_task From 74ea92075e13732cd0578cc21895bd4209303fbc Mon Sep 17 00:00:00 2001 From: edennihy Date: Tue, 12 Nov 2024 21:31:54 -0700 Subject: [PATCH 03/12] In ``track_target_and_take_image_comcam.py``, add StateTransition usages to MTCS and ComCam Usages. --- .../maintel/track_target_and_take_image_comcam.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_comcam.py b/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_comcam.py index ab4ca3268..71edde5a2 100644 --- a/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_comcam.py +++ b/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_comcam.py @@ -51,7 +51,10 @@ def __init__(self, index, add_remotes: bool = True): ) mtcs_usage, comcam_usage = ( - (MTCSUsages.Slew, ComCamUsages.TakeImageFull) + ( + MTCSUsages.Slew | MTCSUsages.StateTransition, + ComCamUsages.TakeImageFull | ComCamUsages.StateTransition, + ) if add_remotes else (MTCSUsages.DryTest, ComCamUsages.DryTest) ) @@ -69,9 +72,9 @@ def tcs(self): @classmethod def get_schema(cls): schema_dict = cls.get_base_schema() - schema_dict["$id"] = ( - "https://github.com/lsst-ts/ts_standardscripts/maintel/track_target_and_take_image_comcam.py" - ) + schema_dict[ + "$id" + ] = "https://github.com/lsst-ts/ts_standardscripts/maintel/track_target_and_take_image_comcam.py" schema_dict["title"] = "TrackTargetAndTakeImageComCam v1" schema_dict["description"] = "Configuration for TrackTargetAndTakeImageComCam." From 904d9d73c4d248765ca1ec4193b2dc76e798569f Mon Sep 17 00:00:00 2001 From: edennihy Date: Tue, 12 Nov 2024 21:55:16 -0700 Subject: [PATCH 04/12] Add instrument name to metadata for ``base_track_target_and_take_image.py`` and propagate to instrument scripts. --- .../auxtel/track_target_and_take_image.py | 5 +++++ .../base_track_target_and_take_image.py | 11 +++++++++++ .../maintel/track_target_and_take_image_comcam.py | 5 +++++ .../maintel/track_target_and_take_image_gencam.py | 5 +++++ 4 files changed, 26 insertions(+) diff --git a/python/lsst/ts/standardscripts/auxtel/track_target_and_take_image.py b/python/lsst/ts/standardscripts/auxtel/track_target_and_take_image.py index 7b24d4fd0..f886f4c82 100644 --- a/python/lsst/ts/standardscripts/auxtel/track_target_and_take_image.py +++ b/python/lsst/ts/standardscripts/auxtel/track_target_and_take_image.py @@ -58,6 +58,8 @@ def __init__(self, index, add_remotes: bool = True): self.atcs = ATCS(self.domain, intended_usage=atcs_usage, log=self.log) self.latiss = LATISS(self.domain, intended_usage=latiss_usage, log=self.log) + self.instrument_name = "LATISS" + @property def tcs(self): return self.atcs @@ -105,6 +107,9 @@ def get_schema(cls): return schema_dict + def get_instrument_name(self): + return self.instrument_name + async def configure(self, config): """Configure the script. diff --git a/python/lsst/ts/standardscripts/base_track_target_and_take_image.py b/python/lsst/ts/standardscripts/base_track_target_and_take_image.py index 9223e8d47..8ece4c3df 100644 --- a/python/lsst/ts/standardscripts/base_track_target_and_take_image.py +++ b/python/lsst/ts/standardscripts/base_track_target_and_take_image.py @@ -202,6 +202,7 @@ def set_metadata(self, metadata): metadata.nimages = self.config.num_exp metadata.survey = self.config.program metadata.totalCheckpoints = 3 if self.config.camera_playlist is None else 4 + metadata.instrument = self.get_instrument_name() def get_estimated_time_on_target(self): """Get the estimated time on target. @@ -287,6 +288,16 @@ async def stop_tracking(self): """Implement method to stop tracking.""" raise RuntimeError() + @abc.abstractmethod + def get_instrument_name(self): + """Get instrument name. + + Returns + ------- + instrument_name: `string` + """ + raise NotImplementedError() + async def cleanup(self): if self.state.state != ScriptState.ENDING: # abnormal termination diff --git a/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_comcam.py b/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_comcam.py index 71edde5a2..6fa89dadc 100644 --- a/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_comcam.py +++ b/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_comcam.py @@ -65,6 +65,8 @@ def __init__(self, index, add_remotes: bool = True): self.mtcs = MTCS(self.domain, intended_usage=mtcs_usage, log=self.log) self.comcam = ComCam(self.domain, intended_usage=comcam_usage, log=self.log) + self.instrument_name = "LSSTComCam" + @property def tcs(self): return self.mtcs @@ -80,6 +82,9 @@ def get_schema(cls): return schema_dict + def get_instrument_name(self): + return self.instrument_name + async def load_playlist(self): """Load playlist.""" await self.comcam.rem.cccamera.cmd_play.set_start( diff --git a/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_gencam.py b/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_gencam.py index bb01baaf4..c3f999e5e 100644 --- a/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_gencam.py +++ b/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_gencam.py @@ -107,6 +107,8 @@ def __init__(self, index, add_remotes: bool = True): self.gencam = None + self.instrument_name = "GenCam" + @property def tcs(self): return self.mtcs @@ -126,6 +128,9 @@ async def assert_feasibility(self): *(gencam.assert_liveliness() for gencam in self.gencam), ) + def get_instrument_name(self): + return self.instrument_name + async def configure(self, config): await super().configure(config) From 5b5d007950656262ea883425eebcc61724053e78 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Wed, 13 Nov 2024 16:09:13 -0700 Subject: [PATCH 05/12] In base_track_target, add log to debug check feature. --- python/lsst/ts/standardscripts/base_track_target.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/lsst/ts/standardscripts/base_track_target.py b/python/lsst/ts/standardscripts/base_track_target.py index 9224f3f02..7909594c2 100644 --- a/python/lsst/ts/standardscripts/base_track_target.py +++ b/python/lsst/ts/standardscripts/base_track_target.py @@ -381,6 +381,8 @@ async def configure(self, config): else: self.log.debug(f"Ignoring component {comp}.") setattr(self.tcs.check, comp, False) + else: + self.log.info(f"Not ignoring TCS components: {self.tcs.components_attr}.") await super().configure(config=config) From 2b2c96c0825a7cf4100ad76e176502e4f638c5f0 Mon Sep 17 00:00:00 2001 From: edennihy Date: Fri, 15 Nov 2024 08:25:52 -0700 Subject: [PATCH 06/12] In base_track_target_and_take_image.py, add support for single filters or array of filters in metadata. --- .../ts/standardscripts/base_track_target_and_take_image.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/lsst/ts/standardscripts/base_track_target_and_take_image.py b/python/lsst/ts/standardscripts/base_track_target_and_take_image.py index 8ece4c3df..1eb8dfcc4 100644 --- a/python/lsst/ts/standardscripts/base_track_target_and_take_image.py +++ b/python/lsst/ts/standardscripts/base_track_target_and_take_image.py @@ -197,7 +197,11 @@ def set_metadata(self, metadata): metadata.position = [radec_icrs.ra.deg, radec_icrs.dec.deg] metadata.rotationSystem = MetadataRotSys.SKY metadata.cameraAngle = self.config.rot_sky - metadata.filters = ",".join(self.config.band_filter) + metadata.filters = ( + self.config.band_filter + if isinstance(self.config.band_filter, str) + else ",".join(self.config.band_filter) + ) metadata.dome = MetadataDome.OPEN metadata.nimages = self.config.num_exp metadata.survey = self.config.program From 651c1ce6fb6bf92510c5914e8a3dd9269979d199 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Sat, 16 Nov 2024 11:02:16 -0700 Subject: [PATCH 07/12] In maintel/track_target_and_take_image_comcam.py, simplify the _handle_slew_and_change_filter to wait for the slew to finish (when bringing rotator to zero) before changing the filter. --- .../track_target_and_take_image_comcam.py | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_comcam.py b/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_comcam.py index 6fa89dadc..6e6a41a81 100644 --- a/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_comcam.py +++ b/python/lsst/ts/standardscripts/maintel/track_target_and_take_image_comcam.py @@ -74,9 +74,9 @@ def tcs(self): @classmethod def get_schema(cls): schema_dict = cls.get_base_schema() - schema_dict[ - "$id" - ] = "https://github.com/lsst-ts/ts_standardscripts/maintel/track_target_and_take_image_comcam.py" + schema_dict["$id"] = ( + "https://github.com/lsst-ts/ts_standardscripts/maintel/track_target_and_take_image_comcam.py" + ) schema_dict["title"] = "TrackTargetAndTakeImageComCam v1" schema_dict["description"] = "Configuration for TrackTargetAndTakeImageComCam." @@ -136,22 +136,15 @@ async def _handle_slew_and_change_filter(self): it there while the filter is changing. """ - tasks_slew_with_fixed_rot = [ - asyncio.create_task( - self.mtcs.slew_icrs( - ra=self.config.ra, - dec=self.config.dec, - rot=self.angle_filter_change, - rot_type=RotType.Physical, - target_name=f"{self.config.name} - filter change", - az_wrap_strategy=self.config.az_wrap_strategy, - time_on_target=self.get_estimated_time_on_target(), - ) - ), - asyncio.create_task(self._wait_rotator_reach_filter_change_angle()), - ] - - await self.mtcs.process_as_completed(tasks_slew_with_fixed_rot) + await self.mtcs.slew_icrs( + ra=self.config.ra, + dec=self.config.dec, + rot=self.angle_filter_change, + rot_type=RotType.Physical, + target_name=f"{self.config.name} - filter change", + az_wrap_strategy=self.config.az_wrap_strategy, + time_on_target=self.get_estimated_time_on_target(), + ) await self.comcam.setup_filter(filter=self.config.band_filter) From 3df40ab3cf194dc9793570598d08d7e10ec78e24 Mon Sep 17 00:00:00 2001 From: gmegh Date: Sat, 16 Nov 2024 18:58:33 -0300 Subject: [PATCH 08/12] Add gain_sequence to base_close_loop.py --- .../maintel/base_close_loop.py | 61 +++++++++++++++++-- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/python/lsst/ts/standardscripts/maintel/base_close_loop.py b/python/lsst/ts/standardscripts/maintel/base_close_loop.py index 10fc9248e..15b60ff24 100644 --- a/python/lsst/ts/standardscripts/maintel/base_close_loop.py +++ b/python/lsst/ts/standardscripts/maintel/base_close_loop.py @@ -84,6 +84,7 @@ def __init__(self, index=1, descr="") -> None: # exposure time for the intra/extra images (in seconds) self.exposure_time = None + self.n_images = 9 # Define operation mode handler function self.operation_model_handlers = { @@ -203,6 +204,15 @@ def get_schema(cls) -> typing.Dict[str, typing.Any]: type: string enum: {[dof_name.name for dof_name in DOFName]} default: [1, 2, 3, 4, 5] + gain_sequence: + description: >- + Gain sequence to apply to the offsets. + oneOf: + - type: array + items: + type: number + - type: number + default: 0 apply_corrections: description: >- Apply OFC corrections after each iteration. @@ -274,6 +284,8 @@ async def configure(self, config: types.SimpleNamespace) -> None: # Set apply_corrections self.apply_corrections = config.apply_corrections + self.gain_sequence = config.gain_sequence + for comp in getattr(config, "ignore", []): if comp not in self.mtcs.components_attr: self.log.warning( @@ -363,13 +375,26 @@ async def take_intra_extra_focal_images( note=self.note, ) - task1 = self.oods.evt_imageInOODS.next(flush=False, timeout=self.exposure_time) + task1 = self.wait_for_images_in_oods() # Move the hexapod back to in focus position task2 = self.mtcs.offset_camera_hexapod(x=0, y=0, z=-self.dz, u=0, v=0) await asyncio.gather(task1, task2) return intra_image, extra_image + async def wait_for_images_in_oods(self): + + for _ in range(self.n_images): + try: + image_in_oods = await self.oods.evt_imageInOODS.next( + flush=False, timeout=self.exposure_time + ) + self.log.info( + f"Image {image_in_oods.obsid} {image_in_oods.raft} {image_in_oods.sensor} ingested." + ) + except asyncio.TimeoutError: + self.log.warning("Timeout waiting for images in OODS.") + async def handle_fam_mode(self) -> None: """Handle Full Array Mode.""" @@ -422,13 +447,15 @@ async def handle_cwfs_mode(self) -> None: visitId=visit_id, timeout=2 * CMD_TIMEOUT, config=self.wep_config ) - async def compute_ofc_offsets(self, rotation_angle: float) -> None: + async def compute_ofc_offsets(self, rotation_angle: float, gain: float) -> None: """Compute offsets using ts_ofc. Parameters ---------- rotation_angle : `float` Rotation angle of the camera in deg. + gain : `float` + Gain to apply to the offsets. """ # Create the config to run OFC config = { @@ -445,7 +472,7 @@ async def compute_ofc_offsets(self, rotation_angle: float) -> None: # Run OFC await self.mtcs.rem.mtaos.cmd_runOFC.set_start( - config=config_yaml, timeout=CMD_TIMEOUT + config=config_yaml, timeout=CMD_TIMEOUT, userGain=gain ) # Return offsets @@ -453,6 +480,30 @@ async def compute_ofc_offsets(self, rotation_angle: float) -> None: flush=False, timeout=STD_TIMEOUT ) + def get_gain(self, iteration: int) -> float: + """Get the gain to apply to the offsets. + + Parameters + ---------- + iteration : `int` + Iteration number. + + Returns + ------- + gain : `float` + Gain to apply to the offsets. + """ + if isinstance(self.gain_sequence, float) or isinstance(self.gain_sequence, int): + return float(self.gain_sequence) + else: + if iteration >= len(self.gain_sequence): + self.log.warning( + "Iteration is greater than the length of the gain sequence. " + "Using the last value of the gains sequence." + ) + return self.gain_sequence[-1] + return self.gain_sequence[iteration] + async def arun(self, checkpoint: bool = False) -> None: """Perform wavefront error measurements and DOF adjustments until the thresholds are reached. @@ -509,7 +560,9 @@ async def arun(self, checkpoint: bool = False) -> None: ) # Compute ts_ofc offsets - dof_offset = await self.compute_ofc_offsets(rotation_angle) + dof_offset = await self.compute_ofc_offsets( + rotation_angle, self.get_gain(i) + ) # If apply_corrections is true, # then we apply the corrections From 51abfcfcf277df03916a8561ef9f04f393b288f1 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Sat, 16 Nov 2024 19:01:30 -0700 Subject: [PATCH 09/12] In maintel/take_aos_sequence_comcam.py, wait for all images to be ingested before starting OCPS process. --- .../maintel/take_aos_sequence_comcam.py | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/python/lsst/ts/standardscripts/maintel/take_aos_sequence_comcam.py b/python/lsst/ts/standardscripts/maintel/take_aos_sequence_comcam.py index 5a8eb7726..1fcc77fd1 100644 --- a/python/lsst/ts/standardscripts/maintel/take_aos_sequence_comcam.py +++ b/python/lsst/ts/standardscripts/maintel/take_aos_sequence_comcam.py @@ -66,6 +66,7 @@ def __init__(self, index, descr="Take AOS sequence with ComCam.") -> None: self.camera = None self.ocps = None self.current_z_position = 0 + self.n_images = 9 @classmethod def get_schema(cls) -> dict: @@ -289,9 +290,32 @@ async def take_aos_sequence(self) -> None: if self.mode == Mode.TRIPLET: self.log.debug("Waiting for images to be ingested in OODS.") - await self.camera.rem.ccoods.evt_imageInOODS.next( - flush=False, timeout=self.exposure_time - ) + extra_image_ingested = False + while not extra_image_ingested: + try: + image_in_oods = await self.camera.rem.ccoods.evt_imageInOODS.next( + flush=False, timeout=self.exposure_time + ) + try: + image_name_split = image_in_oods.obsid.split("_") + image_index = int( + f"{image_name_split[-2]}{image_name_split[-1][1:]}" + ) + extra_image_ingested = image_index == extra_visit_id[0] + except Exception: + self.log.exception( + "Failed to parse image name into index for {image_in_oods.obsid}." + ) + + self.log.info( + f"Image {image_in_oods.obsid} {image_in_oods.raft} {image_in_oods.sensor} ingested." + ) + + except asyncio.TimeoutError: + self.log.warning( + "Timeout waiting for images to ingest. Continuing." + ) + break self.log.info("Send processing request to RA OCPS.") config = { "LSSTComCam-FROM-OCS_DONUTPAIR": f"{intra_visit_id[0]},{extra_visit_id[0]}" From 75dc73e9ac1eca355bb3033c5da6d5943c128f8c Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Sat, 16 Nov 2024 21:27:49 -0700 Subject: [PATCH 10/12] In maintel/base_close_loop.py, flush evt_degreeOfFreedom. --- python/lsst/ts/standardscripts/maintel/base_close_loop.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/lsst/ts/standardscripts/maintel/base_close_loop.py b/python/lsst/ts/standardscripts/maintel/base_close_loop.py index 15b60ff24..62712c963 100644 --- a/python/lsst/ts/standardscripts/maintel/base_close_loop.py +++ b/python/lsst/ts/standardscripts/maintel/base_close_loop.py @@ -471,6 +471,7 @@ async def compute_ofc_offsets(self, rotation_angle: float, gain: float) -> None: config_yaml = yaml.safe_dump(config) # Run OFC + self.mtcs.rem.mtaos.evt_degreeOfFreedom.flush() await self.mtcs.rem.mtaos.cmd_runOFC.set_start( config=config_yaml, timeout=CMD_TIMEOUT, userGain=gain ) From dbac58ad3432dfdf91329f35692a79715c32bf1f Mon Sep 17 00:00:00 2001 From: edennihy Date: Tue, 19 Nov 2024 10:26:47 -0700 Subject: [PATCH 11/12] Add news fragments. --- doc/news/DM-47381.bugfix.2.rst | 1 + doc/news/DM-47381.bugfix.3.rst | 1 + doc/news/DM-47381.bugfix.rst | 1 + doc/news/DM-47381.feature.1.rst | 1 + doc/news/DM-47381.feature.2.rst | 1 + doc/news/DM-47381.feature.3.rst | 1 + doc/news/DM-47381.feature.4.rst | 1 + doc/news/DM-47381.feature.5.rst | 1 + doc/news/DM-47381.feature.6.rst | 1 + doc/news/DM-47381.feature.rst | 1 + 10 files changed, 10 insertions(+) create mode 100644 doc/news/DM-47381.bugfix.2.rst create mode 100644 doc/news/DM-47381.bugfix.3.rst create mode 100644 doc/news/DM-47381.bugfix.rst create mode 100644 doc/news/DM-47381.feature.1.rst create mode 100644 doc/news/DM-47381.feature.2.rst create mode 100644 doc/news/DM-47381.feature.3.rst create mode 100644 doc/news/DM-47381.feature.4.rst create mode 100644 doc/news/DM-47381.feature.5.rst create mode 100644 doc/news/DM-47381.feature.6.rst create mode 100644 doc/news/DM-47381.feature.rst diff --git a/doc/news/DM-47381.bugfix.2.rst b/doc/news/DM-47381.bugfix.2.rst new file mode 100644 index 000000000..656b5093e --- /dev/null +++ b/doc/news/DM-47381.bugfix.2.rst @@ -0,0 +1 @@ +In ``maintel/take_aos_sequence_comcam.py``, wait for all images to be ingested before starting OCPS process. \ No newline at end of file diff --git a/doc/news/DM-47381.bugfix.3.rst b/doc/news/DM-47381.bugfix.3.rst new file mode 100644 index 000000000..99d5709d5 --- /dev/null +++ b/doc/news/DM-47381.bugfix.3.rst @@ -0,0 +1 @@ +In ``maintel/base_close_loop.py``, flush evt_degreeOfFreedom. \ No newline at end of file diff --git a/doc/news/DM-47381.bugfix.rst b/doc/news/DM-47381.bugfix.rst new file mode 100644 index 000000000..07d942f71 --- /dev/null +++ b/doc/news/DM-47381.bugfix.rst @@ -0,0 +1 @@ +In ``maintel/take_aos_sequence_comcam.py``, fix call to ready_to_take_data. \ No newline at end of file diff --git a/doc/news/DM-47381.feature.1.rst b/doc/news/DM-47381.feature.1.rst new file mode 100644 index 000000000..ccc025fed --- /dev/null +++ b/doc/news/DM-47381.feature.1.rst @@ -0,0 +1 @@ +In ``track_target_and_take_image_comcam.py``, add StateTransition usages to MTCS and ComCam usages. \ No newline at end of file diff --git a/doc/news/DM-47381.feature.2.rst b/doc/news/DM-47381.feature.2.rst new file mode 100644 index 000000000..d0e536c83 --- /dev/null +++ b/doc/news/DM-47381.feature.2.rst @@ -0,0 +1 @@ +In ``base_track_target_and_take_image.py``, add instrument name to metadata and propagate to instrument scripts. \ No newline at end of file diff --git a/doc/news/DM-47381.feature.3.rst b/doc/news/DM-47381.feature.3.rst new file mode 100644 index 000000000..cc01f75bd --- /dev/null +++ b/doc/news/DM-47381.feature.3.rst @@ -0,0 +1 @@ +In ``base_track_target.py``, add log to debug check feature. \ No newline at end of file diff --git a/doc/news/DM-47381.feature.4.rst b/doc/news/DM-47381.feature.4.rst new file mode 100644 index 000000000..5fad57975 --- /dev/null +++ b/doc/news/DM-47381.feature.4.rst @@ -0,0 +1 @@ +In ``base_track-target_and_take_image.py``, add support for single filters or array of filters in metadata. \ No newline at end of file diff --git a/doc/news/DM-47381.feature.5.rst b/doc/news/DM-47381.feature.5.rst new file mode 100644 index 000000000..8620bbac5 --- /dev/null +++ b/doc/news/DM-47381.feature.5.rst @@ -0,0 +1 @@ +In ``track_target_and_take_iamge_comcam.py``, simplify the _handle_slew_and_change_filter method. \ No newline at end of file diff --git a/doc/news/DM-47381.feature.6.rst b/doc/news/DM-47381.feature.6.rst new file mode 100644 index 000000000..ab4634f81 --- /dev/null +++ b/doc/news/DM-47381.feature.6.rst @@ -0,0 +1 @@ +In ``base_close_loop.py``, add gain_sequence. \ No newline at end of file diff --git a/doc/news/DM-47381.feature.rst b/doc/news/DM-47381.feature.rst new file mode 100644 index 000000000..50a97807e --- /dev/null +++ b/doc/news/DM-47381.feature.rst @@ -0,0 +1 @@ +In ``maintel/take_aos_sequence_comcam.py``, use all topics from the camera. \ No newline at end of file From 818039ef80045f0b8dfdd63fc9b924f426fe5824 Mon Sep 17 00:00:00 2001 From: Tiago Ribeiro Date: Tue, 19 Nov 2024 18:02:18 -0700 Subject: [PATCH 12/12] Update TakeAOSSequenceComCam unit test to add mock for ocps and oods. --- .../test_maintel_take_aos_sequence_comcam.py | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/test_maintel_take_aos_sequence_comcam.py b/tests/test_maintel_take_aos_sequence_comcam.py index c2d29ab67..128dbade6 100644 --- a/tests/test_maintel_take_aos_sequence_comcam.py +++ b/tests/test_maintel_take_aos_sequence_comcam.py @@ -19,6 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import types import unittest from unittest.mock import patch @@ -27,6 +28,9 @@ from lsst.ts.observatory.control.maintel.comcam import ComCam, ComCamUsages from lsst.ts.observatory.control.maintel.mtcs import MTCS, MTCSUsages from lsst.ts.standardscripts.maintel import Mode, TakeAOSSequenceComCam +from lsst.ts.utils import index_generator + +index_gen = index_generator() class TestTakeAOSSequenceComCam( @@ -47,13 +51,36 @@ async def basic_make_script(self, index): log=self.script.log, ) + self.script.ocps = unittest.mock.AsyncMock() + self.script.mtcs.offset_camera_hexapod = unittest.mock.AsyncMock() - self.script.camera.expose = unittest.mock.AsyncMock() + self.script.camera.expose = unittest.mock.AsyncMock( + side_effect=self._get_visit_id + ) self.script.camera.setup_instrument = unittest.mock.AsyncMock() self.script.camera.rem.ccoods = unittest.mock.AsyncMock() + self.script.camera.rem.ccoods.configure_mock( + **{ + "evt_imageInOODS.next.side_effect": self._get_next_image_in_oods, + } + ) + + self._dayobs = 2024111900000 + self._visit_index = next(index_gen) return (self.script,) + async def _get_visit_id(self, *args, **kwargs): + self._visit_index = next(index_gen) + return [self._dayobs + self._visit_index] + + async def _get_next_image_in_oods(self, *args, **kwargs): + return types.SimpleNamespace( + obsid=f"CC_O_{int(self._dayobs/100000)}_{self._visit_index:06d}", + raft=0, + sensor=0, + ) + async def test_configure(self): async with self.make_script(): exposure_time = 15.0