LoadAsAssociation

class jwst.associations.load_as_asn.LoadAsAssociation[source]

Bases: dict

Read in or create an association.

Notes

This class is normally not instantiated. The load() method should be used as the factory method to read an association or create one from a string or JwstDataModel object, or a list of such objects.

Methods Summary

load(obj[, meta, registry, rule, ...])

Load object and return an association of it.

Methods Documentation

classmethod load(obj, meta=None, registry=<class 'jwst.associations.registry.AssociationRegistry'>, rule=<class 'jwst.associations.association.Association'>, product_name_func=None)[source]

Load object and return an association of it.

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

The object to return as an association.

metadict or None

Metadata to attach to the association. If not given, a built-in default is used.

registryAssociationRegistry

The registry to use to load an association file with.

ruleAssociation

The rule to use if an association needs to be created.

product_name_funcfunc

A function, when given the argument of obj, or if obj is a list, each item in obj, returns a string that will be used as the product name in the association.

Returns:
associationAssociation

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.