oirlab / liger_iris_pipeline

Data Reduction System (DRS) for the Thirty Meter Telescope IRIS imager/spectrograph
https://oirlab.github.io/iris-pipeline
0 stars 3 forks source link

Mosaic, WCS, skymatch #12

Open zonca opened 4 years ago

zonca commented 4 years ago

From Nils:

I've simulated 3 images using the galactic center as a use case, each with a different dither.
The simulated images live in Galactica at: /data/group/data/iris/sim/iris_examples/gc_stars/example_field/

The dither amount in pixels is given in the file name, e.g. iris_sim_gc_filterKN3_ditherx25_dithery20.fits for a positive shift of 25 pixels in x and 20 pixels in y.

It contains the standard header keywords for containing the WCS coordinates, at least as recognizable by DS9. Let me know if there are any problems with the metadata or what needs to be included for space telescope.

zonca commented 4 years ago

@nils-erik I see that the WCS keywords are set in the header, however they do not display with DS9:

image

Can you please crosscheck?

nils-erik commented 4 years ago

Hi Andrea,

They show up for me.

[image: Screen Shot 2020-02-18 at 2.56.52 PM.png]

On Tue, Feb 18, 2020 at 12:53 PM Andrea Zonca notifications@github.com wrote:

@nils-erik https://github.com/nils-erik I see that the WCS keywords are set in the header, however they do not display with DS9:

[image: image] https://user-images.githubusercontent.com/383090/74777008-8412b780-524d-11ea-929c-10ac17f4f3f0.png

Can you please crosscheck?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/oirlab/iris_pipeline/issues/12?email_source=notifications&email_token=AJPG6OLSITFBWFWB7L3WGITRDRDETA5CNFSM4J3UYEPKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMEZFJQ#issuecomment-587829926, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJPG6OLZC5LZVTL3644HTPDRDRDETANCNFSM4J3UYEPA .

zonca commented 4 years ago

can you post the image directly to Github? attachments to emails are not supported.

zonca commented 4 years ago

I tested with a HST image and WCS worked fine, so I guess it is something wrong in the file.

nils-erik commented 4 years ago

Screen Shot 2020-02-18 at 2 56 52 PM

zonca commented 4 years ago

it is most probably related to the version of DS9, WCS works fine in DS9 7.5, but does not work on 8.1. Guess it is a problem in the WCS header, I will try to identify the issue.

zonca commented 4 years ago

JWST uses the drizzle algorithm to combine dithered images or mosaics, this is executed as part of the resample step which itself is part of the Stage 3 image processing pipeline image3.

Drizzle parameters are defined in the CRDS, see the schema

@ikashell is it fine if we use the same algorithm and adapt their pipeline to IRIS?

nils-erik commented 4 years ago

it is most probably related to the version of DS9, WCS works fine in DS9 7.5, but does not work on 8.1. Guess it is a problem in the WCS header, I will try to identify the issue.

I discovered the issue resulting in WCS not displaying in version 8 of ds9. In earlier versions, any invalid algorithm code for the CTYPE keyword in the header defaulted to a linear projection. In version 8 it appears that linear projections require a blank algorithm code (as was always true for spectral axes). I am regenerating the frames in the same directory (it will take a couple hours or so to go through the ~129k GC convolutions) to fix the keyword.

zonca commented 4 years ago

@nils-erik ds9 on my chromebook segfaults with your new files, it works fine (without WCS) on the old files. I will test again on my linux laptop when I get back to the office, which could be weeks, anyway this is not holding me up, the issue is only with ds9, astropy works fine with the WCS.

zonca commented 4 years ago

@arunsurya77 do you mind to test one of the files on Galactica in:

/data/group/data/iris/sim/iris_examples/gc_stars/example_field/

can you load it into ds9? does it display WCS information? what version of ds9 do you have?

arunsurya77 commented 4 years ago

Hi Andrea, I tried opening iris_sim_gc_filterKN3_ditherx-20dithery-35.fits iris_sim_gc_filterKN3_ditherx25.dithery20..fits and it opens with ds9 in galactica. the version is 7.5

zonca commented 4 years ago

from @ikashell:

drizzle is standard algorithm, we should use it as well. Need to test the algorithm and come out with reasonable parameters.

zonca commented 4 years ago
zonca commented 3 years ago

WCS with astropy works:

In [17]: wcs.WCS(f[0].header)                                                                                             
2020-07-27 18:55:03,591 - stpipe - WARNING - /home/azonca/anaconda3/envs/jwst_dev/lib/python3.6/site-packages/astropy/wcs/wcs.py:466: FITSFixedWarning: RADECSYS= 'FK5 ' / 
the RADECSYS keyword is deprecated, use RADESYSa.
  colsel=colsel)

2020-07-27 18:55:03,592 - stpipe - WARNING - /home/azonca/anaconda3/envs/jwst_dev/lib/python3.6/site-packages/astropy/wcs/wcs.py:466: FITSFixedWarning: EPOCH = '2019-12-17T00:40:46.48107737302794Z' / 
a floating-point value was expected.
  colsel=colsel)

Out[17]: 
WCS Keywords

Number of WCS axes: 2
CTYPE : 'RA--LINEAR'  'DEC-LINEAR'  
CRVAL : 265.197723389  -28.9921894073  
CRPIX : 2048.12  2048.12  
NAXIS : 4096  4096
zonca commented 3 years ago

@nils-erik I discovered that I need to create a "Generalized WCS" using the gwcs package, this package complaints that LINEAR is not a supported projection, the supported projections are:

    'AZP', 'SZP', 'TAN', 'STG', 'SIN', 'ARC', 'ZEA', 'AIR', 'CYP',
    'CEA', 'CAR', 'MER', 'SFL', 'PAR', 'MOL', 'AIT', 'COP', 'COE',
    'COD', 'COO', 'BON', 'PCO', 'TSC', 'CSC', 'QSC', 'HPX', 'XPH' 

Full names of the projections are available at https://docs.astropy.org/en/stable/_modules/astropy/modeling/projections.html

Do you know if LINEAR is equivalent to any of those?

zonca commented 3 years ago

I fixed this just assuming the projection was TAN instead of LINEAR.

zonca commented 3 years ago

here is the fixes I had to do to the input FITS to be able to use them with iris_pipeline: https://gist.github.com/568eda8286109688790fe34465dd3e64

nils-erik commented 3 years ago

Hi Andrea, Sounds good. I wasn't sure what projection was used for the GC coordinates I got from Tuan, but for testing purposes I'm sure TAN is fine. Cheers

On Fri, Sep 11, 2020 at 12:31 PM Andrea Zonca notifications@github.com wrote:

here is the fixes I had to do to the input FITS to be able to use them with iris_pipeline: https://gist.github.com/568eda8286109688790fe34465dd3e64 https://urldefense.com/v3/__https://gist.github.com/568eda8286109688790fe34465dd3e64__;!!Mih3wA!W4uJje4eXUX0GkBgX1Z4TWHVnWhkRQ1eO8t8L_n4KskhyJse7dYMFc2hJIhPcc_0$

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://urldefense.com/v3/__https://github.com/oirlab/iris_pipeline/issues/12*issuecomment-691274916__;Iw!!Mih3wA!W4uJje4eXUX0GkBgX1Z4TWHVnWhkRQ1eO8t8L_n4KskhyJse7dYMFc2hJNYHMaq1$, or unsubscribe https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AJPG6OIV7WMKPFNXAIKNSADSFJ3HNANCNFSM4J3UYEPA__;!!Mih3wA!W4uJje4eXUX0GkBgX1Z4TWHVnWhkRQ1eO8t8L_n4KskhyJse7dYMFc2hJCGBqESe$ .

zonca commented 3 years ago

ok, resample is running to completion on the first image and gives a reprojected output.

Input

image

Output

image

@arunsurya77 do you think this looks reasonable?