Last active
November 15, 2022 20:03
-
-
Save braingram/1e7505fd98f66fc6e0c5b8852bdda2eb to your computer and use it in GitHub Desktop.
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
import asdf | |
import jwst.datamodels | |
import numpy | |
af = asdf.AsdfFile({'data': numpy.zeros((10, 10), dtype='f4')}) | |
af.write_to('tmp.asdf') | |
with asdf.open('tmp.asdf', mode='r') as af: | |
m = jwst.datamodels.MultiExposureModel() | |
data = af['data'] | |
assert data.__class__.__name__ == 'NDArrayType' | |
im = jwst.datamodels.ImageModel() | |
im.data = data | |
im.err = data.copy() | |
im.dq = data.copy() | |
m.exposures.append(im) | |
m.save('foo.asdf') | |
m.save('foo.fits') |
Using NDArrayType from asdf produces the same result, a fits file with embedded asdf with no blocks in the asdf.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try creating the data as an instance of NDArray and see what happens (not that I've tried it myself).