Skip to content

Commit

Permalink
ensure extracted spectra have the correct axis name in the output_frame
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-simpson committed Apr 13, 2021
1 parent 3d6cc90 commit 4b11d05
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion geminidr/core/primitives_spect.py
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,13 @@ def extract1DSpectra(self, adinputs=None, **params):
except (AttributeError, IndexError):
log.warning(f"Cannot find wavelength solution for {extname}")
wave_model = None
else:
axes_names = tuple(frame.axes_names[0]
for frame in ext.wcs.output_frame.frames
if isinstance(frame, cf.SpectralFrame))
if len(axes_names) != 1:
log.warning("Problem with identifying spectral axis "
f"for {extname}")

log.stdinfo(f"Extracting {num_spec} spectra from {extname}")
dispaxis = 2 - ext.dispersion_axis() # python sense
Expand Down Expand Up @@ -1545,7 +1552,8 @@ def extract1DSpectra(self, adinputs=None, **params):
in_frame = cf.CoordinateFrame(naxes=1, axes_type=['SPATIAL'],
axes_order=(0,), unit=u.pix,
axes_names=('x',), name='pixels')
out_frame = cf.SpectralFrame(unit=u.nm, name='world')
out_frame = cf.SpectralFrame(unit=u.nm, name='world',
axes_names=axes_names)
ext_spec.wcs = gWCS([(in_frame, wave_model),
(out_frame, None)])
ext_spec.hdr[ad._keyword_for('aperture_number')] = apnum
Expand Down

0 comments on commit 4b11d05

Please sign in to comment.