Skip to content

Commit

Permalink
Make things return Tabular1D
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair committed Oct 31, 2018
1 parent 7edaecb commit db2f022
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions dkist/asdf_maker/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
import astropy.units as u
from astropy.io import fits
from astropy.time import Time
from gwcs.lookup_table import LookupTable
from astropy.modeling.models import (Shift, Linear1D, Multiply, Pix2Sky_TAN,
AffineTransformation2D, RotateNative2Celestial)
AffineTransformation2D, RotateNative2Celestial, Tabular1D)
from astropy.io.fits.hdu.base import BITPIX2DTYPE
from asdf.tags.core.external_reference import ExternalArrayReference

Expand Down Expand Up @@ -160,7 +159,7 @@ def time_model_from_date_obs(date_obs, date_bgn=None):
intercept = 0 * u.s
return linear_time_model(cadence=slope, reference_val=intercept)
else:
return LookupTable(deltas.to(u.s))
return Tabular1D(np.arange(deltas.size)*u.pix, deltas.to(u.s))


def spectral_model_from_framewave(framewav):
Expand All @@ -180,7 +179,7 @@ def spectral_model_from_framewave(framewav):
slope = ddeltas[0]
return linear_spectral_model(slope, wave_bgn)
else:
return LookupTable(framewav)
return Tabular1D(np.arange(framewav.size)*u.pix, framewav)


def make_asdf(filename, *, dataset, gwcs, **kwargs):
Expand Down
7 changes: 3 additions & 4 deletions dkist/asdf_maker/tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
from astropy.io import fits
from astropy.time import Time
from astropy.modeling import Model
from gwcs.lookup_table import LookupTable
from astropy.modeling.models import Linear1D
from astropy.modeling.models import Linear1D, Tabular1D

from dkist.asdf_maker.helpers import (make_asdf, linear_time_model, linear_spectral_model,
time_model_from_date_obs, references_from_filenames,
Expand Down Expand Up @@ -73,7 +72,7 @@ def test_time_from_dateobs_lookup(header_filenames):
date_obs = [fits.getheader(f)['DATE-OBS'] for f in header_filenames]
date_obs[5] = (Time(date_obs[5]) + 10*u.s).isot
time = time_model_from_date_obs(date_obs)
assert isinstance(time, LookupTable)
assert isinstance(time, Tabular1D)


def test_spectral_framewave(header_filenames):
Expand All @@ -90,7 +89,7 @@ def test_spectral_framewave(header_filenames):
assert isinstance(m, Linear1D)

m2 = spectral_model_from_framewave(framewave)
assert isinstance(m2, LookupTable)
assert isinstance(m2, Tabular1D)


def test_make_asdf(header_filenames, tmpdir):
Expand Down

0 comments on commit db2f022

Please sign in to comment.