Skip to content

Commit

Permalink
add boresight_check in the calibration() to add or remove the boresig…
Browse files Browse the repository at this point in the history
…ht angle check before the calibraiton
  • Loading branch information
sadachi5 committed Sep 5, 2024
1 parent 0a8fa64 commit ec336e9
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/sorunlib/wiregrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _check_zenith():


# Calibration Functions
def _check_telescope_position():
def _check_telescope_position(boresight_check=True):
# Get current telescope position
acu = run.CLIENTS['acu']
resp = acu.monitor.status()
Expand All @@ -90,13 +90,14 @@ def _check_telescope_position():
raise RuntimeError(error)

# Check boresight angle
try:
assert (abs(boresight - 0) < BORESIGHT_DIFF_THRESHOLD)
except AssertionError:
error = "Telescope not at 0 deg boresight. Cannot proceed with " + \
f"wiregrid calibration in current position ({boresight}). " + \
"Aborting."
raise RuntimeError(error)
if boresight_check:
try:
assert (abs(boresight - 0) < BORESIGHT_DIFF_THRESHOLD)
except AssertionError:
error = "Telescope not at 0 deg boresight. Cannot proceed with " + \
f"wiregrid calibration in current position ({boresight}). " + \
"Aborting."
raise RuntimeError(error)


def _configure_power(continuous):
Expand Down Expand Up @@ -254,16 +255,18 @@ def rotate(continuous, duration=30, num_laps=1, stopped_time=10.):
check_response(kikusui, resp)


def calibrate(continuous=False):
def calibrate(continuous=False, boresight_check=True):
"""Run a wiregrid calibration.
Args:
continuous (bool): Calibration by continuous rotation or not.
Default is False, in which the wiregrid rotates step-wisely.
boresight_check (bool): Check the boresight angle before
the calibration or not
"""
try:
_check_telescope_position()
_check_telescope_position(boresight_check=boresight_check)
_check_agents_online()
_check_temperature_sensors()
_check_motor_on()
Expand Down

0 comments on commit ec336e9

Please sign in to comment.