Skip to content

Commit

Permalink
Added hermite polynomials to baseline option
Browse files Browse the repository at this point in the history
  • Loading branch information
etsmit committed Sep 28, 2023
1 parent 00874e7 commit fd654f8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
6 changes: 4 additions & 2 deletions src/dysh/spectra/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from astropy.io import fits
import astropy.units as u
#from astropy.table import Table
from astropy.modeling.polynomial import Polynomial1D,Chebyshev1D, Legendre1D
from astropy.modeling.polynomial import Polynomial1D,Chebyshev1D, Legendre1D, Hermite1D
from astropy.modeling.fitting import LevMarLSQFitter,LinearLSQFitter
from specutils import Spectrum1D, SpectrumList,SpectralRegion
from specutils.fitting import fit_continuum
Expand Down Expand Up @@ -229,7 +229,7 @@ def baseline(spectrum,order,exclude=None,**kwargs):
}
kwargs_opts.update(kwargs)

_valid_models = ["polynomial", "chebyshev","legendre"]
_valid_models = ["polynomial", "chebyshev","legendre","hermite"]
_valid_exclude_actions = ['replace','append',None]
# @todo replace with minimum_string_match
if kwargs_opts["model"] not in _valid_models:
Expand All @@ -240,6 +240,8 @@ def baseline(spectrum,order,exclude=None,**kwargs):
model = Chebyshev1D(degree=order)
elif kwargs_opts['model'] == "legendre":
model = Legendre1D(degree=order)
elif kwargs_opts['model'] == "hermite":
model = Hermite1D(degree=order)
else:
# should never get here, unless we someday allow user to input a astropy.model
raise ValueError(f'Unrecognized input model {kwargs["model"]}. Must be one of {_valid_models}')
Expand Down
Loading

0 comments on commit fd654f8

Please sign in to comment.