gbrammer / msaexp

Manual extraction of JWST NIRSpec spectra
MIT License
26 stars 28 forks source link

get_transforms() failing for EGS (at high declinations?) #48

Closed themiyan closed 11 months ago

themiyan commented 1 year ago

Hi Gabe,

For EGS, meta_file.get_transforms function seems to fail to reproduce accurate mapping of the slits.

The polynomial coefficients for EGS Dec are quite off. i.e. expected declinations are ~ +52.8 but c0_0=67.74. Compared to values in COSMOS and UDS they all result in a significantly larger rms (see screenshot).

Screenshot 2023-09-25 at 15 27 06

Thus, the PolygonSkyRegion computed to match positions in the sky does not resemble to correct positions in the sky.

themiyan commented 11 months ago

Looking into this further, the issue is due to the msa.fits file having objects with RA and Dec =0. When polynomial fitting is happening for a given quadrant, this results in an incorrect fit. One could do is_src = (_shut['source_id'] > 0) & (has_offset) & (_shut['ra']>0) here https://github.com/gbrammer/msaexp/blob/d7368560cf465a0828e942454cfcc0bbe6870278/msaexp/msa.py#L530 to fix this. No general fix requited since this is a unique case since in general msa.fits file should not have sources that satisfy this criteria (this happens in this observation because there are IDs which are >99999 which required a seperate fix in the ST NIRSpec DRP).