mpdaf icon indicating copy to clipboard operation
mpdaf copied to clipboard

Cube.wave object does not work anymore

Open Knusper opened this issue 1 year ago • 0 comments

When trying to get the wavelength for a particular index in a Cube object, I would usually do: cbe.wave[i], where [i] is the index of the layer and cbe is the Cube object.

For some reasons this fails now for a standard muse cube (created with CubeList.combine):

Here follows the error:

----> 1 cbe.wave[1]

File ~/miniconda3/envs/astropy_6/lib/python3.12/site-packages/mpdaf/obj/coords.py:1833, in WaveCoord.__getitem__(self, item)
   1831         else:
   1832             lbda = self.coord(pixel=self.shape + item)
-> 1833     return WaveCoord(crpix=1.0, cdelt=0, crval=lbda,
   1834                      cunit=self.unit, shape=1,
   1835                      ctype=self.wcs.wcs.ctype[0])
   1836 elif isinstance(item, slice):
   1837     if item.start is None:

File ~/miniconda3/envs/astropy_6/lib/python3.12/site-packages/mpdaf/obj/coords.py:1695, in WaveCoord.__init__(self, hdr, crpix, cdelt, crval, cunit, ctype, shape)
   1693 self.wcs.wcs.ctype[0] = ctype
   1694 self.wcs.wcs.crval[0] = crval
-> 1695 self.wcs.wcs.set()

SingularMatrixError: ERROR 3 in wcsset() at line 2868 of file cextern/wcslib/C/wcs.c:
Linear transformation matrix is singular.
ERROR 3 in linset() at line 702 of file cextern/wcslib/C/lin.c:
PCi_ja matrix is singular.

Knusper avatar Jul 22 '24 10:07 Knusper