Open bmiszalski opened 4 years ago
I think I tracked down the bug: the gwcs wcs is not API compatible with the astropy wcs, and wcs1d-fits assumes that spec.wcs
is the astropy one. As the SDSS-I/II spSpec does not specify a wcs, it instead uses the gwcs wcs system, even though the astropy one would be sufficient. There are three possible fixes that I can see (ordered by how invasive they are):
spec.wcs
to be anything other than an astropy wcs object).I can provide a PR with the first fix, but it seems like 2 or 3 are the real solution to fixing the bug.
Loading an SDSS spectrum with the 'SDSS-I/II spSpec' format loader and then writing to fits using format "wcs1d-fits" writer raises error:
ValueError: Only Spectrum1D objects with valid WCS can be written as wcs1d: 'SpectralGWCS' object has no attribute 'to_fits'
Please see attached fits file and minimum example script. We include in the script the output of running the script and environment info. SpectralGWCSBug.tar.gz