LSSTDESC / imSim

GalSim based Rubin Observatory image simulation package
https://lsstdesc.org/imSim
BSD 3-Clause "New" or "Revised" License
36 stars 15 forks source link

Simplify rotSkyPos calculation #469

Closed jmeyers314 closed 6 months ago

jmeyers314 commented 6 months ago

Updates readout.py:compute_rotSkyPos.

This routine had previously instantiated a complete WCS, marched separate test points a little north, and a little towards the CCD +Y to determine RotSkyPos empirically for insertion into the image header. The new routine follows notes I made at https://smtn-019.lsst.io/v/DM-44258/index.html, developing something closer to an analytic formula for determining RotSkyPos. The key insight is that RotSkyPos is intended to relate the camera orientation to ICRF north and not true north. Previous attempts I've seen at analytic relations use the telescope rotator angle (rotTelPos) and the parallactic angle, the latter being the position angle of zenith measured from true North (not ICRF North). This is the wrong north! So I invented the pseudo-parallactic angle which just swaps true north -> ICRF north. With that, plus acknowledging a few realities about how telescopes flip images around and other coordinate conventions, the analytic formula for Rubin becomes:

RotSkyPos = 270 - RotTelPos + pseudo-parallactic-angle.

I also clarified the documentation a bit, and fixed one line where the MJD was being interpreted in the (default) UTC time scale instead of the TAI scale.

Note that in the end, I've concluded we didn't make a mistake in simulating OR3. We were correct to use the regular parallactic angle inside batoid_wcs since the place where we use it relates true-of-date "observed" ra/dec coordinates with altitude and azimuth. A separate transformation handles true north <-> ICRF north, so we didn't need the pseudo parallactic angle for creating the WCS.

jmeyers314 commented 6 months ago

New code is still subject to the old test: https://github.com/LSSTDESC/imSim/blob/main/tests/test_readout.py#L198

If you think we need more than this though, I can probably figure out how to do a one-off calibrate.

jchiang87 commented 6 months ago

Ah, I forgot about that test (even though I wrote it). I guess it's fine, for now. It would be good to get rid of LsstCamImSim entirely, but that doesn't have to happen here.