Skip to content

Commit

Permalink
transpose data object before creating 2d spectrum if orientation is R
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Aug 31, 2022
1 parent d157c22 commit c510e8e
Showing 1 changed file with 9 additions and 1 deletion.
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 orientation == 'R':
# 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 c510e8e

Please sign in to comment.