Closed kmharrington closed 2 months ago
Found another example this script:
import os
import json
import datetime as dt
from schedlib.policies.satp1 import SATP1Policy, make_cal_target
from schedlib.policies.sat import source_scan
from schedlib.policies.sat import SATPolicy, State, CalTarget
from schedlib import utils as u, core, commands as cmd, rules as ru, instrument as inst, source as src
basedir = '/so/home/kmharrin/public_html/observation_scripts/schedule_files/'
schedule_files = {
50 : os.path.join(basedir, 'cmb_2024_el50_20240423.txt'),
60 : os.path.join(basedir, 'cmb_2024_el60_20240423.txt'),
}
class params:
elevation = int( 60 )
boresight = int( 0 )
az_speed = 0.8
az_accel = 1.5
hwp_dir = True
t0 = dt.datetime(2024, 5, 4, 20, 0, 0, tzinfo=dt.timezone.utc)
t1 = dt.datetime(2024, 5, 5, 15, 42, 0, tzinfo=dt.timezone.utc)
cfg = {
'az_speed': params.az_speed, 'az_accel': params.az_accel,
'disable_hwp': False, 'apply_boresight_rot': False,
'hwp_dir': params.hwp_dir, 'iv_cadence': 6*u.hour,
}
#print(schedule_files[params.elevation])
policy = SATP1Policy.from_defaults(
master_file=schedule_files[params.elevation],
**cfg
)
policy.add_cal_target(
source='saturn',
boresight=params.boresight,
elevation=50, #params.elevation,
focus='middle',
allow_partial=True,
)
#policy.add_cal_target(
# source='saturn',
# boresight=params.boresight,
# elevation=50,#params.elevation,
# focus='middle',
# allow_partial=False,
#)
seq = policy.init_seqs(t0, t1)
seq = policy.apply(seq)
cmds = policy.seq2cmd(seq, t0, t1)
schedule = policy.cmd2txt(cmds, t0, t1)
print("#####################################################################")
#print(schedule)
fname = f'debug_{t0.isoformat()}_{t1.isoformat()}.py'
fname = os.path.join(
'/so/home/kmharrin/public_html/observation_scripts/debug_scripts/',
fname
)
with open(fname, 'w') as f:
f.write(str(schedule))
If I end the scan there, it gets to Saturn just fine the second time at az~300
. If I try to end at 20:00 UTC the script throws an error saying it cannot solve sun safe moves are az~-59
. Would love to not have to cut these into piece to get Saturn scans
Making another note that there's really something wrong here. We managed to just straight command a non-sunsafe move right out of stow. Really no reason to wrap around here.
############# Daily Relock
for smurf in pysmurfs:
smurf.zero_biases.start()
for smurf in pysmurfs:
smurf.zero_biases.wait()
time.sleep(120)
run.smurf.take_noise(concurrent=True, tag='oper,take_noise,res_check')
run.smurf.uxm_relock(concurrent=True)
run.acu.set_scan_params(0.8, 1.5)
run.acu.set_boresight(target=-45)
run.wait_until('2024-05-10T20:15:00.020000+00:00')
run.acu.move_to(az=409.108, el=60.0)
Yeah I think this is a problem with how I set up the optimization . I didn’t disfavor any wraps, it will just tries to find the az that minimizes the overall moves necessary
The "running to the Az limits" is definitely related to calibration scans. I'm only seeing it show up before or after a calibration target is observed
superseded by #90
and has at least been partially fixed since then
running this script
there are a bunch of scans solving to this:
There's really no reason to run straight up to the limit of our cable wrap when the sun is below the horizon (and in fact it likely increases wear & tear on the cable wrap).