Skip to content

Commit 8b72960

Browse files
committed
Proactive fixes of some things that will break in numpy 2.0.0
1 parent 2a10a82 commit 8b72960

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

capcalc/fit.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,7 @@ def mlregress(x, y, intercept=True):
15551555
xc = x
15561556
beta = np.ones(p)
15571557

1558-
solution = np.linalg.lstsq(np.mat(xc).T, np.mat(y).T, rcond=-1)
1558+
solution = np.linalg.lstsq(np.asmatrix(xc).T, np.asmatrix(y).T, rcond=-1)
15591559

15601560
# Computation of the coefficient of determination.
15611561
Rx = np.atleast_2d(np.corrcoef(x, rowvar=1))
@@ -1737,7 +1737,7 @@ def peakdetect(y_axis, x_axis=None, lookahead=200, delta=0.0):
17371737

17381738
# maxima and minima candidates are temporarily stored in
17391739
# mx and mn respectively
1740-
mn, mx = np.Inf, -np.Inf
1740+
mn, mx = np.inf, -np.inf
17411741

17421742
# Only detect peak if there is 'lookahead' amount of points after it
17431743
for index, (x, y) in enumerate(zip(x_axis[:-lookahead], y_axis[:-lookahead])):
@@ -1749,15 +1749,15 @@ def peakdetect(y_axis, x_axis=None, lookahead=200, delta=0.0):
17491749
mnpos = x
17501750

17511751
####look for max####
1752-
if y < mx - delta and mx != np.Inf:
1752+
if y < mx - delta and mx != np.inf:
17531753
# Maxima peak candidate found
17541754
# look ahead in signal to ensure that this is a peak and not jitter
17551755
if y_axis[index : index + lookahead].max() < mx:
17561756
max_peaks.append([mxpos, mx])
17571757
dump.append(True)
17581758
# set algorithm to only find minima now
1759-
mx = np.Inf
1760-
mn = np.Inf
1759+
mx = np.inf
1760+
mn = np.inf
17611761
if index + lookahead >= length:
17621762
# end is within lookahead no more peaks can be found
17631763
break
@@ -1767,15 +1767,15 @@ def peakdetect(y_axis, x_axis=None, lookahead=200, delta=0.0):
17671767
# mxpos = x_axis[np.where(y_axis[index:index+lookahead]==mx)]
17681768

17691769
####look for min####
1770-
if y > mn + delta and mn != -np.Inf:
1770+
if y > mn + delta and mn != -np.inf:
17711771
# Minima peak candidate found
17721772
# look ahead in signal to ensure that this is a peak and not jitter
17731773
if y_axis[index : index + lookahead].min() > mn:
17741774
min_peaks.append([mnpos, mn])
17751775
dump.append(False)
17761776
# set algorithm to only find maxima now
1777-
mn = -np.Inf
1778-
mx = -np.Inf
1777+
mn = -np.inf
1778+
mx = -np.inf
17791779
if index + lookahead >= length:
17801780
# end is within lookahead no more peaks can be found
17811781
break

0 commit comments

Comments
 (0)