Skip to content

Commit

Permalink
Merge pull request #249 from lsst-ts/tickets/DM-47641
Browse files Browse the repository at this point in the history
  • Loading branch information
edennihy authored Dec 3, 2024
2 parents cf317fb + 727a32a commit b617f19
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 12 deletions.
1 change: 1 addition & 0 deletions doc/news/DM-47641.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use supplemented_group_id ``maintel/base_close_loop.py``.
1 change: 1 addition & 0 deletions doc/news/DM-47641.feature.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In maintel/base_close_loop.py, make filter required.
1 change: 1 addition & 0 deletions doc/news/DM-47641.feature.2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
In base_track_target, update track_azel routine to remove stop_tracking before start_tracking.
1 change: 1 addition & 0 deletions doc/news/DM-47641.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update HomeBothAxis script to re-enable the force balance system after homing the mount.
1 change: 1 addition & 0 deletions python/lsst/ts/standardscripts/base_take_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ async def run(self):
self.config.image_type,
exposure,
1,
n_snaps=1,
reason=reason,
program=program,
group_id=self.group_id,
Expand Down
2 changes: 0 additions & 2 deletions python/lsst/ts/standardscripts/base_track_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,6 @@ async def run_block(self):
el=el,
rot_tel=self.config.rot_value,
)
await self.tcs.stop_tracking()
await asyncio.sleep(1.0)
await self.tcs.start_tracking()

elif self.slew_type == SlewType.PLANET:
Expand Down
24 changes: 15 additions & 9 deletions python/lsst/ts/standardscripts/maintel/base_close_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ def get_schema(cls) -> typing.Dict[str, typing.Any]:
filter:
description: Which filter to use when taking intra/extra focal images.
type: string
default: empty_1
exposure_time:
description: The exposure time to use when taking images (sec).
type: number
Expand Down Expand Up @@ -231,6 +230,8 @@ def get_schema(cls) -> typing.Dict[str, typing.Any]:
items:
type: string
additionalProperties: false
required:
- filter
"""
return yaml.safe_load(schema_yaml)

Expand Down Expand Up @@ -326,6 +327,7 @@ def set_metadata(self, metadata: salobj.type_hints.BaseMsgType) -> None:

async def take_intra_extra_focal_images(
self,
supplemented_group_id: str,
) -> typing.Tuple[typing.Any, typing.Any]:
"""Take intra and extra focal images.
Expand All @@ -347,7 +349,7 @@ async def take_intra_extra_focal_images(
intra_image = await self.camera.take_cwfs(
exptime=self.exposure_time,
n=1,
group_id=self.group_id,
group_id=supplemented_group_id,
filter=self.filter,
reason="INTRA" + ("" if self.reason is None else f"_{self.reason}"),
program=self.program,
Expand All @@ -368,7 +370,7 @@ async def take_intra_extra_focal_images(
extra_image = await self.camera.take_cwfs(
exptime=self.exposure_time,
n=1,
group_id=self.group_id,
group_id=supplemented_group_id,
filter=self.filter,
reason="EXTRA" + ("" if self.reason is None else f"_{self.reason}"),
program=self.program,
Expand All @@ -395,11 +397,13 @@ async def wait_for_images_in_oods(self):
except asyncio.TimeoutError:
self.log.warning("Timeout waiting for images in OODS.")

async def handle_fam_mode(self) -> None:
async def handle_fam_mode(self, supplemented_group_id: str) -> None:
"""Handle Full Array Mode."""

# Take intra and extra focal images
intra_image, extra_image = await self.take_intra_extra_focal_images()
intra_image, extra_image = await self.take_intra_extra_focal_images(
supplemented_group_id
)

# Set intra and extra visit id
intra_visit_id = int(intra_image[0])
Expand All @@ -408,7 +412,7 @@ async def handle_fam_mode(self) -> None:
take_infocus_image_task = asyncio.create_task(
self.camera.take_acq(
self.exposure_time,
group_id=self.group_id,
group_id=supplemented_group_id,
reason="INFOCUS" + ("" if self.reason is None else f"_{self.reason}"),
program=self.program,
filter=self.filter,
Expand All @@ -426,13 +430,13 @@ async def handle_fam_mode(self) -> None:
)
await take_infocus_image_task

async def handle_cwfs_mode(self) -> None:
async def handle_cwfs_mode(self, supplemented_group_id: str) -> None:
"""Handle CWFS mode."""

# Take in-focus image
image = await self.camera.take_acq(
self.exposure_time,
group_id=self.group_id,
group_id=supplemented_group_id,
reason="INFOCUS" + ("" if self.reason is None else f"_{self.reason}"),
program=self.program,
filter=self.filter,
Expand Down Expand Up @@ -539,7 +543,9 @@ async def arun(self, checkpoint: bool = False) -> None:
)

# Run the operational mode handler function.
await self.operation_model_handlers[self.mode]()
await self.operation_model_handlers[self.mode](
self.next_supplemented_group_id()
)

# Retrieve the rotation angle after taking data.
end_rotation_angle = await self.mtcs.rem.mtrotator.tel_rotation.next(
Expand Down
5 changes: 5 additions & 0 deletions python/lsst/ts/standardscripts/maintel/home_both_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,8 @@ async def run(self):
elapsed_time = end_time - start_time

self.log.info(f"Homing both axes took {elapsed_time:.2f} seconds")

if not self.ignore_m1m3:
self.log.info("Enabling M1M3 balance system.")
await asyncio.sleep(self.warn_wait)
await self.mtcs.enable_m1m3_balance_system()
2 changes: 1 addition & 1 deletion tests/test_maintel_close_loop_lsstcam.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async def test_configure(self):
async def test_configure_wep_config(self):
async with self.make_script():
wep_config_dic = {"field1": "val1", "field2": "val2"}
await self.configure_script(wep_config=wep_config_dic)
await self.configure_script(wep_config=wep_config_dic, filter="r")
assert self.script.wep_config == yaml.dump(wep_config_dic)

async def test_run(self):
Expand Down
1 change: 1 addition & 0 deletions tests/test_maintel_home_both_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ async def basic_make_script(self, index):
self.script.mtcs.rem.mtmount = unittest.mock.AsyncMock()
self.script.mtcs.lower_m1m3 = unittest.mock.AsyncMock()
self.script.mtcs.disable_m1m3_balance_system = unittest.mock.AsyncMock()
self.script.mtcs.enable_m1m3_balance_system = unittest.mock.AsyncMock()

return (self.script,)

Expand Down

0 comments on commit b617f19

Please sign in to comment.