Skip to content

Trouble reading and writing spectra with convenience functions read and write. #1069

@jkeohane

Description

@jkeohane

I am using specutils and I am having a problem doing a simple thing.
I made a spectrum, call it "spec" and I saved it to a fits file using:

spec.write(fname+'.fits', format='tabular-fits', overwrite=True)

Then I read the exact same file using:
spec_test = Spectrum1D.read(fname+'.fits', format='tabular-fits')

However, this does not work. Any ideas?

I get the following errors, see below:

spec.write(fname+'.fits', format='tabular-fits', overwrite=True)

spec_test = Spectrum1D.read(fname+'.fits', format='tabular-fits')
Traceback (most recent call last):

Cell In[941], line 1
spec_test = Spectrum1D.read(fname+'.fits', format='tabular-fits')

File ~/anaconda3/lib/python3.10/site-packages/astropy/nddata/mixins/ndio.py:59 in call
return self.registry.read(self._cls, *args, **kwargs)

File ~/anaconda3/lib/python3.10/site-packages/astropy/io/registry/core.py:218 in read
data = reader(*args, **kwargs)

File ~/anaconda3/lib/python3.10/site-packages/specutils/io/default_loaders/tabular_fits.py:87 in tabular_fits_loader
return generic_spectrum_from_table(tab, wcs=wcs, **kwargs)

File ~/anaconda3/lib/python3.10/site-packages/specutils/io/parsing_utils.py:258 in generic_spectrum_from_table
raise IOError("Could not identify column containing the flux")

OSError: Could not identify column containing the flux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions