RegionsModel

class stdatamodels.jwst.datamodels.RegionsModel(init=None, regions=None, **kwargs)

Bases: ReferenceFileModel

A model for a reference file of type “regions”.

Initialize the model.

Parameters:
initstr, None, optional

File name for input file in ASDF format from which to initialize the model.

regionsnp.ndarray, optional

An array mapping pixels to slices

**kwargs

Additional keyword arguments to pass to ReferenceFileModel

Attributes Summary

reftype

schema_url

The schema URI to validate the model against.

Methods Summary

get_primary_array_name()

Retrieve the name of the "primary" array for this model.

on_save([path])

Run a hook before writing a model to a file (FITS or ASDF).

to_fits()

Write a data model to a FITS file.

validate()

Check that required reference file keywords are set.

Attributes Documentation

reftype = 'regions'
schema_url = 'http://stsci.edu/schemas/jwst_datamodel/regions.schema'

The schema URI to validate the model against. If None, only basic validation of required metadata properties (filename, model_type) will occur.

Methods Documentation

get_primary_array_name()

Retrieve the name of the “primary” array for this model.

The primary array controls the size of other arrays that are implicitly created. If the schema has the “data” property, then this method returns “data”. Otherwise, it returns an empty string. This is intended to be overridden in the subclasses if the primary array’s name is not “data”.

Returns:
primary_array_namestr

The name of the primary array.

on_save(path=None)

Run a hook before writing a model to a file (FITS or ASDF).

Parameters:
initstr

The path to the file that we’re about to save to.

to_fits()

Write a data model to a FITS file.

Parameters:
initfile path or file object

The file to write to.

*args

Additional positional arguments passed to astropy.io.fits.writeto.

**kwargs

Additional keyword arguments passed to astropy.io.fits.writeto.

validate()

Check that required reference file keywords are set.