Skip to content

Commit

Permalink
Fix various bugs with set_pixel
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Jul 26, 2023
1 parent baf5439 commit e85ec3a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/lvmguider/guider.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ def set_pixel(self, pixel_x: float | None = None, pixel_z: float | None = None):
# In auto mode, if we change the current pixel, we start drifting
# towards a new target position.
self.command.actor.status |= GuiderStatus.DRIFTING
self.pixel = new_pixel

return self.pixel

Expand Down Expand Up @@ -235,7 +236,10 @@ async def guide_one(
guide_tolerance = guide_tolerance or self.config.get("guide_tolerance", 5)

if mode == "auto":
is_acquisition = not self.use_reference_frames
is_acquisition = bool(
not self.use_reference_frames
or self.command.actor.status & GuiderStatus.DRIFTING
)
elif mode == "guide":
is_acquisition = False
elif mode == "acquire":
Expand Down Expand Up @@ -279,7 +283,10 @@ async def guide_one(
ra_p = numpy.round(ra_ref - offset_radec[0] / 3600 * cos_dec, 6)
dec_p = numpy.round(dec_ref - offset_radec[1] / 3600.0, 6)

if sep > guide_tolerance and apply_correction is True and mode == "auto":
if self.command.actor.status & GuiderStatus.DRIFTING:
raise ValueError("Guider is drifting. Reverting to acquisition.")

if (sep > guide_tolerance) and apply_correction is True and mode == "auto":
self.set_reference_frames()
self.command.actor._status &= ~GuiderStatus.GUIDING
self.command.actor._status |= GuiderStatus.ACQUIRING
Expand Down

0 comments on commit e85ec3a

Please sign in to comment.