LoadAsLevel2Asn

class jwst.associations.load_as_asn.LoadAsLevel2Asn[source]

Bases: LoadAsAssociation

Read in or create a Level 2 association.

Methods Summary

load(obj[, basename])

Open object and return a Level 2 association of it.

model_product_name(model, _idx)

Produce a model product name based on the model.

name_with_index(basename, idx)

Produce a name with the basename and index appended.

Methods Documentation

classmethod load(obj, basename=None)[source]

Open object and return a Level 2 association of it.

Parameters:
objAssociation, str, dict, JwstDataModel, list of str, or list of JwstDataModel

The object to return as an association.

basenamestr

If specified, use as the basename, with an index appended.

Returns:
associationDMSLevel2bBase

An association created using given object.

Notes

Along with the attributes belonging to a Level 2 association, the filename is added here, if such a file was passed in. Otherwise a default value is given.

static model_product_name(model, _idx)[source]

Produce a model product name based on the model.

Parameters:
modelJwstDataModel

The model to get the name from.

_idxint

The parent method is sometimes passed an index, which this method ignores.

Returns:
product_namestr

The basename of filename from the model.

static name_with_index(basename, idx)[source]

Produce a name with the basename and index appended.

Parameters:
basenamestr

The base of the file name.

idxint

The current index of the added item.

Returns:
product_namestr

The concatenation of basename, ‘_’, and idx.

Notes

If the index is less than or equal to 1, no appending is done.