Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
jdtuck committed Mar 30, 2024
1 parent 3fb84a0 commit fadeaed
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions fdasrsf/geometry.py
Expand Up @@ -6,7 +6,7 @@
"""

from numpy import arccos, sin, cos, linspace, zeros, sqrt, finfo, double
from numpy import ones, diff, gradient, log
from numpy import ones, diff, gradient, log, logspace, any
from scipy.interpolate import UnivariateSpline
from scipy.integrate import trapezoid, cumulative_trapezoid

Expand Down Expand Up @@ -56,13 +56,13 @@ def gam_to_h(gam, smooth=True):
time = linspace(0, 1, TT)
binsize = diff(time)
binsize = binsize.mean()
s = np.logspace(-4,-1,10)
s = logspace(-4,-1,10)
cnt = 1
if gam.ndim == 1:
if smooth:
tmp_spline = UnivariateSpline(time, gam, s=1e-4)
d = tmp_spline.derivative()
while (np.any(d(time)<0)):
while (any(d(time)<0)):
tmp_spline = UnivariateSpline(time, gam, s=s[cnt])
cnt += 1
d = tmp_spline.derivative()
Expand All @@ -79,7 +79,8 @@ def gam_to_h(gam, smooth=True):
if smooth:
tmp_spline = UnivariateSpline(time, gam[:, i], s=1e-4)
d = tmp_spline.derivative()
while (np.any(d(time)<0)):
cnt = 1
while (any(d(time)<0)):
tmp_spline = UnivariateSpline(time, gam[:, i], s=s[cnt])
cnt += 1
d = tmp_spline.derivative()
Expand Down

0 comments on commit fadeaed

Please sign in to comment.