Skip to content

Improvements to the HST/STIS data loaders #1233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

sean-lockwood
Copy link

@sean-lockwood sean-lockwood commented May 2, 2025

Echelle datasets

HST/STIS can have multivalued wavelengths where echelle orders overlap. Simply sorting by wavelength will interleave high- and low-SNR data near the edges of these orders. Rather than solving the complex task of combining orders into a single 1D spectrum, we created a second loader, "HST/STIS multi", to handle loading individual orders into rows of a SpectrumCollection object.

Orders (each with independent wavelength solutions) overlap, so simply sorting by wavelength and combining all orders leads to non-physical Δλ. Here's an example showing the overlaps:
image

The edges of orders have especially variable throughput and SNR (mainly due to the blaze function shape), so interleaving in the overlap regions would be non-physical:
image

Multi-read datasets

Additionally, some STIS datasets contain multiple reads (i.e. when REPEATOBS > 1, or CRSPLIT > 1 and CRCORR="OMIT"). These reads are stored as additional FITS extensions. Any multi-read dataset also produces a SpectrumCollection object via the "HST/STIS multi" reader. The old reader used only the first extension.

Metadata

We supplemented the meta information with the relevant SCI extension header, as well as the scalar table values describing the 1D extraction parameters for each order.

Data masking

We used the STIS data quality (DQ) array, masked via bitwise-and with an SDQFLAGS (serious DQ flags) scalar value to produce a boolean mask. STIS DQ values are integers, allowing the user to choose which DQ flags are relevant to their analysis via the selection of the SDQFLAGS value. By default, this value is read from the relevant SCI extension header. We also provided the capability for users to override this value by specifying "sdqflags=" to the STIS data readers.

Caveat about echelle wavelength ordering

Note that while the wavelengths of any individual STIS echelle order are in ascending ordered, the order of the wavelengths across echelle orders is descending (corresponding to increasing SPORDER number). This was chosen to remain consistent with the source data.

Flux units

While "Unit('erg/cm**2 Angstrom s')" appears to evaluate as intended, we used a more explicit formulation.

Identifiers

We modified the identifiers to not raise an exception upon the non-detection of a FITS header keyword.

Testing

Updated HST/STIS test_loaders tests.
New test data covering different file dimensionality are available at:
https://zenodo.org/records/15320389

Updated CHANGES.rst

sean-lockwood and others added 4 commits May 1, 2025 18:08
Echelle datasets:
STIS can have multivalued wavelengths where echelle orders overlap.  Simply sorting by
wavelength will interleave high- and low-SNR data near the edges of these orders.  Rather
than solving the complex task of combining orders into a single 1D spectrum, we created
a second loader, "HST/STIS multi", to handle loading individual orders into rows of a
SpectrumCollection object.

Multi-read datasets:
Additionally, some STIS datasets contain multiple reads (i.e. when REPEATOBS > 1 or
OCRREJECT="OMIT").  These reads are stored as additional FITS extensions.  Any multi-read
dataset also produces a SpectrumCollection object via the "HST/STIS multi" reader.

Metadata:
We supplemented the meta information with the relevant SCI extension header, as well as
the scalar table values describing the 1D extraction parameters for each order.

Data masking:
We used the STIS data quality (DQ) array, masked via bitwise-and with an SDQFLAGS
(serious DQ flags) scalar value to produce a boolean mask.  STIS DQ values are
integers, allowing the user to choose which DQ flags are relevant to their analysis via
the selection of the SDQFLAGS value.  By default, this value is read from the relevant
SCI extension header.  We also provided the capability for users to override this value
by specifying "sdqflags=<int>" to the STIS data readers.

Caveat about echelle wavelength ordering:
Note that while the wavelengths of any individual STIS echelle order are in ascending
ordered, the order of the wavelengths across echelle orders is descending (corresponding
to increasing SPORDER number).  This was chosen to remain consistent with the source
data.

Flux units:
While "Unit('erg/cm**2 Angstrom s')" appears to evaluate as intended, we
used a more explicit formulation.

Identifiers:
We modified the identifiers to not raise an exception upon the non-detection
of a FITS header keyword.
New test data covering different file dimensionality are available at:
https://zenodo.org/records/15320389
@sean-lockwood
Copy link
Author

Docs

We should probably also update the docs for "Working With SpectrumCollections" page
to include this list of readers as done with Spectrum1D (SpectrumCollection.read.list_formats()).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants