Skip to content

Commit 0216226

Browse files
sadachi5pre-commit-ci[bot]BrianJKoopman
authored
Add arguments in the calibration() to enable the removal of various checks (#165)
* add boresight_check in the calibration() to add or remove the boresight angle check before the calibraiton * add elevation_check, temperature_check in the calibration() to enable remval of these checks * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add/expand docstrings for new arguments --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Brian Koopman <brian.koopman@yale.edu>
1 parent 0a8fa64 commit 0216226

1 file changed

Lines changed: 30 additions & 18 deletions

File tree

src/sorunlib/wiregrid.py

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def _check_zenith():
7272

7373

7474
# Calibration Functions
75-
def _check_telescope_position():
75+
def _check_telescope_position(elevation_check=True, boresight_check=True):
7676
# Get current telescope position
7777
acu = run.CLIENTS['acu']
7878
resp = acu.monitor.status()
@@ -81,22 +81,24 @@ def _check_telescope_position():
8181
boresight = resp.session['data']['StatusDetailed']['Boresight current position']
8282

8383
# Check appropriate elevation
84-
try:
85-
assert (el > 50 - EL_DIFF_THRESHOLD)
86-
except AssertionError:
87-
error = "Telescope not at > 50 deg elevation. Cannot proceed with " + \
88-
f"wiregrid calibration in current position ({az}, {el}). " + \
89-
"Aborting."
90-
raise RuntimeError(error)
84+
if elevation_check:
85+
try:
86+
assert (el > 50 - EL_DIFF_THRESHOLD)
87+
except AssertionError:
88+
error = "Telescope not at > 50 deg elevation. Cannot proceed with " + \
89+
f"wiregrid calibration in current position ({az}, {el}). " + \
90+
"Aborting."
91+
raise RuntimeError(error)
9192

9293
# Check boresight angle
93-
try:
94-
assert (abs(boresight - 0) < BORESIGHT_DIFF_THRESHOLD)
95-
except AssertionError:
96-
error = "Telescope not at 0 deg boresight. Cannot proceed with " + \
97-
f"wiregrid calibration in current position ({boresight}). " + \
98-
"Aborting."
99-
raise RuntimeError(error)
94+
if boresight_check:
95+
try:
96+
assert (abs(boresight - 0) < BORESIGHT_DIFF_THRESHOLD)
97+
except AssertionError:
98+
error = "Telescope not at 0 deg boresight. Cannot proceed with " + \
99+
f"wiregrid calibration in current position ({boresight}). " + \
100+
"Aborting."
101+
raise RuntimeError(error)
100102

101103

102104
def _configure_power(continuous):
@@ -254,18 +256,28 @@ def rotate(continuous, duration=30, num_laps=1, stopped_time=10.):
254256
check_response(kikusui, resp)
255257

256258

257-
def calibrate(continuous=False):
259+
def calibrate(continuous=False, elevation_check=True, boresight_check=True,
260+
temperature_check=True):
258261
"""Run a wiregrid calibration.
259262
260263
Args:
261264
continuous (bool): Calibration by continuous rotation or not.
262265
Default is False, in which the wiregrid rotates step-wisely.
266+
elevation_check (bool): Check the elevation angle is in an appropriate
267+
range before the calibration or not. Default is True.
268+
boresight_check (bool): Check the boresight angle is in an appropriate
269+
range before the calibration or not. Default is True.
270+
temperature_check (bool): Check the temperature of various components
271+
are within operational limits before the calibration or not.
272+
Default is True.
263273
264274
"""
265275
try:
266-
_check_telescope_position()
276+
_check_telescope_position(elevation_check=elevation_check,
277+
boresight_check=boresight_check)
267278
_check_agents_online()
268-
_check_temperature_sensors()
279+
if temperature_check:
280+
_check_temperature_sensors()
269281
_check_motor_on()
270282

271283
# Rotate for reference before insertion

0 commit comments

Comments
 (0)