Skip to content

Commit

Permalink
Merge pull request #88 from simonsobs/koopman/set-scan-params
Browse files Browse the repository at this point in the history
Add `acu.set_scan_params` and rely on set params during `seq.scan`
  • Loading branch information
BrianJKoopman authored Oct 23, 2023
2 parents 812b01e + 010e13a commit 4b54283
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
17 changes: 17 additions & 0 deletions src/sorunlib/acu.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,20 @@ def set_boresight(target):
check_response(resp)
else:
raise RuntimeError(f"Platform type {platform} does not support boresight motion")


def set_scan_params(az_speed, az_accel, reset=False):
"""Update the default scan parameters, used during :func:`sorunlib.seq.scan`.
Args:
az_speed (float, optional): The azimuth scan speed.
az_accel (float, optional): The (average) azimuth acceleration at
turn-around.
reset (bool, optional): If True, reset all params to default values
before applying any updates passed explicitly here.
"""
resp = run.CLIENTS['acu'].set_scan_params(az_speed=az_speed,
az_accel=az_accel,
reset=reset)
check_response(resp)
4 changes: 2 additions & 2 deletions src/sorunlib/seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ def scan(description, stop_time, width, az_drift=0, tag=None, subtype=None):
el = resp.session['data']['StatusDetailed']['Elevation current position']

# Start telescope motion
# az_speed and az_accel assumed from ACU defaults
# Can be modified by acu.set_scan_params()
resp = run.CLIENTS['acu'].generate_scan.start(az_endpoint1=az,
az_endpoint2=az + width,
az_speed=2,
az_accel=2.0,
el_endpoint1=el,
el_endpoint2=el,
el_speed=0,
Expand Down
10 changes: 10 additions & 0 deletions tests/test_acu.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,13 @@ def test_move_to_failed():
acu.run.CLIENTS['acu'].go_to.side_effect = [mocked_response]
with pytest.raises(RuntimeError):
acu.move_to(180, 90)


@patch('sorunlib.create_clients', mocked_clients)
def test_set_scan_params():
acu.run.initialize(test_mode=True)
acu.set_scan_params(az_speed=2, az_accel=2, reset=True)
acu.run.CLIENTS['acu'].set_scan_params.assert_called_with(
az_speed=2,
az_accel=2,
reset=True)

0 comments on commit 4b54283

Please sign in to comment.