Skip to content

Commit

Permalink
Use new acu.move_to_target() command from [1]
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJKoopman committed Oct 17, 2024
1 parent 062447e commit 9c933f9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 26 deletions.
37 changes: 14 additions & 23 deletions src/schedlib/policies/sat.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,31 +289,22 @@ def source_scan(state, block):

state = state.replace(az_now=block.az, el_now=block.alt)
commands.extend([
"now = datetime.datetime.now(tz=UTC)",
f"scan_start = {repr(block.t0)}",
f"scan_stop = {repr(block.t1)}",
f"if now > scan_start:",
" # adjust scan parameters",
f" az = {round(block.az,3)} + {round(block.az_drift,5)}*(now-scan_start).total_seconds()",
f"else: ",
f" az = {round(block.az,3)}",
f"if now > scan_stop:",
" # too late, don't scan",
" pass",
"else:",
f" run.acu.move_to(az, {round(block.alt,3)})",
f"move_to_target({round(block.az,3)}, {round(block.alt,3)},",
f" start_time='{block.t0.isoformat()}',",
f" stop_time='{block.t1.isoformat()}',",
f" drift={round(block.az_drift,5)})",
"",
f" print('Waiting until {block.t0} to start scan')",
f" run.wait_until('{block.t0.isoformat()}')",
f"print('Waiting until {block.t0} to start scan')",
f"run.wait_until('{block.t0.isoformat()}')",
"",
" run.seq.scan(",
f" description='{block.name}', ",
f" stop_time='{block.t1.isoformat()}', ",
f" width={round(block.throw,3)}, ",
f" az_drift={round(block.az_drift,5)}, ",
f" subtype='{block.subtype}',",
f" tag='{block.tag}',",
" )",
"run.seq.scan(",
f" description='{block.name}', ",
f" stop_time='{block.t1.isoformat()}', ",
f" width={round(block.throw,3)}, ",
f" az_drift={round(block.az_drift,5)}, ",
f" subtype='{block.subtype}',",
f" tag='{block.tag}',",
")",
])
return state, block.duration.total_seconds(), commands

Expand Down
2 changes: 1 addition & 1 deletion src/schedlib/policies/satp1.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def make_operations(
{ 'name': 'sat.det_setup' , 'sched_mode': SchedMode.PreCal, 'apply_boresight_rot': apply_boresight_rot, 'iv_cadence':iv_cadence },
{ 'name': 'sat.hwp_spin_up' , 'sched_mode': SchedMode.PreCal, 'disable_hwp': disable_hwp, 'forward':hwp_dir},
{ 'name': 'sat.source_scan' , 'sched_mode': SchedMode.InCal, },
{ 'name': 'sat.bias_step' , 'sched_mode': SchedMode.PostCal, 'indent': 4},
{ 'name': 'sat.bias_step' , 'sched_mode': SchedMode.PostCal, },
]
cmb_ops = [
{ 'name': 'sat.setup_boresight' , 'sched_mode': SchedMode.PreObs, 'apply_boresight_rot': apply_boresight_rot, },
Expand Down
2 changes: 1 addition & 1 deletion src/schedlib/policies/satp2.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def make_operations(
{ 'name': 'sat.det_setup' , 'sched_mode': SchedMode.PreCal, 'apply_boresight_rot': apply_boresight_rot, 'iv_cadence':iv_cadence },
{ 'name': 'sat.hwp_spin_up' , 'sched_mode': SchedMode.PreCal, 'disable_hwp': disable_hwp, 'forward':hwp_dir},
{ 'name': 'sat.source_scan' , 'sched_mode': SchedMode.InCal, },
{ 'name': 'sat.bias_step' , 'sched_mode': SchedMode.PostCal, 'indent': 4},
{ 'name': 'sat.bias_step' , 'sched_mode': SchedMode.PostCal, },
]
cmb_ops = [
{ 'name': 'sat.setup_boresight' , 'sched_mode': SchedMode.PreObs, 'apply_boresight_rot': apply_boresight_rot, },
Expand Down
2 changes: 1 addition & 1 deletion src/schedlib/policies/satp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def make_operations(
{ 'name': 'sat.det_setup' , 'sched_mode': SchedMode.PreCal, 'commands': commands_det_setup, 'apply_boresight_rot': apply_boresight_rot, },
{ 'name': 'sat.hwp_spin_up' , 'sched_mode': SchedMode.PreCal, 'disable_hwp': disable_hwp, 'forward':hwp_dir},
{ 'name': 'sat.source_scan' , 'sched_mode': SchedMode.InCal, },
{ 'name': 'sat.bias_step' , 'sched_mode': SchedMode.PostCal, 'indent': 4},
{ 'name': 'sat.bias_step' , 'sched_mode': SchedMode.PostCal, },
]
cmb_ops = [
{ 'name': 'sat.det_setup' , 'sched_mode': SchedMode.PreObs, 'commands': commands_det_setup, 'apply_boresight_rot': apply_boresight_rot, 'iv_cadence':iv_cadence},
Expand Down

0 comments on commit 9c933f9

Please sign in to comment.