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

Conversation

AERAdler
Copy link
Collaborator

@AERAdler AERAdler commented Mar 5, 2025

Like Katie asked. not sure about the xi/eta-> az/el correspondence.

@AERAdler AERAdler requested a review from keskitalo March 5, 2025 21:53
Copy link
Member

@keskitalo keskitalo left a comment

Choose a reason for hiding this comment

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

I think this PR still incomplete. You can tag people in the PR discussion if you want input before requesting a formal review.

Still, good that you opened the draft as I had some observations that will need to be addressed before we can merge.

try:
self.body = getattr(ephem, name)()
except:
raise RuntimeError("Failed to initialize {} from pyEphem".format(name))
self.corners = None
if (self.offset_from_sso is not None) and len(self.offset_from_sso)!=2:
Copy link
Member

Choose a reason for hiding this comment

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

Storing the offset as a tuple means that you have to parse it every time you need to apply it.

Instead, can you try adding a try-except statement where you parse offset_from_sso into self.offset_az and self.offset_el and raise an appropriate exception when that fails?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes that seems better.

if self.offset_from_sso:
xi_off = self.offset_from_sso[0]
eta_off = self.offset_from_sso[1]
az_newcen = xi_off + self.body.az
Copy link
Member

Choose a reason for hiding this comment

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

Thinking about this a little deeper now.. Does this really work? On-sky, the provided offset should always translate to the same angular distance. However, if you apply the offset in Az/El, the distance can be tiny when the telescope is pointing high in elevation. You probably need to apply the offset using pointing vectors and quaternions.

Copy link
Collaborator Author

@AERAdler AERAdler Mar 6, 2025

Choose a reason for hiding this comment

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

Looking at the coordinate pdf it has the following line page 10:
"One often encounters the approximation that amounts to ξ = −∆az/ cos(el), η = ∆el."
Maybe if I implement that it is good enough?

Copy link
Member

Choose a reason for hiding this comment

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

It is a little bit crude for large focalplanes like the SAT but we can certainly test it first.

@AERAdler
Copy link
Collaborator Author

AERAdler commented Mar 5, 2025

@tskisner Tagging you for advice on coordiate transformations

Copy link
Member

@keskitalo keskitalo left a comment

Choose a reason for hiding this comment

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

Very minor requests for the code. I would like to see a simulation that verifies the offsets are working as intended. See https://github.com/simonsobs/pwg-scripts/blob/master/pwg-tds/sim-sso/run.lat.sh

@@ -2654,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.

el_newcen = eta_off + self.body.alt
ra, dec = observer.radec_of(az_newcen, el_newcen)
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants