From a099f7ada7d3c1c6e4914ec21f7b9e3cdb481e53 Mon Sep 17 00:00:00 2001 From: Per A Brodtkorb Date: Mon, 6 Nov 2017 12:21:52 +0100 Subject: [PATCH] Fixed a bug in findextrema --- wafo/misc.py | 4 ++-- wafo/source/c_library/c_functions.c | 4 ++-- wafo/spectrum/core.py | 7 +++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/wafo/misc.py b/wafo/misc.py index 9f0d4df..2e399be 100644 --- a/wafo/misc.py +++ b/wafo/misc.py @@ -856,7 +856,7 @@ def ecross(t, f, ind, v=0): (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 ''' if clib is not None and method == 'clib': @@ -989,7 +989,7 @@ def findextrema(x): findcross crossdef ''' - dx = np.atleast_1d(diff(x)) + dx = diff(np.atleast_1d(x).ravel()) return findcross(dx, 0.0) + 1 diff --git a/wafo/source/c_library/c_functions.c b/wafo/source/c_library/c_functions.c index d7df721..8f2c2a2 100644 --- a/wafo/source/c_library/c_functions.c +++ b/wafo/source/c_library/c_functions.c @@ -14,8 +14,8 @@ */ void findrfc(double *y1,double hmin, int *ind, int n,int *info) { - double xminus,xplus,Tpl,Tmi,*y,Tstart; - int i,j,ix=0,NC,iy; + double xminus, xplus, Tpl, Tmi, *y, Tstart; + int i, j, ix=0, NC, iy; info[0] = 0; if (*(y1+0)> *(y1+1)){ /* if first is a max , ignore the first max*/ diff --git a/wafo/spectrum/core.py b/wafo/spectrum/core.py index b9d4ddd..3f6076b 100644 --- a/wafo/spectrum/core.py +++ b/wafo/spectrum/core.py @@ -2651,7 +2651,7 @@ class SpecData1D(PlotData): ... m = res.mean() ... sa = res.std() ... # trueval, m, sa - ... np.abs(m-trueval)>> 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) >>> ys = wo.mat2timeseries(S.sim(ns=2**13)) - >>> ys >>> g0, gemp = ys.trdata() >>> t0 = g0.dist2gauss() >>> t1 = S0.testgaussian(ns=2**13, cases=50) @@ -4264,6 +4263,6 @@ def test_docstrings(): if __name__ == '__main__': - # test_docstrings() - test_mm_pdf() + test_docstrings() + # test_mm_pdf() # main()