Using the following to produce a cubemodel with an invalid shaped data.
import stdatamodels.jwst.datamodels as dm, numpy as np
image = dm.ImageModel((5, 5))
cube = dm.CubeModel(image)
Saving to fits (cube.save("foo.fits")) fails with:
ValidationError: Wrong number of dimensions: Expected 3, got 2
Failed validating 'ndim' in schema['properties']['data']:
{'datatype': 'float32',
'default': 0.0,
'fits_hdu': 'SCI',
'ndim': 3,
'title': 'The science data'}
On instance['data']:
('array([[0., 0., 0., 0., 0.],\n'
' [0., 0., 0., 0., 0.],\n'
' [0., 0., 0., 0., 0.],\n'
' [0., 0., 0., 0., 0.],\n'
' [0., 0., 0., 0., 0.]], dtype=float32)')
Saving to asdf (cube.save("foo.asdf")) succeeds with no warnings.
Using the following to produce a cubemodel with an invalid shaped
data.Saving to fits (
cube.save("foo.fits")) fails with:Saving to asdf (
cube.save("foo.asdf")) succeeds with no warnings.