CARTAvis / carta

To CARTA users, this repo holds the CARTA release packages. Please use this repo to log bugs and feature requests. These will be triaged by the development team and prioritised as necessary in the development cycles.
19 stars 0 forks source link

Can't spatially match images with SIP #203

Open keflavich opened 8 months ago

keflavich commented 8 months ago

Files with FITS SIP headers won't spatially match. I'm not certain it's the SIP's fault, but maybe.

Could not enable spatial matching of jw01182004001_04101_00001_nrcblong_cal.fits to reference image jw01182004001_04101_00001_nrcalong_cal.fits.HDU_1_SCI. No valid transform was found.

This is a JWST _cal.fits file - you can get these from MAST in the L2 (level 2) pipeline products for any NIRCam observations.

Header:

Name = jw01182004001_04101_00001_nrcalong_destreak.fits
HDU = 1
Extension name = SCI
Data type = float
Shape = [2048, 2048] (RA, DEC)
Coordinate type = Right Ascension, Declination
Projection = TAN-SIP
Image reference pixels = [1024.5, 1024.5]
Image reference coords = [17:46:14.7145, -028.43.20.9506]
Image ref coords (deg) = [266.561 deg, -28.7225 deg]
Pixel unit = MJy/sr
Celestial frame = ICRS
RA range = [17:46:09.728, 17:46:19.699]
DEC range = [-28.44.26.323, -28.42.15.567]

The coordinates are displayed, though:

image
kswang1029 commented 8 months ago

I see the rendered ra and dec axes are swapped. Is that supposed to be?

keflavich commented 8 months ago

Yes, but with a gigantic "?" next to that yes. JWST observes on its side, so the CD1_1/CD2_2 matrices are always rotated 90 deg. The most natural way to display the pixel coordinates is therefore with RA vertical, dec horizontal. It is confusing as heck working with 90-deg rotates WCSes, but that's what blocking out the sun does for you.

kswang1029 commented 7 months ago

@keflavich would it be possible to have a test FITS image for diagnostics, please? @acdo2002 are you able to obtain a test image with SIP projection?

acdo2002 commented 7 months ago

@kswang1029 Ok, I am going to look at whether I can obtain JWST NIRCam L2 product with Projection = TAN-SIP

keflavich commented 7 months ago

Anything from the JWST archives on MAST should work; if you need me to, I can dig up a file

acdo2002 commented 7 months ago

Anything from the JWST archives on MAST should work; if you need me to, I can dig up a file

Many thanks for your report! We have obtained the JWST NIRCam level 2 products and I have confirmed the Spatial Matching does not work (with our current dev branch) for the CTYPE1 = "RA---TAN-SIP"and CTYPE2 = "DEC---TAIN-SIP" (file information of Projection = TAN-SIP for level 2c .crf.fits). and does not work correctly if the file information has Projection = TAN (resample image i2d.fits)

Please don't use level 2 JWST product with current released. CARTA but level 3 JWST product looks Ok, at least it can spatially matched well (quick check by my eyes) with MIRI-IFU and ALMA. And please let us know if you have any other problem with using CARTA on JWST or other IFU format data!

keflavich commented 2 months ago

Is there any chance you'll add support for SIP in a future release, and any idea on the timeline for that? I'm working with JWST archive produces that have (very) bad WCS solutions, and I need to be able to access and work with the SIP versions in order to derive appropriate corrections. My workflow without CARTA is clunky: either I have to use in-notebook visualizations or ds9.