Skip to content

Commit e7409a0

Browse files
committed
Changed utils.resample to use a cubic spline interpolation
1 parent 4b37f4a commit e7409a0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

simphony/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from jax.typing import ArrayLike
1515
from sax.utils import get_ports
1616
from scipy.constants import c as SPEED_OF_LIGHT
17-
from scipy.interpolate import interp1d
17+
from scipy.interpolate import CubicSpline, interp1d
1818

1919
from simphony import __version__
2020

@@ -512,5 +512,6 @@ def resample(x: ArrayLike, xp: ArrayLike, sdict: sax.SDict) -> sax.SDict:
512512
"""
513513
new_sdict = {}
514514
for k, v in sdict.items():
515-
new_sdict[k] = jnp.interp(x, xp, v)
515+
cs = CubicSpline(xp, v)
516+
new_sdict[k] = cs(x)
516517
return new_sdict

0 commit comments

Comments
 (0)