Skip to content

Commit

Permalink
GSF CubicInterpolation oscillation fix. (#46)
Browse files Browse the repository at this point in the history
* changed cubic spline to Pchip, fix #45

* add test for #45
  • Loading branch information
The-Ludwig authored Nov 21, 2024
1 parent ecb840d commit 23e4d3e
Show file tree
Hide file tree
Showing 3 changed files with 205 additions and 193 deletions.
4 changes: 2 additions & 2 deletions src/simweights/_fluxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from numpy import asarray, bool_, broadcast_arrays, exp, float64, genfromtxt, int32, piecewise, sqrt
from numpy import sum as nsum
from scipy.interpolate import CubicSpline # pylint: disable=import-error
from scipy.interpolate import PchipInterpolator # pylint: disable=import-error

from ._pdgcode import PDGCode

Expand Down Expand Up @@ -345,7 +345,7 @@ def __init__(self: GlobalSplineFitBase) -> None:
self._funcs = []
for z_low, z_high in self.groups:
self._funcs.append(
CubicSpline(energy, nsum(elements[z_low - 1 : z_high], axis=0), extrapolate=False, axis=0),
PchipInterpolator(energy, nsum(elements[z_low - 1 : z_high], axis=0), extrapolate=False, axis=0),
)


Expand Down
Loading

0 comments on commit 23e4d3e

Please sign in to comment.