diff --git a/pywafo/src/wafo/source/c_codes/c_functions.c b/pywafo/src/wafo/source/c_codes/c_functions.c index febbc6b..7725902 100644 --- a/pywafo/src/wafo/source/c_codes/c_functions.c +++ b/pywafo/src/wafo/source/c_codes/c_functions.c @@ -229,64 +229,64 @@ void disufq(double *rvec, double *ivec, kw1 = kw[ix]; Epij = kw1; for (i=0;i>> x = [] + >>> for i in range(20): + ... x2, x1 = S.sim_nl(ns=20000,cases=1) + ... x.append(x2[:,1::]) + >>> x2 = np.hstack(x) + >>> truth1 = [0,np.sqrt(S.moment(1)[0][0])] + S.stats_nl(moments='sk') + >>> truth1[-1] = truth1[-1]-3 + >>> truth1 + [0, 1.7495200310090628, 0.18673120577479821, 0.06198852126241805] + + >>> funs = [np.mean,np.std,st.skew,st.kurtosis] + >>> for fun,trueval in zip(funs,truth1): + ... res = fun(x2, axis=0) + ... m = res.mean() + ... sa = res.std() + ... #trueval, m, sa ... np.abs(m-trueval)1 + amp = np.array(amp.T).ravel() + rvec, ivec = c_library.disufq(amp.real, amp.imag, w, kw, water_depth, + g, nmin, nmax, cases, ns) + svec = rvec + 1J * ivec + else: + amp = amp.T + svec=[] + for i in range(cases): + rvec, ivec = c_library.disufq(amp[i].real, amp[i].imag, w, kw, water_depth, + g, nmin, nmax, 1, ns) + svec.append(rvec + 1J * ivec) + svec = np.hstack(svec) svec.shape = (cases, ns) x2o = fft(svec, axis=1).T # 2'nd order component @@ -3022,7 +3050,7 @@ class SpecData2D(WafoData): Example: >>> import wafo.spectrum.models as sm >>> D = sm.Spreading() - >>> SD = D.tospecdata2d(sm.Jonswap().tospecdata()) + >>> SD = D.tospecdata2d(sm.Jonswap().tospecdata(),nt=101) >>> m,mtext = SD.moment(nr=2,vari='xyt') >>> np.round(m,3),mtext (array([ 3.061, 0.132, -0. , 2.13 , 0.011, 0.008, 1.677, -0. , diff --git a/pywafo/src/wafo/spectrum/models.py b/pywafo/src/wafo/spectrum/models.py index 07b30cb..bd88885 100644 --- a/pywafo/src/wafo/spectrum/models.py +++ b/pywafo/src/wafo/spectrum/models.py @@ -447,9 +447,9 @@ class Jonswap(ModelSpectrum): N : scalar defining decay of high frequency part. (default 5) M : scalar defining spectral width around the peak. (default 4) method : String defining method used to estimate Ag when gamma>1 - 'integrate' : Ag = 1/gaussq(Gf*ggamspec(wn,N,M),0,wnc) (default) - 'parametric': Ag = (1+f1(N,M)*log(gamma)**f2(N,M))/gamma - 'custom' : Ag = Ag + 'integration': Ag = 1/gaussq(Gf*ggamspec(wn,N,M),0,wnc) (default) + 'parametric' : Ag = (1+f1(N,M)*log(gamma)**f2(N,M))/gamma + 'custom' : Ag = Ag wnc : wc/wp normalized cut off frequency used when calculating Ag by integration (default 6) Parameters