c3-time-domain / SeeChange

A time-domain data reduction pipeline (e.g., for handling images->lightcurves) for surveys like DECam and LS4
BSD 3-Clause "New" or "Revised" License
0 stars 4 forks source link

Flaws in Image.from_exposure RA/Dec calculations #270

Open rknop opened 4 months ago

rknop commented 4 months ago

The code:

        width = new.raw_data.shape[1]
        height = new.raw_data.shape[0]

followed by

            wcs = WCS(new._header)
            sc = wcs.pixel_to_world(width // 2, height // 2)
            new.ra = sc.ra.to(u.deg).value
            new.dec = sc.dec.to(u.deg).value

won't quite get the RA and Dec of the center of the image, because this image has not yet been overscanned and trimmed. As such, the width and height is larger than that of the actual ccd (to which the WCS, ideally, should more or less correspond).

This error may be smaller than errors in default WCS sizes, but it would be worth trying to do this right.

rknop commented 4 months ago

The same problem exists when the function set_corners_from_wcs is called, as the image has not been trimmed yet.

rknop commented 4 months ago

I suggest that we update the image ra/dec and the four-corners attributes in the preprocessing overscan_and_trim step. (Move some of the code from from_exposure to a function, and call that function from preprocessing overscan_and_trim). Then, update both again after the WCS is solved. (This does mean the database is getting changed after it's created, but it will give us the best values in those fields for later usage in e.g. finding references.)