Skip to content

Commit a6bd1cc

Browse files
authored
Merge pull request #156 from lsst-ts/tickets/DM-46978
Tickets/dm 46978
2 parents bda33ce + 072238b commit a6bd1cc

File tree

8 files changed

+41
-10
lines changed

8 files changed

+41
-10
lines changed

doc/news/DM-46978.bugfix.1.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixing call to RA in parameter_march_comcam.py.

doc/news/DM-46978.bugfix.2.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
In base_parameter_march.py, wait for tracking to start to continue.

doc/news/DM-46978.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixing signs in intra/extra focal images.

doc/news/DM-46978.feature.1.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
In base_parameter_march, use offset_rot instead of slewing to a new target every time..

doc/news/DM-46978.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add darks at the end of the twilight flats.

python/lsst/ts/externalscripts/base_parameter_march.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ def get_schema(cls) -> dict:
154154
Rotation sequence used for the parameter march. This can either be a single number
155155
to use the same rotation angle throughout or an array specifying custom rotation angles.
156156
If not provided, the script will determine the increments automatically.
157-
default: 0.0
158157
anyOf:
159158
- type: number
160159
description: >
@@ -275,6 +274,8 @@ async def configure(self, config: types.SimpleNamespace) -> None:
275274
f"rotation_sequence length {len(self.rotation_sequence)} "
276275
f"does not match n_steps {self.n_steps}."
277276
)
277+
else:
278+
self.rotation_sequence = None
278279

279280
self.config = config
280281
if hasattr(config, "dofs"):
@@ -351,14 +352,16 @@ async def format_values(offset_values: np.ndarray) -> np.ndarray:
351352
return cam_hex_values, m2_hex_values, m1m3_bend_values, m2_bend_values
352353

353354
async def track_target_with_rotation(self, rotation_angle) -> None:
355+
await self.tcs.offset_rot(0.0)
354356
await self.tcs.point_azel(
355357
az=self.config.az,
356358
el=self.config.el,
357359
rot_tel=rotation_angle,
358360
)
359361
await self.tcs.stop_tracking()
360-
await asyncio.sleep(1.0)
362+
await asyncio.sleep(5.0)
361363
await self.tcs.start_tracking()
364+
await self.tcs.check_tracking(track_duration=1.0)
362365

363366
async def parameter_march(self) -> None:
364367
"""Perform the parameter_march operation."""
@@ -387,10 +390,15 @@ async def parameter_march(self) -> None:
387390
self.iterations_started = True
388391

389392
# Move rotator
390-
await self.track_target_with_rotation(self.rotation_sequence[0])
393+
if self.rotation_sequence is not None:
394+
await self.track_target_with_rotation(self.rotation_sequence[0])
391395

392396
await self.take_images()
393397

398+
rot_offsets = [
399+
rot - self.rotation_sequence[0] for rot in self.rotation_sequence
400+
]
401+
394402
for self.iterations_executed in range(1, self.n_steps):
395403
await self.checkpoint(f"Step {self.iterations_executed+1}/{self.n_steps}.")
396404
# Calculate the offset for the current step
@@ -408,11 +416,19 @@ async def parameter_march(self) -> None:
408416
# Store the total offset
409417
self.total_offset += offset
410418

411-
# Move rotator
412-
await self.track_target_with_rotation(
413-
self.rotation_sequence[self.iterations_executed]
419+
rotation = await self.tcs.rem.mtrotator.tel_rotation.next(
420+
flush=True, timeout=self.tcs.long_timeout
421+
)
422+
rot_tracking_correction = (
423+
rotation.actualPosition
424+
- self.rotation_sequence[self.iterations_executed - 1]
414425
)
415426

427+
await self.tcs.offset_rot(
428+
rot_offsets[self.iterations_executed] - rot_tracking_correction
429+
)
430+
await self.tcs.check_tracking(track_duration=1.0)
431+
416432
# Take images at the current dof position
417433
await self.take_images()
418434

@@ -464,6 +480,8 @@ async def cleanup(self):
464480
for i, dof_offset in enumerate(self.dofs * -self.total_offset):
465481
offset_dof_data.value[i] = dof_offset
466482
await self.tcs.rem.mtaos.cmd_offsetDOF.start(data=offset_dof_data)
483+
await self.tcs.offset_rot(0.0)
484+
467485
except Exception:
468486
self.log.exception(
469487
"Error while trying to return telescope to its original position."

python/lsst/ts/externalscripts/base_take_twilight_flats.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,14 @@ async def take_twilight_flats(self):
580580

581581
self.assert_sun_location()
582582

583+
await self.camera.take_darks(
584+
exptime=30,
585+
ndarks=2,
586+
group_id=self.group_id,
587+
program=self.program,
588+
reason=self.reason,
589+
)
590+
583591
async def assert_feasibility(self) -> None:
584592
"""Verify that camera is in a feasible state to
585593
execute the script.

python/lsst/ts/externalscripts/maintel/parameter_march_comcam.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ async def take_images(
8585
"""
8686
self.log.debug("Moving to intra-focal position")
8787

88-
await self.mtcs.offset_camera_hexapod(x=0, y=0, z=self.dz, u=0, v=0)
88+
await self.mtcs.offset_camera_hexapod(x=0, y=0, z=-self.dz, u=0, v=0)
8989

9090
supplemented_group_id = self.next_supplemented_group_id()
9191

@@ -105,7 +105,7 @@ async def take_images(
105105

106106
# Hexapod offsets are relative, so need to move 2x the offset
107107
# to get from the intra- to the extra-focal position.
108-
z_offset = -(self.dz * 2.0)
108+
z_offset = self.dz * 2.0
109109
await self.mtcs.offset_camera_hexapod(x=0, y=0, z=z_offset, u=0, v=0)
110110

111111
self.log.info("Taking extra-focal image")
@@ -121,7 +121,7 @@ async def take_images(
121121

122122
self.log.info("Send processing request to RA OCPS.")
123123
config = {
124-
"LSSTComCamSim-FROM-OCS_DONUTPAIR": f"{intra_visit_id[0]},{extra_visit_id[0]}"
124+
"LSSTComCam-FROM-OCS_DONUTPAIR": f"{intra_visit_id[0]},{extra_visit_id[0]}"
125125
}
126126
ocps_execute_task = asyncio.create_task(
127127
self.ocps.cmd_execute.set_start(
@@ -133,7 +133,7 @@ async def take_images(
133133
self.log.debug("Moving to in-focus position")
134134

135135
# Move the hexapod back to in focus position
136-
await self.mtcs.offset_camera_hexapod(x=0, y=0, z=self.dz, u=0, v=0)
136+
await self.mtcs.offset_camera_hexapod(x=0, y=0, z=-self.dz, u=0, v=0)
137137

138138
self.log.info("Taking in-focus image")
139139

0 commit comments

Comments
 (0)