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
10 changes: 5 additions & 5 deletions src/schedlib/policies/lat.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class LATPolicy(tel.TelPolicy):
corotator_override: float = None
elevations_under_90: bool = False
apply_corotator_rot: bool = True
radius: float = 0.3
radius: float = 1.0
corotator_offset: float = 0.0
corotator_bounds: list = field(default_factory=lambda: [-45.0, 45.0])
el_freq: float = 0.0
Expand Down Expand Up @@ -885,22 +885,22 @@ def add_cal_target(
'o6': 'o6_ws0,o6_ws1,o6_ws2', # lf
}

array_focus['all'] = ','.join([v for k, v in array_focus.items()])

elevation = float(elevation)
if corotator is None:
corotator = el_to_locked_corotator(elevation)
boresight = corotator_to_boresight(elevation, float(corotator))

focus = focus.lower()

focus_str = None
if focus == 'all':
focus_str = ','.join( [v for k,v in array_focus.items()] )
focus_tag = focus
elif focus in array_focus.keys():
focus_str = array_focus[focus]
focus_tag = focu_str
else:
focus_str = focus
focus_tag = focus

sources = src.get_source_list()
assert source in sources, f"source should be one of {sources.keys()}"
Expand All @@ -914,7 +914,7 @@ def add_cal_target(
array_query=focus_str,
el_bore=elevation,
boresight_rot=boresight,
tag=focus_str,
tag=focus_tag,
allow_partial=allow_partial,
drift=drift,
az_branch=az_branch,
Expand Down
6 changes: 6 additions & 0 deletions src/schedlib/policies/stages/build_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,12 @@ def _plan_block_operations(self, state, block, constraint,
logger.info(f"--> skipping block {block.name} because it's already past")
return state, []

if block.t1 > constraint.t1:
block = block.trim_right_to(constraint.t1)

if block is None:
return state, []

shift = 10
safet = get_traj_ok_time(block.az, block.az, block.alt, block.alt, state.curr_time, self.plan_moves['sun_policy'])
while safet <= state.curr_time:
Expand Down
9 changes: 7 additions & 2 deletions src/schedlib/policies/tel.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ def det_setup(
commands=None,
apply_rot=True,
iv_cadence=None,
det_setup_duration=20*u.minute
det_setup_duration=20*u.minute,
min_cmb_duration=10*u.minute,
):
# when should det setup be done?
# -> should always be done if the block is a cal block
Expand All @@ -213,7 +214,11 @@ def det_setup(
)
if iv_cadence is not None:
time_since_last = (state.curr_time - state.last_iv).total_seconds()
doit = doit or (time_since_last > iv_cadence)
if not doit:
# if not running det_setup for any other reason than cadence, skip it if the scan is too short
doit = (time_since_last > iv_cadence) and (state.curr_time + dt.timedelta(seconds=det_setup_duration) <= (block.t1 - dt.timedelta(seconds=min_cmb_duration)))
else:
doit = doit or (time_since_last > iv_cadence)

if doit:
if commands is None:
Expand Down
7 changes: 4 additions & 3 deletions src/schedlib/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def get_site(site='lat') -> Location:
FIXED_SOURCES = {
'taua': (5.5755*np.pi/12., 22.0167*np.pi/180.),
'rcw38': (8.98*np.pi/12., -47.5*np.pi/180.),
'galcenter': (17.7611*np.pi/12., -28.95*np.pi/180.)
'galcenter': (17.7611*np.pi/12., -28.95*np.pi/180.),
'3c279': (12.93643513*np.pi/12., -5.789313*np.pi/180.),
}
# source needs to be callable to avoid side effects
EPHEM_SOURCES = {
Expand Down Expand Up @@ -83,7 +84,7 @@ def add_fixed_source(name, ra, dec, ra_units='deg'):
return
if name in FIXED_SOURCES:
logging.warning(
f"name {name} already registered at {FIXED_SOURCES[name]}. "
f"name {name} already registered at {FIXED_SOURCES[name]}. "
"Not Adding"
)
return
Expand Down Expand Up @@ -425,7 +426,7 @@ def source_gen_seq(source: str, t0: dt.datetime, t1: dt.datetime) -> core.Blocks

def block_get_matching_src_block(block: core.Block, source: str) -> SourceBlock:
"""
Get the corresponding block for a source with the same time bounds. It is
Get the corresponding block for a source with the same time bounds. It is
primarily used for source avoidance calculation.

Parameters
Expand Down