diff --git a/src/schedlib/policies/lat.py b/src/schedlib/policies/lat.py index 8db6dd6f..a3d01cd8 100644 --- a/src/schedlib/policies/lat.py +++ b/src/schedlib/policies/lat.py @@ -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 @@ -885,8 +885,6 @@ 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) @@ -894,13 +892,15 @@ def add_cal_target( 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()}" @@ -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, diff --git a/src/schedlib/policies/stages/build_op.py b/src/schedlib/policies/stages/build_op.py index f5e02116..c615df1a 100644 --- a/src/schedlib/policies/stages/build_op.py +++ b/src/schedlib/policies/stages/build_op.py @@ -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: diff --git a/src/schedlib/policies/tel.py b/src/schedlib/policies/tel.py index 19ccf69b..51362502 100644 --- a/src/schedlib/policies/tel.py +++ b/src/schedlib/policies/tel.py @@ -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 @@ -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: diff --git a/src/schedlib/source.py b/src/schedlib/source.py index 0a1f3aed..a083dd54 100644 --- a/src/schedlib/source.py +++ b/src/schedlib/source.py @@ -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 = { @@ -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 @@ -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