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:

The association candidate ID.

Return type:

str

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:

The association name in lowercase.

Return type:

str

current_product

Return last entry in products list.

Returns:

Last entry in products list.

Return type:

dict

from_items

The list of items that contributed to the association.

Returns:

List of items contributing to association.

Return type:

list

member_ids

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

Returns:

Set of member ids.

Return type:

set

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

The sequence number of the current association.

validity

Keeper of the validity tests.

Returns:

Dictionary of validity tests.

Return type:

dict

Methods Documentation

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

Create association if item belongs.

Parameters:
  • item (dict) – The item to initialize the association with.

  • version_id (str or None) – Version_Id to use in the name of this association. If None, nothing is added.

Returns:

2-tuple consisting of:

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

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

Return type:

(association, reprocess_list)

get_exposure()[source]

Get string representation of the exposure id.

Returns:

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

Return type:

str

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

Determine the exposure type of a pool item.

Parameters:
  • item (dict) – The pool entry to determine the exposure type of

  • default (str or None) – The default exposure type. If None, routine will raise LookupError

Returns:

exposure_type

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

Return type:

str

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:

grating – The Level3 Product name representation of the grating in use.

Return type:

str

get_instrument()[source]

Get string representation of the instrument.

Returns:

instrument – The Level3 Product name representation of the instrument

Return type:

str

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_elem – The Level3 Product name representation of the optical elements.

Return type:

str

get_slit_name()[source]

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

Returns:

slit_name – The Level3 Product name representation of the slit name.

Return type:

str

get_subarray()[source]

Get string representation of the subarray.

Returns:

subarray – The Level3 Product name representation of the subarray.

Return type:

str

get_target()[source]

Get string representation of the target.

Returns:

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

Return type:

str

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:

item (dict) – The item to check for.

Returns:

Item represents an AMI exposure.

Return type:

bool

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:

item (dict) – The item to check for.

Returns:

Item represents a true Coron exposure.

Return type:

bool

is_item_member(item)[source]

Check if item is a member of this association.

Parameters:

item (dict) – The item to check for.

Returns:

True if item is a member.

Return type:

bool

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:
  • item (dict) – The item to check for.

  • other_exp_types ([str[,...]] or None) – List of other exposure types to consider TSO-like.

Returns:

Item represents a TSO exposure.

Return type:

bool

is_member(new_member)[source]

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

Parameters:

new_member (Member) – The member to check for

Returns:

True if member is already in current product members list.

Return type:

bool

item_getattr(item, attributes)[source]

Return value from any of a list of attributes.

Parameters:
  • item (dict) – Item to retrieve from.

  • attributes (list) – List of attributes.

Returns:

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

Return type:

(attribute, value)

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:
  • item (dict or None) – Item to use as a source. If not given, item-specific information will be left unchanged.

  • member (Member 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 (Association) – The asn candidate to validate.

Returns:

True if candidate is valid.

Return type:

bool