2.5. utils.specutils_stis package¶
2.5.1. get_association_indices¶
- utils.specutils_stis.get_association_indices.get_association_indices(associations)¶
Given a list of associations, determines the indices that will be plotted. If n_associations > 3, this is the first, middle, and last associations, otherwise it’s all of them.
- Parameters:
associations (list) – All of the associations for this STIS spectrum.
- Returns:
list – The indices of the list that will be plotted.
2.5.2. plotspec¶
- utils.specutils_stis.plotspec(stis_spectrum, association_indices, stitched_spectra, 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 STIS1DSpectrum object from the READSPEC function and produces preview plots.
- Parameters:
stis_spectrum (STIS1DSpectrum) – STIS spectrum as returned by READSPEC.
association_indices (list) – The indices of the original list of associations for this spectrum that will be plotted. Used in the informational plot title, e.g., Association <x> of <y>., where <x> is the association index and <y> is the total number of associations in this spectrum.
stitched_spectra (list) – List of order-stitched spectra for each association, as created in utils.specutils.stitch_components().
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 (list) – 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.5.3. readspec¶
- utils.specutils_stis.readspec(input_file)¶
Reads in a STIS spectrum FITS file (x1d, sx1) and returns the wavelengths, fluxes, and flux uncertainties for the two (FUV segments) or three (NUV stripes).
- Parameters:
input_file (str) – Name of input FITS file.
- Returns:
STIS1DSpectrum – The spectroscopic data (wavelength, flux, flux error, etc):
2.5.4. stis1dspectrum¶
- class utils.specutils_stis.stis1dspectrum.STIS1DSpectrum(association_spectra, orig_file=None)¶
Bases:
object
Defines a STIS 1D spectrum (either “x1d” extracted or “sx1” summed extracted), including wavelegnth, flux, and flux errors. A STIS 1D spectrum object consists of N associations. If the file is an association, then N > 1, otherwise N = 1. Each of these N associations can contain M orders. If the association is an Echelle spectrum, then 24 < M < 70, depending on instrument configuration, otherwise M = 1. Each of these M orders contain typical spectral data (wavelengths, fluxes, etc.), stored as STISOrderSpectrum objects. The final data structure is then <STIS1DSpectrum>.associations[n].order[m].wavelengths (or .fluxes, .fluxerrs, etc.).
- Raises:
ValueError
- class utils.specutils_stis.stis1dspectrum.STISExposureSpectrum(order_spectra)¶
Bases:
object
Defines a STIS exposure spectrum, which consists of “M” STISOrderSpectrum objects.
- class utils.specutils_stis.stis1dspectrum.STISOrderSpectrum(nelem=None, wavelengths=None, fluxes=None, fluxerrs=None, dqs=None)¶
Bases:
object
Defines a STIS order spectrum, including wavelength, flux, flux errors, and data quality flags, which are stored as numpy arrays. A scalar int property provides the number of elements in this segment.