open

jwst.datamodels.open(init=None, extensions=None, **kwargs)[source]

Creates a DataModel from a number of different types

Parameters:
  • init (shape tuple, file path, file object, astropy.io.fits.HDUList,) –

    numpy array, dict, None

    • None: A default data model with no shape
    • shape tuple: Initialize with empty data of the given shape
    • file path: Initialize from the given file (FITS , JSON or ASDF)
    • readable file object: Initialize from the given file object
    • astropy.io.fits.HDUList: Initialize from the given HDUList
    • A numpy array: A new model with the data array initialized to what was passed in.
    • dict: The object model tree for the data model
  • extensions (list of AsdfExtension) – A list of extensions to the ASDF to support when reading and writing ASDF files.
Returns:

model

Return type:

DataModel instance