Miscellaneous Utilities

jwst.lib.basic_utils Module

General utility objects.

Functions

disable_logging([level])

Disable logging within a context.

Classes

LoggingContext(logger[, level, handler, close])

Logging context manager.

jwst.lib.catalog_utils Module

Utilities for naming source catalogs.

Functions

replace_suffix_ext(filename, ...[, ...])

Replace the suffix and extension of a filename.

read_source_catalog(catalog_name)

Read a source catalog from file or validate an existing QTable.

Classes

SkyObject([label, xcentroid, ycentroid, ...])

Sky Object container for WFSS catalog information.

jwst.lib.dispaxis Module

Functions

get_dispersion_direction(exposure_type[, ...])

Get the dispersion direction.

jwst.lib.exposure_types Module

Module for lists of modes grouped in different ways.

Functions

is_nrs_lamp(datamodel)

Check if exposure type is nrs_lamp or nrs_autowave.

is_nrs_linelamp(datamodel)

Check if lamp state is lin or ref.

is_nrs_flatlamp(datamodel)

Check if lamp state is flat.

is_nrs_slit_linelamp(datamodel)

Check NRS slit line lamp.

is_nrs_ifu_linelamp(datamodel)

Check if lamp mode is ifu and lamp state is lin or ref.

is_nrs_ifu_flatlamp(datamodel)

Check if lamp mode is ifu and lamp state is flat.

is_nrs_ifu_lamp(datamodel)

Check if lamp mode is ifu and exposure type is nrs_lamp or nrs_autowave.

is_nrs_msaspec_lamp(datamodel)

Check if lamp mode is msaspec and exposure type is nrs_lamp or nrs_autowave.

is_nrs_msaspec_linelamp(datamodel)

Check if lamp mode is msaspec and lamp state is lin or ref.

is_nrs_msaspec_flatlamp(datamodel)

Check if lamp mode is msaspec and lamp state is flat.

is_nrs_autoflat(datamodel)

Check of exposure type is nrs_autoflat.

is_moving_target(datamodel)

Determine if a moving target exposure.

jwst.lib.file_utils Module

File utility functions.

Functions

pushdir(directory)

Temporarily change to specified directory.

jwst.lib.pipe_utils Module

Pipeline utilities objects.

Functions

is_tso(model)

Check if data is a Time Series Observation (TSO).

is_irs2(model)

Check whether the data are in IRS2 format.

match_nans_and_flags(input_model)

Ensure data, error, variance, and DQ are marked consistently for invalid data.

jwst.lib.pointing_summary Module

Pointing Summary.

Review contents of a set of given models for pointing information. Compare the calculated V1 and REFPOINT pointing with the proposed TARGET pointing.

Examples

>>> from stdatamodels.jwst.datamodels import ImageModel
>>> im = ImageModel()
>>> im.meta.target.ra = 90.75541666666666
>>> im.meta.target.dec = -66.56055555555554
>>> im.meta.pointing.ra_v1 = 91.08142004561715
>>> im.meta.pointing.dec_v1 = -66.60547868904696
>>> im.meta.wcsinfo.ra_ref = 90.70377653291781
>>> im.meta.wcsinfo.dec_ref = -66.59540223936895
>>> calc_pointing_deltas(im)
Delta(target=<SkyCoord (ICRS): (ra, dec) in deg
    (90.75541667, -66.56055556)>, v1=<SkyCoord (ICRS): (ra, dec) in deg
    (91.08142005, -66.60547869)>, refpoint=<SkyCoord (ICRS): (ra, dec) in deg
    (90.70377653, -66.59540224)>, delta_v1=<Angle 0.13712727 deg>, delta_refpoint=<Angle 0.04044315 deg>)
>>> t = calc_deltas([im])
>>> print(t.columns)
<TableColumns names=('exposure','target','v1','refpoint','delta_v1','delta_refpoint')>
>>> delta_v1 = t["delta_v1"][0]
>>> "%.13f" % delta_v1
'0.1371272716401'
>>> delta_refpoint = t["delta_refpoint"][0]
>>> "%.13f" % delta_refpoint
'0.0404431476150'

Functions

calc_pointing_deltas(model)

Calculate pointing deltas.

calc_deltas(exposures[, extra_meta])

Create table of pointing deltas.

Classes

Delta(target, v1, refpoint, delta_v1, ...)

jwst.lib.progress Module

Provide a visual progress bar facility.

The actual functionality is provided by the external library progress.

https://pypi.org/project/progress/

If the module is not available, then stub it out.

Functions

Bar(*args[, log_level, log_cutoff])

Actually use Bar only if logging level is appropriate.

jwst.lib.reffile_utils Module

Functions

is_subarray(input_model)

Check if a data model comes from a subarray readout.

ref_matches_sci(sci_model, ref_model)

Match science model to reference model.

get_subarray_model(sci_model, ref_model)

Get subarray model.

get_multistripe_subarray_model(sci_model, ...)

Create a multistripe subarray cutout of a reference file.

stripe_read(sci_model, ref_model, attribs)

Generate sub-model from science model multistripe params.

generate_stripe_array(ref_array, xsize_sci, ...)

Generate stripe array.

science_detector_frame_transform(data, ...)

Swap data array between science and detector frames.

detector_science_frame_transform(data, ...)

Swap data array between detector and science frames.

find_row(ldict, match_keys)

Find a row in a FITS table matching fields.

Classes

MatchRowError(message)

Raised when more than one row is matched in a FITS table or list of dict.

jwst.lib.set_velocity_aberration Module

Utilities for velocity aberration correction.

Script to add velocity aberration correction information to the FITS files provided to it on the command line (one or more).

It assumes the following keywords are present in the file header:

  • JWST_DX (km/sec)

  • JWST_DY (km/sec)

  • JWST_DZ (km/sec)

  • RA_REF (deg)

  • DEC_REF (deg)

The keywords added are:

  • VA_SCALE (dimensionless scale factor)

It does not currently place the new keywords in any particular location in the header other than what is required by the standard.

Functions

add_dva(filename[, force_level1bmodel])

Determine velocity aberration.

jwst.lib.signal_slot Module

A signal/slot implementation.

Classes

Signal(*funcs)

A Signal, when triggered, call the connected slots.

Signals

Manage the signals.

SignalsNotAClass(*args)

Must add a Signal Class.

jwst.lib.suffix Module

Suffix manipulation.

Notes

KNOW_SUFFIXES is the list used by remove_suffix. This list is generated by the function combine_suffixes. The function uses SUFFIXES_TO_ADD to add other suffixes that it would otherwise not discover or should absolutely be in the list. The function uses ‘SUFFIXES_TO_DISCARD` for strings found that are not to be considered suffixes.

Hence, to update KNOW_SUFFIXES, update both SUFFIXES_TO_ADD and SUFFIXES_TO_DISCARD as necessary, then use the output of find_suffixes.

Functions

remove_suffix(name)

Remove the suffix if a known suffix is already in name.

jwst.lib.wcs_utils Module

Functions

get_wavelengths(model[, exp_type, order, ...])

Read or compute wavelengths.