Skip to content

Separate out wiregrid components #244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9778442
parse from cal_target table
mmccrackan Apr 14, 2025
dd0cca2
fix logic
mmccrackan Apr 14, 2025
9838efd
allow for both manual and table input
mmccrackan Apr 14, 2025
b58e0d2
add cal target overrides
mmccrackan Apr 15, 2025
3509d7a
fix override logic
mmccrackan Apr 15, 2025
e117962
more fixes, add ra/dec sources
mmccrackan Apr 15, 2025
dd109f4
add tel changes
mmccrackan Apr 15, 2025
8a17a87
add wiregrid, other fixes
mmccrackan Apr 15, 2025
8257b94
more fixes
mmccrackan Apr 15, 2025
b298915
more fixes, try both allow_partial False and True
mmccrackan Apr 15, 2025
9d1800f
fix typo on cal hwp direction
mmccrackan Apr 15, 2025
2dfd8c7
loop over possible wafers for satp1
mmccrackan Apr 15, 2025
732b1da
switch to hardcoded wafer selection
mmccrackan Apr 15, 2025
37e3ae5
try allow_partial=True if no sources found when allow_partial=False
mmccrackan Apr 23, 2025
830330c
various fixes
mmccrackan Apr 29, 2025
75cc0da
fix satp3 boresight
mmccrackan Apr 29, 2025
d33c4fd
add min_duration rule before source generation
mmccrackan Apr 29, 2025
8b54da0
loop over possible array_queries in order, change usage of allow_part…
mmccrackan Apr 29, 2025
2e0e631
ensure wiregrid blocks have hwp_dir
mmccrackan Apr 30, 2025
f3a8368
fix typo
mmccrackan Apr 30, 2025
e41fe56
Merge branch 'main' into 20250414_sched
mmccrackan May 1, 2025
d530f81
add boresight to wiregrid, assert for wiregrid el
mmccrackan May 1, 2025
491247c
fix typo
mmccrackan May 1, 2025
4f1f730
fix boresight handling for wiregrid
mmccrackan May 1, 2025
d6ff3f8
update cal target tag handling
mmccrackan May 2, 2025
c5f330f
filter calibration scans based on per-week source direction
mmccrackan May 2, 2025
d1adfb5
fix typo
mmccrackan May 6, 2025
0d07dd2
fix typo and make cal priority -1
mmccrackan May 6, 2025
3462d21
fix priorities
mmccrackan May 14, 2025
397a307
Merge branch 'main' into 20250414_sched
mmccrackan May 14, 2025
2a2069d
Merge branch 'main' into 20250414_sched
mmccrackan May 14, 2025
a41f029
separate out wiregrid components
mmccrackan May 15, 2025
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
79 changes: 56 additions & 23 deletions src/schedlib/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,29 @@
@dataclass(frozen=True)
class CalTarget:
source: str
array_query: str
array_query: Union(str, list)
el_bore: float
tag: str
t0: dt.datetime = None
t1: dt.datetime = None
boresight_rot: float = 0
allow_partial: bool = False
ra: float = None
dec: float = None
boresight_rot: float = None
allow_partial: Union(bool, list) = False
drift: bool = True
az_branch: Optional[float] = None
az_speed: Optional[float]= None
az_accel: Optional[float] = None
source_direction: Optional[str] = None
from_table: Optional[bool] = None
from_table: bool = False

@dataclass(frozen=True)
class WiregridTarget:
name: str
t0: dt.datetime
t1: dt.datetime
tag: str
boresight_rot: float = None

@dataclass(frozen=True)
class ScanBlock(core.NamedBlock):
Expand Down Expand Up @@ -333,14 +343,8 @@ def parse_sequence_from_toast_sat(ifile):
List of ScanBlock objects parsed from the input file.

"""

#columns = ["start_utc", "stop_utc", "rotation", "patch", "az_min", "az_max", "el", "pass", "sub"]
#columns = ["start_utc", "stop_utc", "rotation", "az_min", "az_max", "el", "pass", "sub", "patch"]
#columns = ["start_utc", "stop_utc", "hwp_dir", "rotation", "az_min", "az_max", "el", "pass", "sub", "patch"]
# columns = ["start_utc", "stop_utc", "hwp_dir", "rotation", "az_min", "az_max",
# "el", "speed", "accel", "#", "pass", "sub", "uid", "patch"]
columns = ["start_utc", "stop_utc", "hwp_dir", "rotation",
"az_min", "az_max", "el", "speed", "accel", "#", "pass",
"az_min", "az_max", "el", "speed", "accel", "priority", "type", "pass",
"sub", "uid", "patch"
]

Expand All @@ -354,22 +358,51 @@ def parse_sequence_from_toast_sat(ifile):
df = pd.read_csv(ifile, skiprows=i, delimiter="|", names=columns, comment='#')
blocks = []
for _, row in df.iterrows():
block = ScanBlock(
name=_escape_string(row['patch'].strip()),
if row['type'] != "None":
block = ScanBlock(
name=_escape_string(row['patch'].strip()),
t0=u.str2datetime(row['start_utc']),
t1=u.str2datetime(row['stop_utc']),
alt=row['el'],
az=row['az_min'],
az_speed=row['speed'],
az_accel=row['accel'],
throw=np.abs(row['az_max'] - row['az_min']),
boresight_angle=row['rotation'],
priority=row['priority'],
tag=_escape_string(row['uid'].strip()),
hwp_dir=(row['hwp_dir'] == 1) if 'hwp_dir' in row else None
)
blocks.append(block)
return blocks

def parse_wiregrid_targets_from_file(ifile):
columns = ["start_utc", "stop_utc", "type", "uid",
"remark"
]
# count the number of lines to skip
with open(ifile) as f:
for i, l in enumerate(f):
if l.startswith('#'):
continue
else:
break
df = pd.read_csv(ifile, skiprows=i, delimiter="|", names=columns, comment='#')
wiregrid_targets = []

for _, row in df.iterrows():
name = _escape_string(row['remark'].strip()).lower()
wiregrid_target = WiregridTarget(
name='wiregrid_gain' if 'gain' in name else 'wiregrid_time_const',
t0=u.str2datetime(row['start_utc']),
t1=u.str2datetime(row['stop_utc']),
alt=row['el'],
az=row['az_min'],
az_speed=row['speed'],
az_accel=row['accel'],
throw=np.abs(row['az_max'] - row['az_min']),
boresight_angle=row['rotation'],
priority=row['#'],
tag=_escape_string(row['uid'].strip()),
hwp_dir=(row['hwp_dir'] == 1) if 'hwp_dir' in row else None
)
blocks.append(block)
return blocks
# temporarily disable wiregrid time const measurements
if wiregrid_target.name == 'wiregrid_gain':
wiregrid_targets.append(wiregrid_target)

return wiregrid_targets

def parse_sequence_from_toast_lat(ifile):
"""
Expand Down
3 changes: 2 additions & 1 deletion src/schedlib/policies/lat.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
from .stages import get_build_stage
from .stages.build_op import get_parking
from . import tel
from .tel import State, CalTarget, make_blocks
from .tel import State, make_blocks
from ..instrument import CalTarget

logger = u.init_logger(__name__)

Expand Down
Loading