Skip to content

Commit

Permalink
further test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
segasai committed Nov 16, 2024
1 parent 77b0fdf commit a23ee33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions py/rvspecfit/spec_inter.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import numpy as np
import scipy.spatial
import scipy.interpolate
import pickle
import itertools
import importlib
from rvspecfit import make_nd
from rvspecfit import make_interpol
from rvspecfit import serializer


class TriInterp:
Expand Down Expand Up @@ -314,8 +314,7 @@ def getInterpolator(HR, config, warmup_cache=False, cache=None):
if HR not in cache:
savefile = (config['template_lib'] + '/' +
make_nd.INTERPOL_H5_NAME % HR)
with open(savefile, 'rb') as fd0:
fd = pickle.load(fd0)
fd = serializer.load_dict_from_hdf5(savefile)
log_spec = fd.get('log_spec') or True

(templ_lam, parnames) = (fd['lam'], fd['parnames'])
Expand Down
4 changes: 2 additions & 2 deletions tests/test_spline.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def test_lin():
y = 0.00001 * x**2 + np.random.normal(size=len(x))
xnew = np.random.uniform(1000, 2000, size=10000)
yref = scipy.interpolate.CubicSpline(x, y, bc_type='natural')(xnew)
ymy = rvspecfit.spliner.Spline(x, y, logstep=False)(xnew)
ymy = rvspecfit.spliner.Spline(x, y, log_step=False)(xnew)
assert (np.allclose(yref, ymy))


Expand All @@ -17,5 +17,5 @@ def test_loglin():
y = np.sin(x / 10) + np.random.normal(size=len(x))
xnew = np.random.uniform(1000, 2000, size=10000)
yref = scipy.interpolate.CubicSpline(x, y, bc_type='natural')(xnew)
ymy = rvspecfit.spliner.Spline(x, y, logstep=True)(xnew)
ymy = rvspecfit.spliner.Spline(x, y, log_step=True)(xnew)
assert (np.allclose(yref, ymy))

0 comments on commit a23ee33

Please sign in to comment.