Created
March 19, 2018 19:24
-
-
Save drdavella/c4b749e15eef4a1ed7e992cb3f5b5a0c to your computer and use it in GitHub Desktop.
Easily reproduce ASDF-in-FITS object for testing
This file contains 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
# coding: utf-8 | |
from astropy.io import fits | |
from astropy.io.fits import HDUList, ImageHDU | |
from asdf.fits_embed import AsdfInFits | |
import numpy as np | |
get_ipython().run_line_magic('rm', '-f asdf.fits') | |
image = ImageHDU(np.random.random(1000)) | |
hdulist = HDUList() | |
hdulist.append(image) | |
tree = { | |
'image': image.data | |
} | |
af = AsdfInFits(hdulist, tree) | |
af.write_to('asdf.fits') | |
hdu = hdulist[1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment