2.4. utils.specutils_jwst package

2.4.1. jwstspectrum

class utils.specutils_jwst.jwstspectrum.JWSTSpectrum(wl_arr, fl_arr, fle_arr, dq_arr, orig_file=None)

Bases: object

Defines a JWST spectrum, including wavelegnth, flux, flux errors, and DQ values.

Raises:

ValueError

2.4.2. plotspec

utils.specutils_jwst.plotspec(jwst_spectrum, output_type, output_file, flux_scale_factor, fluxerr_scale_factor, plot_metrics, dpi_val=96.0, output_size=1024, debug=False, full_ylabels=False, optimize=True)

Accepts a JWSTSpectrum object from the READSPEC function and produces preview plots.

Parameters:
  • jwst_spectrum (JWSTSpectrum) – JWST spectrum as returned by READSPEC.

  • output_type (str) – What kind of output to make?

  • output_file (str) – Name of output file (including full path).

  • flux_scale_factor (float) – Max. allowed ratio between the flux and a median flux value, used in edge trimming. Default = 10.

  • fluxerr_scale_factor (float) – Max. allowed ratio between the flux uncertainty and a median flux uncertainty value, used in edge trimming. Default = 5.

  • plot_metrics (dict) – Collection of plot metrics (flux statistics, axis ranges, etc.) to use when making the plots. These are computed using utils.specutils.calc_plot_metrics().

  • dpi_val (float) – The DPI value of your device’s monitor. Affects the size of the output plots. Default = 96. (applicable to most modern monitors).

  • output_size – Size of plot in pixels (plots are square in dimensions). Defaults to 1024.

  • output_size – int

  • debug (bool) – Should the output plots include debugging information (color-coded data points based on rejection criteria, shaded exclude regions)? Default = False.

  • full_ylabels (bool) – Should the y-labels contain the full values (including the power of 10 in scientific notation)? Default = False.

  • optimize (bool) – If set to True, will use a slightly optimized version of determining the plot covering fraction.

Raises:

OSError, utils.specutils.SpecUtilsError

Note

This function assumes a screen resolution of 96 DPI in order to generate plots of the desired sizes. This is because matplotlib works in units of inches and DPI rather than pixels.

2.4.3. readspec

utils.specutils_jwst.readspec(input_file)

Reads in a JWST spectrum FITS file (x1d, x1dints) and returns the wavelengths, fluxes, flux uncertainties, and DQ values.

Parameters:

input_file (str) – Name of input FITS file.

Returns:

JWSTSpectrum – The spectroscopic data (wavelength, flux, flux error, etc):

Raises:

KeyError