From a23ee332f3541cf118c71ec63fa8086fa334bdb5 Mon Sep 17 00:00:00 2001 From: "Sergey E. Koposov" Date: Sat, 16 Nov 2024 22:55:15 +0000 Subject: [PATCH] further test fixes --- py/rvspecfit/spec_inter.py | 5 ++--- tests/test_spline.py | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/py/rvspecfit/spec_inter.py b/py/rvspecfit/spec_inter.py index fe3f3e4..443058e 100644 --- a/py/rvspecfit/spec_inter.py +++ b/py/rvspecfit/spec_inter.py @@ -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: @@ -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']) diff --git a/tests/test_spline.py b/tests/test_spline.py index ef7947a..58e68fc 100644 --- a/tests/test_spline.py +++ b/tests/test_spline.py @@ -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)) @@ -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))