Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/schedlib/policies/lat.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ def ufm_relock(state, commands=None, relock_cadence=24*u.hour):

# per block operation: block will be passed in as parameter
@cmd.operation(name='lat.det_setup', return_duration=True)
def det_setup(state, block, commands=None, apply_corotator_rot=True, iv_cadence=None, det_setup_duration=20*u.minute):
return tel.det_setup(state, block, commands, apply_corotator_rot, iv_cadence, det_setup_duration)
def det_setup(state, block, commands=None, apply_corotator_rot=True, iv_cadence=None,
iv_kwargs=None, bias_step_kwargs=None, det_setup_duration=20*u.minute):
return tel.det_setup(state, block, commands, apply_corotator_rot, iv_cadence, iv_kwargs, bias_step_kwargs, det_setup_duration)

@cmd.operation(name='lat.cmb_scan', return_duration=True)
def cmb_scan(state, block):
Expand Down Expand Up @@ -243,7 +244,8 @@ class LATPolicy(tel.TelPolicy):
def __post_init__(self):
if self.pysmurf_script is None:
bias_step_cmds = [
"run.smurf.bias_step(concurrent=True)",
"run.smurf.bias_step(concurrent=True,",
f" bias_step_kwargs={self.bias_step_kwargs})",
]
else:
bias_step_cmds = [
Expand All @@ -258,8 +260,8 @@ def __post_init__(self):
"################### Detector Setup ######################",
"with disable_trace():",
" run.initialize()",
"run.smurf.iv_curve(concurrent=True, ",
" iv_kwargs={'run_serially': False})",
"run.smurf.iv_curve(concurrent=True,",
f" iv_kwargs={self.iv_kwargs})",
"run.smurf.bias_dets(concurrent=True)",
"time.sleep(180)",
*bias_step_cmds,
Expand Down Expand Up @@ -418,6 +420,8 @@ def make_operations(self, cmds_uxm_relock=None, cmds_det_setup=None):
'sched_mode': sched_mode,
'apply_corotator_rot': self.apply_corotator_rot,
'iv_cadence': self.iv_cadence,
'iv_kwargs': self.iv_kwargs,
'bias_step_kwargs': self.bias_step_kwargs,
'det_setup_duration': self.det_setup_duration,
'commands': cmds_det_setup,
}
Expand Down
8 changes: 6 additions & 2 deletions src/schedlib/policies/sat.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,10 @@ def hwp_spin_down(state, disable_hwp=False, brake_hwp=True):
return state, HWP_SPIN_DOWN, cmd

@cmd.operation(name='sat.det_setup', return_duration=True)
def det_setup(state, block, commands=None, apply_boresight_rot=True, iv_cadence=None, det_setup_duration=20*u.minute):
return tel.det_setup(state, block, commands, apply_boresight_rot, iv_cadence, det_setup_duration)
def det_setup(state, block, commands=None, apply_boresight_rot=True,
iv_cadence=None, iv_kwargs=None, bias_step_kwargs=None,
det_setup_duration=20*u.minute):
return tel.det_setup(state, block, commands, apply_boresight_rot, iv_cadence, iv_kwargs, bias_step_kwargs, det_setup_duration)

@cmd.operation(name='sat.cmb_scan', return_duration=True)
def cmb_scan(state, block):
Expand Down Expand Up @@ -480,6 +482,8 @@ def make_operations(self, hwp_cfg=None, cmds_uxm_relock=None, cmds_det_setup=Non
'sched_mode': sched_mode,
'apply_boresight_rot': self.apply_boresight_rot,
'iv_cadence': self.iv_cadence,
'iv_kwargs': self.iv_kwargs,
'bias_step_kwargs': self.bias_step_kwargs,
'det_setup_duration': self.det_setup_duration,
'commands': cmds_det_setup,
},
Expand Down
7 changes: 4 additions & 3 deletions src/schedlib/policies/satp1.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ def __post_init__(self):
"################### Detector Setup######################",
"with disable_trace():",
" run.initialize()",
"run.smurf.iv_curve(concurrent=True, ",
" iv_kwargs={'run_serially': False, 'cool_wait': 60*5})",
"run.smurf.iv_curve(concurrent=True,",
f" iv_kwargs={self.iv_kwargs})",
"run.smurf.bias_dets(rfrac=0.5, concurrent=True)",
"time.sleep(180)",
"run.smurf.bias_step(concurrent=True)",
"run.smurf.bias_step(concurrent=True,",
f" bias_step_kwargs={self.bias_step_kwargs})",
"run.smurf.take_noise(concurrent=True, tag='bias_check')",
"#################### Detector Setup Over ####################",
"",
Expand Down
7 changes: 4 additions & 3 deletions src/schedlib/policies/satp2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ def __post_init__(self):
"################### Detector Setup######################",
"with disable_trace():",
" run.initialize()",
"run.smurf.iv_curve(concurrent=True, ",
" iv_kwargs={'run_serially': False, 'cool_wait': 60*5})",
"run.smurf.iv_curve(concurrent=True,",
f" iv_kwargs={self.iv_kwargs})",
"run.smurf.bias_dets(rfrac=0.5, concurrent=True)",
"time.sleep(180)",
"run.smurf.bias_step(concurrent=True)",
"run.smurf.bias_step(concurrent=True,",
f" bias_step_kwargs={self.bias_step_kwargs})",
"run.smurf.take_noise(concurrent=True, tag='bias_check')",
"#################### Detector Setup Over ####################",
"",
Expand Down
6 changes: 4 additions & 2 deletions src/schedlib/policies/satp3.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ def __post_init__(self):
"################### Detector Setup######################",
"with disable_trace():",
" run.initialize()",
"run.smurf.iv_curve(concurrent=True)",
"run.smurf.iv_curve(concurrent=True,",
f" iv_kwargs={self.iv_kwargs})",
"run.smurf.bias_dets(rfrac=0.5, concurrent=True)",
"time.sleep(300)",
"run.smurf.bias_step(concurrent=True)",
"run.smurf.bias_step(concurrent=True,",
f" bias_step_kwargs={self.bias_step_kwargs})",
"#################### Detector Setup Over ####################",
"",
]
Expand Down
18 changes: 13 additions & 5 deletions src/schedlib/policies/tel.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ def det_setup(
commands=None,
apply_rot=True,
iv_cadence=None,
iv_kwargs=None,
bias_step_kwargs=None,
det_setup_duration=20*u.minute,
min_cmb_duration=10*u.minute,
):
Expand Down Expand Up @@ -230,10 +232,11 @@ def det_setup(
"with disable_trace():",
" run.initialize()",
"run.smurf.iv_curve(concurrent=True, ",
" iv_kwargs={'run_serially': False, 'cool_wait': 60*5})",
f" iv_kwargs={iv_kwargs})",
"run.smurf.bias_dets(concurrent=True)",
"time.sleep(180)",
"run.smurf.bias_step(concurrent=True)",
"run.smurf.bias_step(concurrent=True,",
f" bias_step_kwargs={bias_step_kwargs})",
"run.smurf.take_noise(concurrent=True, tag='bias_check')",
"#################### Detector Setup Over ####################",
"",
Expand Down Expand Up @@ -372,7 +375,7 @@ def source_scan(state, block):
])
return state, block.duration.total_seconds(), commands

def bias_step(state, block, bias_step_cadence=None):
def bias_step(state, block, bias_step_cadence=None, bias_step_kwargs=None):
# -> should be done at a regular interval if bias_step_cadence is not None
doit = state.last_bias_step is None
if not doit:
Expand Down Expand Up @@ -402,8 +405,11 @@ def bias_step(state, block, bias_step_cadence=None):
last_bias_step_elevation = block.alt,
last_bias_step_boresight = block.boresight_angle,
)
return state, 60, ["run.smurf.bias_step(concurrent=True)",
f"run.wait_until('{(state.curr_time + dt.timedelta(seconds=60)).isoformat(timespec='seconds')}')"]
return state, 60, [
"run.smurf.bias_step(concurrent=True,",
f" bias_step_kwargs={bias_step_kwargs})",
f"run.wait_until('{(state.curr_time + dt.timedelta(seconds=60)).isoformat(timespec='seconds')}')",
]
else:
return state, 0, []

Expand Down Expand Up @@ -440,7 +446,9 @@ class TelPolicy:
drift_override: bool = True
allow_az_maneuver: bool = True
iv_cadence: float = 4 * u.hour
iv_kwargs: Dict[str, Any] = field(default_factory=dict)
bias_step_cadence: float = 0.5 * u.hour
bias_step_kwargs: Dict[str, Any] = field(default_factory=dict)
relock_cadence: float = 24 * u.hour
max_cmb_scan_duration: float = 1 * u.hour
cryo_stabilization_time: float = 0 * u.second
Expand Down