Handling 2D spectrum
Following a discussion with @johan.richard :
Previously it was possible to create an Image
with a wavelength axis (from a slice of a cube) and to create a Spectrum
from this "Image
" (e.g. sp = im[0,:]
). But this was removed when refactoring common operations in the DataArray
class, before it was practical (in terms of code) and also because it was difficult to keep the wcs and wave correctly (and because most of
Image` methods don't make sense for a 2D spectrum).
So instead of this, we could think about creating a new Spectrum2D
object for this use case. Another option would be adapt Spectrum
to work on 2d arrays, which would allow to use transparently all Spectrum
methods on a list of spectrum. This may be not too difficult to do.
On related notes, there was discussion recently on Astropy (https://github.com/astropy/astropy-APEs/blob/master/APE13.rst) to create a Spectrum1D
object similar to ours, which may handle 2d arrays (https://github.com/astropy/astropy-APEs/blob/master/APE13.rst#multi-dimensional-data). Maybe a good occasion to reduce code duplication.