Skip to content

Instantly share code, notes, and snippets.

@pllim
Created March 13, 2018 14:32
Show Gist options
  • Save pllim/a1c0097daef479a5bec848aea9889d33 to your computer and use it in GitHub Desktop.
Save pllim/a1c0097daef479a5bec848aea9889d33 to your computer and use it in GitHub Desktop.
Attempt to get GWCS out of ASDF
In [1]: import asdf
In [2]: fa = asdf.open('miri_wcs.asdf')
.../yamlutil.py:248: UserWarning: tag:stsci.edu:gwcs/step-1.0.0 is not recognized, converting to raw Python data structure
"data structure".format(tag_name))
.../asdf/yamlutil.py:248: UserWarning: tag:stsci.edu:jwst_pipeline/v23tosky-0.7.0 is not recognized, converting to raw Python data structure
"data structure".format(tag_name))
.../asdf/yamlutil.py:248: UserWarning: tag:stsci.edu:gwcs/celestial_frame-1.0.0 is not recognized, converting to raw Python data structure
"data structure".format(tag_name))
.../asdf/yamlutil.py:248: UserWarning: tag:stsci.edu:gwcs/wcs-1.0.0 is not recognized, converting to raw Python data structure
"data structure".format(tag_name))
In [3]: w = fa['wcs']
In [4]: w
Out[4]: {'name': '', 'steps': [{'frame': <Frame2D(name="detector", unit=(Unit("pix"), Unit("pix")), axes_names=('x', 'y'), axes_order=(0, 1))>, 'transform': <CompoundModel57(offset_0=0., offset_1=0., offset_2=-0., offset_3=-0., offset_4=-4., c0_6=-12.78750038, c1_6=0.025, c0_7=-12.78750038, c1_7=0.025, c0_0_9=0.00000647, c1_0_9=-0.00020063, c2_0_9=0.00002433, c3_0_9=0.00000219, c4_0_9=-0.00000025, c0_1_9=2.82207821, c0_2_9=-0.00002873, c0_3_9=0.00000244, c0_4_9=0.00000016, c1_1_9=-0.00167748, c1_2_9=0.00000198, c1_3_9=0.00000181, c2_1_9=-0.00003313, c2_2_9=-0.00000019, c3_1_9=0.00000226, c0_0_10=0.00027793, c1_0_10=2.84373271, c2_0_10=0.00011154, c3_0_10=-0.00011824, c4_0_10=0.00000331, c0_1_10=0.00001385, c0_2_10=-0.00083572, c0_3_10=-0.00000011, c0_4_10=0.00000049, c1_1_10=-0.00001816, c1_2_10=-0.00006579, c1_3_10=0.00000018, c2_1_10=0.00000107, c2_2_10=0.0000033, c3_1_10=-0.00000026, c0_0_12=-1.54000068, c1_0_12=-0.02608358, c0_1_12=-0.00202991, c0_0_13=-7.22800207, c1_0_13=0.00202991, c0_1_13=-0.02608359, factor_17=-1., offset_18=-7.8, factor_19=60., factor_20=60., factor_21=0.00027778, factor_22=0.00027778)>}, {'frame': <Frame2D(name="v2v3", unit=(Unit("deg"), Unit("deg")), axes_names=('x', 'y'), axes_order=(0, 1))>, 'transform': {'angles': [0.12597594444444443, -0.10374516666666667, -146.0346882103227, 69.50303268957046, 80.46448431758834], 'axes_order': 'zyxyz', 'name': 'v23tosky'}}, {'frame': {'axes_names': ['lon', 'lat'], 'name': 'world', 'reference_frame': <ICRS Frame>, 'unit': [Unit("deg"), Unit("deg")]}}]}
In [5]: type(w)
Out[5]: asdf.tagged.TaggedDict
In [6]: import gwcs
In [7]: import astropy
In [8]: astropy.__version__
Out[8]: '3.1.dev21573'
In [9]: gwcs.__version__
Out[9]: '0.8.0'
In [10]: asdf.__version__
Out[10]: '2.0.0.dev1248'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment