simonsobs / scheduler

Scheduler for SO
0 stars 1 forks source link

Add HWP operations to scheduler #38

Closed kmharrington closed 9 months ago

kmharrington commented 9 months ago

The HWPs work, we need the scheduler to be able to turn them on and off at the appropriate times. (do we know the appropriate times yet?)

jlashner commented 9 months ago

Just want to comment that even before HWP operations are added to sorunlib, it would be very useful right now to have the ability to add a wait buffer for HWP spinup in between detector setup and scans.

The method I've been taught is to delay the scan start time by ~20 min to account for spin-up time, however I think without building the schedule with this buffer built in, I think this might mess up the scan pointing.

Below is a snippet of a modified schedule with hwp spin-up to show how things are currently happening...

#################### Detector Setup Over ####################

HWPPrep()
forward = True
hwp_freq = 2.0
HWPSpinUp()

################# Scan #################################

now = datetime.datetime.now(tz=UTC)
scan_start = datetime.datetime(2024, 1, 26, 22, 27, 33, tzinfo=datetime.timezone.utc)
scan_start += datetime.timedelta(minutes=20) # Account for HWP Spinup
scan_stop = datetime.datetime(2024, 1, 27, 1, 37, 30, 429667, tzinfo=datetime.timezone.utc)
if now > scan_start:
    # adjust scan parameters
    az = 345.931 + -0.00513*(now-scan_start).total_seconds()
else: 
    az = 345.931
if now > scan_stop:
    # too late, don't scan
    pass
else:
    run.acu.move_to(az, 50)

    print('Waiting until 2024-01-26 22:27:33+00:00 to start scan')
    run.wait_until('2024-01-26T22:27:33+00:00')

    run.seq.scan(
        description='jupiter', 
        stop_time='2024-01-27T01:37:30.429667+00:00', 
        width=20.833, 
        az_drift=-0.00513, 
        subtype='cal',
        tag='jupiter,setting,middle_focal_plane',
    )
    print('Taking Bias Steps')
    run.smurf.bias_step(concurrent=True)
################# Scan Over #############################

Edit: Reading this over I'm realizing that scan_start is not even used in the scan, so I think this might not be doing anything

kmharrington commented 9 months ago

yeah that isn't doing what you want it to? Have we been running scans like that? worth making notes we're probably missing sources

kmharrington commented 9 months ago

I'm starting to implement these on the satp1-updates branch

jlashner commented 9 months ago

Yeah I'm not sure if anyones looked at the data from these scans, but looking at the code, changing scan_start wont actually delay the start time of the scan, and is just used for determining az-shift offset.... so I feel like we're probably still catching HWP spin up and also have messed up pointing.