Skip to content

Commit

Permalink
Merge 7d206e9 into ebb1bdd
Browse files Browse the repository at this point in the history
  • Loading branch information
drdavella committed Feb 15, 2019
2 parents ebb1bdd + 7d206e9 commit 8e8cf8e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions specutils/io/default_loaders/jwst_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,17 @@ def jwst_loader(filename, spectral_axis_unit=None, **kwargs):
if hdu.name != 'EXTRACT1D':
continue

wavelength = hdu.data['WAVELENGTH'] * u.Unit(hdu.header['TUNIT1'])
flux = hdu.data['FLUX'] * u.Unit(hdu.header['TUNIT2'])
error = hdu.data['ERROR'] * u.Unit(hdu.header['TUNIT3'])
# Provide reasonable defaults based on the units assigned by the
# extract1d step of the JWST pipeline. TUNIT fields should be
# populated by the pipeline, but it's apparently possible for them
# to be missing in some files.
wavelength_units = u.Unit(hdu.header.get('TUNIT1', 'um'))
flux_units = u.Unit(hdu.header.get('TUNIT2', 'mJy'))
error_units = u.Unit(hdu.header.get('TUNIT3', 'mJy'))

wavelength = hdu.data['WAVELENGTH'] * wavelength_units
flux = hdu.data['FLUX'] * flux_units
error = hdu.data['ERROR'] * error_units

meta = dict(slitname=hdu.header.get('SLTNAME', ''))

Expand Down

0 comments on commit 8e8cf8e

Please sign in to comment.