Skip to content

Commit

Permalink
Merge pull request #1619 from kecnry/niriss-r-transpose
Browse files Browse the repository at this point in the history
mosviz niriss parser: transpose R 2d spectra
  • Loading branch information
kecnry authored Sep 2, 2022
2 parents d157c22 + afbbc6f commit 1c9fef2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Imviz
Mosviz
^^^^^^

- R-grism 2D spectrum data are now loaded with the correct orientation. [#1619]

Specviz
^^^^^^^

Expand Down
10 changes: 9 additions & 1 deletion jdaviz/configs/mosviz/plugins/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,15 @@ def mos_niriss_parser(app, data_dir):
# The wavelength is stored in a WAVELENGTH HDU. This is
# a 2D array, but in order to be able to use Spectrum1D
# we use the average wavelength for all image rows
wav = temp[wav_hdus[sci]].data.mean(axis=0) * u.micron

if data.shape[0] > data.shape[1]:
# then the input data needs to be transposed, and wavelength
# needs to be averaged over axis=1 instead of axis=0
data = data.T
wav = temp[wav_hdus[sci]].data.mean(axis=1) * u.micron
else:
wav = temp[wav_hdus[sci]].data.mean(axis=0) * u.micron

spec2d = Spectrum1D(data * u.one, spectral_axis=wav, meta=meta)
spec2d.meta['INSTRUME'] = 'NIRISS'
spec2d.meta['mosviz_row'] = len(spec_labels_2d)
Expand Down

0 comments on commit 1c9fef2

Please sign in to comment.