Utility

class jwst.associations.lib.rules_level2_base.Utility[source]

Bases: object

Utility functions that understand DMS Level 2 associations.

Attributes Summary

asnreg_marked

asnreg_role

Methods Summary

finalize(associations)

Check validity and duplications in an association list.

merge_asns(associations)

Merge level2 associations.

rename_to_level2a(level1b_name[, ...])

Rename a Level 1b Exposure to another level.

resequence(*args, **kwargs)

Resequence the numbers to conform to level 3 associations.

sort_by_candidate(asns)

Sort associations by candidate.

Attributes Documentation

asnreg_marked = True
asnreg_role = 'utility'

Methods Documentation

static finalize(associations)[source]

Check validity and duplications in an association list.

Parameters:
associations[association[, …]]

List of associations.

Returns:
finalized_associations[association[, …]]

The validated list of associations.

static merge_asns(associations)[source]

Merge level2 associations.

Parameters:
associations[asn(, …)]

Associations to search for merging.

Returns:
associations[association(, …)]

List of associations, some of which may be merged.

static rename_to_level2a(level1b_name, use_integrations=False)[source]

Rename a Level 1b Exposure to another level.

Parameters:
level1b_namestr

The Level 1b exposure name.

use_integrationsbool

Use ‘rateints’ instead of ‘rate’ as the suffix.

Returns:
str

The Level 2a name.

static resequence(*args, **kwargs)[source]

Resequence the numbers to conform to level 3 associations.

Returns:
list[association, …] or None

If associations provided, resequenced order of provided associations.

static sort_by_candidate(asns)[source]

Sort associations by candidate.

Parameters:
asns[Association[,…]]

List of associations

Returns:
sorted_by_candidate[Associations[,…]]

New list of the associations sorted.

Notes

The current definition of candidates allows strictly alphabetical sorting:

aXXXX > cXXXX > oXXX

If this changes, a comparison function will need be implemented.