Skip to content

Commit a621637

Browse files
authored
Merge pull request #155 from lsst-ts/tickets/DM-47364
Fix signs and make rotation optional in parameter_march
2 parents a6bd1cc + 2bee9ec commit a621637

File tree

4 files changed

+34
-25
lines changed

4 files changed

+34
-25
lines changed

doc/news/DM-47364.perf.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix signs and make rotation optional in parameter_march.py

python/lsst/ts/externalscripts/base_parameter_march.py

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,20 @@ def get_schema(cls) -> dict:
113113
properties:
114114
az:
115115
description: Azimuth position to point to.
116-
type: number
117-
minimum: 0
118-
maximum: 360
116+
anyOf:
117+
- type: number
118+
minimum: 0
119+
maximum: 360
120+
- type: "null"
121+
default: null
119122
el:
120123
description: Elevation position to point to.
121-
type: number
122-
minimum: 0
123-
maximum: 90
124+
anyOf:
125+
- type: number
126+
minimum: 0
127+
maximum: 90
128+
- type: "null"
129+
default: null
124130
filter:
125131
description: Filter name or ID; if omitted the filter is not changed.
126132
anyOf:
@@ -261,7 +267,7 @@ async def configure(self, config: types.SimpleNamespace) -> None:
261267
self.range = config.range
262268
self.n_steps = config.n_steps
263269
self.step_sequence = np.linspace(
264-
-self.range, self.range, self.n_steps
270+
-self.range / 2, self.range / 2, self.n_steps
265271
).tolist()
266272

267273
if hasattr(config, "rotation_sequence"):
@@ -393,11 +399,11 @@ async def parameter_march(self) -> None:
393399
if self.rotation_sequence is not None:
394400
await self.track_target_with_rotation(self.rotation_sequence[0])
395401

396-
await self.take_images()
402+
rot_offsets = [
403+
rot - self.rotation_sequence[0] for rot in self.rotation_sequence
404+
]
397405

398-
rot_offsets = [
399-
rot - self.rotation_sequence[0] for rot in self.rotation_sequence
400-
]
406+
await self.take_images()
401407

402408
for self.iterations_executed in range(1, self.n_steps):
403409
await self.checkpoint(f"Step {self.iterations_executed+1}/{self.n_steps}.")
@@ -416,18 +422,19 @@ async def parameter_march(self) -> None:
416422
# Store the total offset
417423
self.total_offset += offset
418424

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]
425-
)
425+
if self.rotation_sequence is not None:
426+
rotation = await self.tcs.rem.mtrotator.tel_rotation.next(
427+
flush=True, timeout=self.tcs.long_timeout
428+
)
429+
rot_tracking_correction = (
430+
rotation.actualPosition
431+
- self.rotation_sequence[self.iterations_executed - 1]
432+
)
426433

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)
434+
await self.tcs.offset_rot(
435+
rot_offsets[self.iterations_executed] - rot_tracking_correction
436+
)
437+
await self.tcs.check_tracking(track_duration=1.0)
431438

432439
# Take images at the current dof position
433440
await self.take_images()
@@ -480,7 +487,8 @@ async def cleanup(self):
480487
for i, dof_offset in enumerate(self.dofs * -self.total_offset):
481488
offset_dof_data.value[i] = dof_offset
482489
await self.tcs.rem.mtaos.cmd_offsetDOF.start(data=offset_dof_data)
483-
await self.tcs.offset_rot(0.0)
490+
if self.rotation_sequence is not None:
491+
await self.tcs.offset_rot(0.0)
484492

485493
except Exception:
486494
self.log.exception(

tests/maintel/test_maintel_parameter_march_comcam.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ async def test_configure(self):
103103
assert self.script.config.exp_time == 30.0
104104
assert np.array_equal(self.script.dofs, [1] * 50)
105105
assert self.script.rotation_sequence == [50] * 11
106-
assert self.script.step_sequence == np.linspace(-1, 1, 11).tolist()
106+
assert self.script.step_sequence == np.linspace(-0.5, 0.5, 11).tolist()
107107
assert self.script.range == 1
108108
assert self.script.n_steps == 11
109109
assert self.script.config.program == "BLOCK-TXXX"

tests/maintel/test_maintel_parameter_march_lsstcam.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ async def test_configure(self):
104104
assert self.script.config.exp_time == 30.0
105105
assert np.array_equal(self.script.dofs, [1] * 50)
106106
assert self.script.rotation_sequence == [50] * 11
107-
assert self.script.step_sequence == np.linspace(-1, 1, 11).tolist()
107+
assert self.script.step_sequence == np.linspace(-0.5, 0.5, 11).tolist()
108108
assert self.script.range == 1
109109
assert self.script.n_steps == 11
110110
assert self.script.config.program == "BLOCK-TXXX"

0 commit comments

Comments
 (0)