@@ -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."
0 commit comments