Skip to content

Commit

Permalink
Merge pull request #530 from parejkoj/no-attribute-dispersion
Browse files Browse the repository at this point in the history
Fix "no attribute dispersion" bug from issue #528
  • Loading branch information
nmearl committed Oct 9, 2019
2 parents 605623b + 265c9be commit cb8da72
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
4 changes: 2 additions & 2 deletions docs/custom_loading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ This again will be done in a separate python file and placed in the user's
@custom_writer("fits-writer")
def generic_fits(spectrum, file_name, **kwargs):
flux = spectrum.flux.value
disp = spectrum.dispersion.value
disp = spectrum.spectral_axis.value
meta = spectrum.meta
tab = Table([disp, flux], names=("dispersion", "flux"), meta=meta)
tab = Table([disp, flux], names=("spectral_axis", "flux"), meta=meta)
tab.write(file_name, format="fits")
Expand Down
4 changes: 2 additions & 2 deletions specutils/io/default_loaders/tabular_fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def tabular_fits_loader(file_name, column_mapping=None, **kwargs):
@custom_writer("tabular-fits")
def tabular_fits_writer(spectrum, file_name, **kwargs):
flux = spectrum.flux.value
disp = spectrum.dispersion.value
disp = spectrum.spectral_axis.value
meta = spectrum.meta

tab = Table([disp, flux], names=("dispersion", "flux"), meta=meta)
tab = Table([disp, flux], names=("spectral_axis", "flux"), meta=meta)

tab.write(file_name, format="fits")
14 changes: 1 addition & 13 deletions specutils/io/default_loaders/wcs_fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
from astropy import units as u
from astropy.io import fits
from astropy.wcs import WCS
from astropy.table import Table
from astropy.modeling import models, fitting

import shlex

from ...spectra import Spectrum1D
from ..registers import data_loader, custom_writer
from ..registers import data_loader

__all__ = ['wcs1d_fits_loader', 'wcs1d_fits_writer', 'non_linear_wcs1d_fits']

Expand Down Expand Up @@ -82,17 +81,6 @@ def wcs1d_fits_loader(file_name, spectral_axis_unit=None, flux_unit=None,
return Spectrum1D(flux=data, wcs=wcs, meta=meta)


@custom_writer("wcs-fits")
def wcs1d_fits_writer(spectrum, file_name, **kwargs):
flux = spectrum.flux.value
disp = spectrum.dispersion.value
meta = spectrum.meta

tab = Table([disp, flux], names=("dispersion", "flux"), meta=meta)

tab.write(file_name, format="fits")


def identify_iraf_wcs(origin, *args):
"""IRAF WCS identifier
Expand Down

0 comments on commit cb8da72

Please sign in to comment.