From 93b6da97c07d6ddd39adb95c129b757e8f00a72d Mon Sep 17 00:00:00 2001 From: "Per.Andreas.Brodtkorb" Date: Thu, 1 Apr 2010 09:45:03 +0000 Subject: [PATCH] Updated SpecData1D.sim_nl doctest example --- pywafo/src/wafo/spectrum/core.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/pywafo/src/wafo/spectrum/core.py b/pywafo/src/wafo/spectrum/core.py index 9c88a1b..30a6bb7 100644 --- a/pywafo/src/wafo/spectrum/core.py +++ b/pywafo/src/wafo/spectrum/core.py @@ -1155,14 +1155,25 @@ class SpecData1D(WafoData): >>> import numpy as np >>> import scipy.stats as st - >>> x2 = S.sim_nl(ns=20000,cases=20) - >>> truth1 = [0,np.sqrt(S.moment(1)[0])] + S.stats_nl(moments='sk') + >>> x2, x1 = S.sim_nl(ns=20000,cases=20) + >>> truth1 = [0,np.sqrt(S.moment(1)[0][0])] + S.stats_nl(moments='sk') + >>> truth1[-1] = truth1[-1]-3 + >>> truth1 + >>> funs = [np.mean,np.std,st.skew,st.kurtosis] >>> for fun,trueval in zip(funs,truth1): ... res = fun(x2[:,1::], axis=0) ... m = res.mean() ... sa = res.std() - ... assert(np.abs(m-trueval)>> g0, gemp = ys.trdata() >>> t0 = g0.dist2gauss() >>> t1 = S0.testgaussian(ns=2**13, t0=t0, cases=50) + >>> sum(t1>t0)<5 + True - See also cov2sdat, dat2tr, troptset + See also cov2sdat, dat2tr, troptset ''' # Tested on: Matlab 5.3, 5.2, 5.1 # History: