Skip to content
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

New SSOPatch offset_from_sso option #810

Draft
wants to merge 3 commits into
base: toast3
Choose a base branch
from
Draft
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
21 changes: 20 additions & 1 deletion src/toast/schedule_sim_ground.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,8 @@ def __init__(
el_min=0,
el_max=np.pi / 2,
elevations=None,
offset_eta=0,
offset_xi=0
):
self.name = name
self.weight = weight
Expand All @@ -425,6 +427,8 @@ def __init__(
self.el_min = el_min
self.el_max = el_max
self.el_max0 = el_max
self.offset_eta = offset_eta
self.offset_xi = offset_xi
self.parse_elevations(elevations)
try:
self.body = getattr(ephem, name)()
Expand All @@ -439,6 +443,11 @@ def update(self, observer):
"""
self.body.compute(observer)
ra, dec = self.body.ra, self.body.dec
if self.offset_eta !=0 or self.offset_xi !=0:
delta_az = -self.offset_xi*np.cos(self.body.alt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use this approximation for now, but you should add a comment about it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at the sim-sso/run.lat.sh I am a bit confused by how the boresight_offset arguments gel with our new offset of patches

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This the the opposite of what you are doing since your offset applies to the target. If, for example, the scheduler was told to only schedule el=50 scans, applying boresight offset in the old implementation would lead to the boresight actually being at a different elevation.

The way you implemented the offset, elevation constaints will be observed and we can specify separate offsets for different targets.

delta_el = self.offset_eta
ra, dec = observer.radec_of(self.body.az+delta_az, self.body.alt+delta_el)

# Synthesize 8 corners around the center
phi = ra
theta = dec
Expand Down Expand Up @@ -2643,7 +2652,7 @@ def parse_args(opts=None):
--patch name,weight,lon,lat,radius (center and radius)
--patch name,weight,lon_min,lat_max,lon_max,lat_min (rectangle)
--patch name,weight,lon1,lat1,lon2,lat2,...,lonN,latN (polygon, N>=3)
--patch name,SSO,weight,radius (Solar System Object)
--patch name,SSO,weight,radius,eta_off,xi_off (Solar System Object, last two optional offset for pointingnat specific place on fp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add square brackets around the optional fields: ,eta_off,xi_off => [,eta_off,xi_off] so it is immediately obvious they are optional?

There is also a missing space at pointingat.

--patch name,COOLER,weight,power,hold_time_min_h,hold_time_max_h,
cycle_time_h,az,el (Cooler cycle)
--patch name,HORIZONTAL,weight,azmin,azmax,el,scantime_min
Expand Down Expand Up @@ -3001,13 +3010,23 @@ def parse_patch_sso(args, parts):
name = parts[0]
weight = float(parts[2])
radius = float(parts[3]) * degree
if len(parts)==6:
offset_eta = float(parts[4])
offset_xi = float(parts[5])
log.info(f"SSO targeting offset by {offset_eta}, {offset_xi}")
else:
offset_eta = 0
offset_xi = 0

patch = SSOPatch(
name,
weight,
radius,
el_min=args.el_min_deg * degree,
el_max=args.el_max_deg * degree,
elevations=args.elevations_deg,
offset_eta = offset_eta,
offset_xi = offset_xi,
)
return patch

Expand Down