DMSBaseMixin

class jwst.associations.lib.dms_base.DMSBaseMixin(*args, **kwargs)[source]

Bases: ACIDMixin

Association attributes common to DMS-based Rules.

Attributes Summary

acid

Association candidate ID.

asn_name

The association name.

current_product

Return last entry in products list.

from_items

The list of items that contributed to the association.

member_ids

Set of all member ids in all products of this association.

sequence

The sequence number of the current association.

validity

Keeper of the validity tests.

Methods Summary

create(item[, version_id])

Create association if item belongs.

get_exposure()

Get string representation of the exposure id.

get_exposure_type(item[, default])

Determine the exposure type of a pool item.

get_grating()

Get string representation of the grating in use.

get_instrument()

Get string representation of the instrument.

get_opt_element()

Get string representation of the optical elements.

get_slit_name()

Get string representation of the slit name (NIRSpec fixed-slit only).

get_subarray()

Get string representation of the subarray.

get_target()

Get string representation of the target.

is_item_ami(item)

Determine whether the specific item represents AMI data or not.

is_item_coron(item)

Determine whether the specific item is coronagraphic data.

is_item_member(item)

Check if item is a member of this association.

is_item_tso(item[, other_exp_types])

Determine whether given item is TSO.

is_member(new_member)

Check if member is already a member of product members list.

item_getattr(item, attributes)

Return value from any of a list of attributes.

new_product([product_name])

Start a new product.

reset_sequence()

Reset sequence counter to one.

update_asn([item, member])

Update association meta information.

update_degraded_status()

Update association degraded status.

update_validity(entry)

Update validity checks for validity tests that aren't validated.

validate(asn)

Validate candidate against all asn validity tests.

Attributes Documentation

acid

Association candidate ID.

Returns:
str

The association candidate ID.

asn_name

The association name.

The name that identifies this association. When dumped, will form the basis for the suggested file name.

Typically, it is generated based on the current state of the association, but can be overridden.

Returns:
str

The association name in lowercase.

current_product

Return last entry in products list.

Returns:
dict

Last entry in products list.

from_items

The list of items that contributed to the association.

Returns:
list

List of items contributing to association.

member_ids

Set of all member ids in all products of this association.

Returns:
set

Set of member ids.

sequence = <jwst.associations.lib.counter.Counter object>

The sequence number of the current association.

validity

Keeper of the validity tests.

Returns:
dict

Dictionary of validity tests.

Methods Documentation

classmethod create(item, version_id=None)[source]

Create association if item belongs.

Parameters:
itemdict

The item to initialize the association with.

version_idstr or None

Version_Id to use in the name of this association. If None, nothing is added.

Returns:
(association, reprocess_list)

2-tuple consisting of:

  • association : The association or, if the item does not match this rule, None

  • [ProcessList[, …]]: List of items to process again.

get_exposure()[source]

Get string representation of the exposure id.

Returns:
exposurestr

The Level3 Product name representation of the exposure & activity id.

get_exposure_type(item, default='science')[source]

Determine the exposure type of a pool item.

Parameters:
itemdict

The pool entry to determine the exposure type of

defaultstr or None

The default exposure type. If None, routine will raise LookupError

Returns:
exposure_typestr

Exposure type. Can be one of

  • ‘science’: Item contains science data

  • ‘target_acquisition’: Item contains target acquisition data.

  • ‘autoflat’: NIRSpec AUTOFLAT

  • ‘autowave’: NIRSpec AUTOWAVE

  • ‘psf’: PSF

  • ‘imprint’: MSA/IFU Imprint/Leakcal

Raises:
LookupError

When default is None and an exposure type cannot be determined

get_grating()[source]

Get string representation of the grating in use.

Returns:
gratingstr

The Level3 Product name representation of the grating in use.

get_instrument()[source]

Get string representation of the instrument.

Returns:
instrumentstr

The Level3 Product name representation of the instrument

get_opt_element()[source]

Get string representation of the optical elements.

This includes only elements contained in the filter/pupil wheels of the instrument.

Returns:
opt_elemstr

The Level3 Product name representation of the optical elements.

get_slit_name()[source]

Get string representation of the slit name (NIRSpec fixed-slit only).

Returns:
slit_namestr

The Level3 Product name representation of the slit name.

get_subarray()[source]

Get string representation of the subarray.

Returns:
subarraystr

The Level3 Product name representation of the subarray.

get_target()[source]

Get string representation of the target.

Returns:
targetstr

The Level3 Product name representation of the target or source ID.

is_item_ami(item)[source]

Determine whether the specific item represents AMI data or not.

This simply includes items with EXP_TYPE=’NIS_AMI’.

Parameters:
itemdict

The item to check for.

Returns:
bool

Item represents an AMI exposure.

is_item_coron(item)[source]

Determine whether the specific item is coronagraphic data.

This will include all items in CORON_EXP_TYPES (both NIRCam and MIRI), except for NIRCam short-wave detectors included in a coronagraphic exposure but do not have an occulter in their field-of-view.

Parameters:
itemdict

The item to check for.

Returns:
bool

Item represents a true Coron exposure.

is_item_member(item)[source]

Check if item is a member of this association.

Parameters:
itemdict

The item to check for.

Returns:
bool

True if item is a member.

is_item_tso(item, other_exp_types=None)[source]

Determine whether given item is TSO.

This is used to determine the naming of files, i.e. “rate” vs “rateints” and “cal” vs “calints”.

Parameters:
itemdict

The item to check for.

other_exp_types[str[,…]] or None

List of other exposure types to consider TSO-like.

Returns:
bool

Item represents a TSO exposure.

is_member(new_member)[source]

Check if member is already a member of product members list.

Parameters:
new_memberMember

The member to check for

Returns:
bool

True if member is already in current product members list.

item_getattr(item, attributes)[source]

Return value from any of a list of attributes.

Parameters:
itemdict

Item to retrieve from.

attributeslist

List of attributes.

Returns:
(attribute, value)

Returns the value and the attribute from which the value was taken.

Raises:
KeyError

None of the attributes are found in the dict.

new_product(product_name='undefined')[source]

Start a new product.

classmethod reset_sequence()[source]

Reset sequence counter to one.

update_asn(item=None, member=None)[source]

Update association meta information.

Parameters:
itemdict or None

Item to use as a source. If not given, item-specific information will be left unchanged.

memberMember or None

An association member to use as source. If not given, member-specific information will be update from current association/product membership.

Notes

If both item and member are given, information in member will take precedence.

update_degraded_status()[source]

Update association degraded status.

update_validity(entry)[source]

Update validity checks for validity tests that aren’t validated.

classmethod validate(asn)[source]

Validate candidate against all asn validity tests.

Parameters:
asn~jwst.association.Association

The asn candidate to validate.

Returns:
bool

True if candidate is valid.