Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import polyfit/val from numpy #207

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions grizli/fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -2513,7 +2513,7 @@ def xfit_redshift(self, prior=None,


"""
from numpy import polyfit, polyval
from numpy.polynomial.polynomial import polyfit, polyval
from scipy.stats import t as student_t
from scipy.special import huber
import peakutils
Expand Down Expand Up @@ -3480,7 +3480,7 @@ def objfun_scale(pscale, AxT, data, self, retval):
spectra
"""
import scipy.optimize
from numpy import polyval
from numpy.polynomial.polynomial import polyval

scale = self.compute_scale_array(pscale, self.wavef[self.fit_mask])
scale[-self.Nphot:] = 1.
Expand Down
2 changes: 1 addition & 1 deletion grizli/multifit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2751,7 +2751,7 @@ def fit_redshift(self, prior=None, poly_order=1, fwhm=1200,
fsps_templates=False):
"""TBD
"""
from scipy import polyfit, polyval
from numpy.polynomial.polynomial import polyfit, polyval

if zr is None:
zr = [0.65, 1.6]
Expand Down
2 changes: 1 addition & 1 deletion grizli/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -5144,7 +5144,7 @@ def tweak_align(direct_group={}, grism_group={}, max_dist=1., n_min=10, key=' ',
'prep.tweak_align')

from drizzlepac.astrodrizzle import AstroDrizzle
from scipy import polyfit, polyval
from numpy.polynomial.polynomial import polyfit, polyval

if len(direct_group['files']) < 2:
logstr = '# ! {0}: Only one direct image found, can\'t compute shifts'
Expand Down
4 changes: 2 additions & 2 deletions grizli/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def scale_AxT(p, Ax, spec_wave, Nphot, Next):
"""
Scale spectrum templates by polynomial function
"""
from scipy import polyval
from numpy.polynomial.polynomial import polyval

scale = np.ones(Ax.shape[1])
scale[:-Nphot] = polyval(p[::-1]/10., (spec_wave-1.e4)/1000.)
Expand All @@ -578,7 +578,7 @@ def objective_scale(p, Ax, data, spec_wave, fit_mask, sivarf, Nphot, Next, retur
spectra
"""
import scipy.optimize
from scipy import polyval
from numpy.polynomial.polynomial import polyval

scale = np.ones(Ax.shape[1])
scale[:-Nphot] = polyval(p[::-1]/10., (spec_wave-1.e4)/1000.)
Expand Down
Loading