Fixed a bug in findextrema

master
Per A Brodtkorb 7 years ago
parent 7fcc4d18bd
commit a099f7ada7

@ -856,7 +856,7 @@ def ecross(t, f, ind, v=0):
(f[ind + 1] - f[ind])) (f[ind + 1] - f[ind]))
def _findcross(x, method='clib'): def _findcross(x, method='numba'):
'''Return indices to zero up and downcrossings of a vector '''Return indices to zero up and downcrossings of a vector
''' '''
if clib is not None and method == 'clib': if clib is not None and method == 'clib':
@ -989,7 +989,7 @@ def findextrema(x):
findcross findcross
crossdef crossdef
''' '''
dx = np.atleast_1d(diff(x)) dx = diff(np.atleast_1d(x).ravel())
return findcross(dx, 0.0) + 1 return findcross(dx, 0.0) + 1

@ -2651,7 +2651,7 @@ class SpecData1D(PlotData):
... m = res.mean() ... m = res.mean()
... sa = res.std() ... sa = res.std()
... # trueval, m, sa ... # trueval, m, sa
... np.abs(m-trueval)<sa ... np.abs(m-trueval) < 2*sa
True True
True True
True True
@ -3089,7 +3089,6 @@ class SpecData1D(PlotData):
>>> me, va, sk, ku = S.stats_nl(moments='mvsk') >>> me, va, sk, ku = S.stats_nl(moments='mvsk')
>>> S.tr = wtm.TrHermite(mean=me, sigma=Hs/4, skew=sk, kurt=ku, ysigma=Hs/4) >>> S.tr = wtm.TrHermite(mean=me, sigma=Hs/4, skew=sk, kurt=ku, ysigma=Hs/4)
>>> ys = wo.mat2timeseries(S.sim(ns=2**13)) >>> ys = wo.mat2timeseries(S.sim(ns=2**13))
>>> ys
>>> g0, gemp = ys.trdata() >>> g0, gemp = ys.trdata()
>>> t0 = g0.dist2gauss() >>> t0 = g0.dist2gauss()
>>> t1 = S0.testgaussian(ns=2**13, cases=50) >>> t1 = S0.testgaussian(ns=2**13, cases=50)
@ -4264,6 +4263,6 @@ def test_docstrings():
if __name__ == '__main__': if __name__ == '__main__':
# test_docstrings() test_docstrings()
test_mm_pdf() # test_mm_pdf()
# main() # main()

Loading…
Cancel
Save