When subtracting longitude angles representing on sky positions, it is essential to put the difference into the range (-pi, pi) before doing anything with it.
The symptom was that Jupiter signal didn't show up in some planet sims in some cases. It took a long time to trace this.
The x= dazcos(el) and y = del results are used to look up the beam shape. In SO, focal planes are quite large, and the telescopes can point near zenith. The (daz cos(el), del) approximation has significant curvature as el approaches 90 degrees. So I think this code should be rewritten to use (xi, eta) coords instead of (daz * cos el, el). The route via quaternions (it appears qarray has everything you'd need for this) will make the az branch irrelevant.
When subtracting longitude angles representing on sky positions, it is essential to put the difference into the range (-pi, pi) before doing anything with it.
https://github.com/simonsobs/sotodlib/blob/4922b42323d02be6a38103d0284695c056b1c22a/sotodlib/toast/ops/sim_sso.py#L440
The symptom was that Jupiter signal didn't show up in some planet sims in some cases. It took a long time to trace this.
The x= dazcos(el) and y = del results are used to look up the beam shape. In SO, focal planes are quite large, and the telescopes can point near zenith. The (daz cos(el), del) approximation has significant curvature as el approaches 90 degrees. So I think this code should be rewritten to use (xi, eta) coords instead of (daz * cos el, el). The route via quaternions (it appears qarray has everything you'd need for this) will make the az branch irrelevant.