Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mosaic, WCS, skymatch #12

Open
zonca opened this issue Dec 17, 2019 · 19 comments
Open

Mosaic, WCS, skymatch #12

zonca opened this issue Dec 17, 2019 · 19 comments
Assignees

Comments

@zonca
Copy link
Member

zonca commented Dec 17, 2019

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 zonca self-assigned this Dec 17, 2019
@zonca
Copy link
Member Author

zonca commented Feb 18, 2020

@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
Copy link

nils-erik commented Feb 18, 2020 via email

@zonca
Copy link
Member Author

zonca commented Feb 19, 2020

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

@zonca
Copy link
Member Author

zonca commented Feb 19, 2020

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

@nils-erik
Copy link

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

@zonca
Copy link
Member Author

zonca commented Feb 20, 2020

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
Copy link
Member Author

zonca commented Mar 3, 2020

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
Copy link

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
Copy link
Member Author

zonca commented Mar 16, 2020

@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
Copy link
Member Author

zonca commented Mar 23, 2020

@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
Copy link
Contributor

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

@zonca
Copy link
Member Author

zonca commented Mar 25, 2020

from @ikashell:

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

@zonca
Copy link
Member Author

zonca commented Mar 25, 2020

  • Look for NIRSPEC parameter file, it should be similar to ours

@zonca
Copy link
Member Author

zonca commented Jul 28, 2020

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
Copy link
Member Author

zonca commented Sep 11, 2020

@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
Copy link
Member Author

zonca commented Sep 11, 2020

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

@zonca
Copy link
Member Author

zonca commented Sep 11, 2020

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
Copy link

nils-erik commented Sep 11, 2020 via email

@zonca
Copy link
Member Author

zonca commented Sep 16, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants