Created
March 13, 2018 18:40
-
-
Save pllim/48cc1e16af31bdc571569b3fabc00e78 to your computer and use it in GitHub Desktop.
Attempt to extract WCS from JWST spectrum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: import astropy | |
In [2]: astropy.__version__ | |
Out[2]: '3.1.dev21573' | |
In [3]: import asdf | |
In [4]: asdf.__version__ | |
Out[4]: '2.0.0.dev1248' | |
In [5]: import gwcs | |
In [6]: gwcs.__version__ | |
Out[6]: '0.8.0' | |
In [7]: from astropy.io import fits | |
In [8]: hdulist = fits.open('/grp/jwst/ssb/test_build7.1/examples_for_dms/level2 | |
...: /mir_lrs_fixedslit/jw00035001001_01101_00001_mirimage_x1d.fits') | |
In [9]: hdulist.info() | |
Filename: /grp/jwst/ssb/test_build7.1/examples_for_dms/level2/mir_lrs_fixedslit/jw00035001001_01101_00001_mirimage_x1d.fits | |
No. Name Ver Type Cards Dimensions Format | |
0 PRIMARY 1 PrimaryHDU 351 () | |
1 EXTRACT1D 1 BinTableHDU 26 387R x 8C [D, D, D, J, D, D, D, D] | |
2 ASDF 1 ImageHDU 7 (29547,) uint8 | |
In [10]: fa = asdf.fits_embed.AsdfInFits.open(hdulist) | |
In [11]: w = fa.tree['meta']['wcsinfo'] # fa['wcs'] does not work | |
In [12]: type(w) | |
Out[12]: dict | |
In [13]: w | |
Out[13]: | |
{'cdelt1': 0.11, | |
'cdelt2': 0.11, | |
'crpix1': 516.0, | |
'crpix2': 512.0, | |
'crval1': 5.63056810618, | |
'crval2': -72.0545718428, | |
'crval3': 0.0, | |
'ctype1': 'RA---TAN', | |
'ctype2': 'DEC--TAN', | |
'ctype3': 'WAVE', | |
'cunit1': 'deg', | |
'cunit2': 'deg', | |
'cunit3': 'micron', | |
'dec_ref': -72.0545718428, | |
'pc1_1': 1.0, | |
'pc1_2': 0.0, | |
'pc2_1': 0.0, | |
'pc2_2': 1.0, | |
'pc3_1': 0.0, | |
'pc3_2': 1.0, | |
'ra_ref': 5.63056810618, | |
'roll_ref': 3.812, | |
's_region': '0.0', | |
'v2_ref': -415.0568, | |
'v3_ref': -400.2337, | |
'v3yangle': 5.0152, | |
'wcsaxes': 3} | |
In [14]: gwcs.WCS(w) | |
... | |
TypeError: Expected forward_transform to be a model or a (frame, transform) list, got <class 'dict'> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment