MultiSpecModel

class jwst.datamodels.MultiSpecModel(init=None, **kwargs)[source]

Bases: jwst.datamodels.DataModel

A data model for multi-spec images.

This model has a special member spec that can be used to deal with an entire spectrum at a time. It behaves like a list:

>>> multispec_model.spec.append(spec_model)
>>> multispec_model.spec[0]
<SpecModel>

If init is a SpecModel instance, an empty SpecModel will be created and assigned to attribute spec[0], and the spec_table attribute from the input SpecModel instance will be copied to the first element of spec. SpecModel objects can be appended to the spec attribute by using its append method.

Parameters:init (any) – Any of the initializers supported by DataModel.

Examples

>>> output_model = datamodels.MultiSpecModel()
>>> spec = datamodels.SpecModel()       # for the default data type
>>> for slit in input_model.slits:
>>>     slitname = slit.name
>>>     slitmodel = ExtractModel()
>>>     slitmodel.fromJSONFile(extref, slitname)
>>>     column, wavelength, countrate = slitmodel.extract(slit.data)
>>>     otab = np.array(zip(column, wavelength, countrate),
>>>                     dtype=spec.spec_table.dtype)
>>>     spec = datamodels.SpecModel(spec_table=otab)
>>>     output_model.spec.append(spec)

Attributes Summary

schema_url

Attributes Documentation

schema_url = u'multispec.schema.yaml'