Skip to content

Unable to write Spectrum1D as wcs1d-fits after using shift_spectrum_to() #1161

@bhgr216

Description

@bhgr216

After shifting a spectrum, attempting to write a Spectrum1D to a fits file with the format wcs1d-fits using Spectrum1D.write(format="wcs1d-fits") raises the following error: IndexError: index 6 is out of bounds for axis 0 with size 1. Using the same function with format="tabular-fits" works as expected.

I suspect this is because the wcs is not updated after the shift:

print(spectrum.wcs)
spectrum.shift_spectrum_to(redshift=0.5)
print(spectrum.wcs)

Output:

WCS Keywords

Number of WCS axes: 1
CTYPE : 'LINEAR' 
CRVAL : 5621.3397216801 
CRPIX : 1.0 
PC1_1  : 1.0 
CDELT : 1.577376238474 
NAXIS : 0  0
WCS Keywords

Number of WCS axes: 1
CTYPE : 'LINEAR' 
CRVAL : 5621.3397216801 
CRPIX : 1.0 
PC1_1  : 1.0 
CDELT : 1.577376238474 
NAXIS : 0  0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions