-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
sean-lockwood
wants to merge
7
commits into
astropy:main
Choose a base branch
from
sean-lockwood:stis-loader-update
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+172
−33
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
DocsWe should probably also update the docs for "Working With SpectrumCollections" page |
sean-lockwood
commented
May 2, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:

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:

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