def cdflomax(x, alpha, m0): """ Return CDF for local maxima for a zero-mean Gaussian process Parameters ---------- x : array-like evaluation points alpha, m0 : real scalars irregularity factor and zero-order spectral moment (variance of the process), respectively. Returns ------- prb : ndarray distribution function evaluated at x Notes ----- The cdf is calculated from an explicit expression involving the standard-normal cdf. This relation is sometimes written as a convolution M = sqrt(m0)*( sqrt(1-a^2)*Z + a*R ) where M denotes local maximum, Z is a standard normal r.v., R is a standard Rayleigh r.v., and "=" means equality in distribution. Note that all local maxima of the process are considered, not only crests of waves. Examples -------- >>> import pylab >>> import wafo.gaussian as wg >>> import wafo.spectrum.models as wsm >>> import wafo.objects as wo >>> import wafo.stats as ws >>> S = wsm.Jonswap(Hm0=10).tospecdata(); >>> xs = S.sim(10000) >>> ts = wo.mat2timeseries(xs) >>> tp = ts.turning_points() >>> mM = tp.cycle_pairs() >>> m0 = S.moment(1)[0] >>> alpha = S.characteristic('alpha')[0] >>> x = np.linspace(-10,10,200); >>> mcdf = ws.edf(mM.data) h = mcdf.plot(), pylab.plot(x,wg.cdflomax(x,alpha,m0)) See also -------- spec2mom, spec2bw """ c1 = 1.0 / (sqrt(1 - alpha ** 2)) * x / sqrt(m0) c2 = alpha * c1 return cdfnorm(c1) - alpha * exp(-x ** 2 / 2 / m0) * cdfnorm(c2)
def cdflomax(x, alpha, m0): """ Return CDF for local maxima for a zero-mean Gaussian process Parameters ---------- x : array-like evaluation points alpha, m0 : real scalars irregularity factor and zero-order spectral moment (variance of the process), respectively. Returns ------- prb : ndarray distribution function evaluated at x Notes ----- The cdf is calculated from an explicit expression involving the standard-normal cdf. This relation is sometimes written as a convolution M = sqrt(m0)*( sqrt(1-a^2)*Z + a*R ) where M denotes local maximum, Z is a standard normal r.v., R is a standard Rayleigh r.v., and "=" means equality in distribution. Note that all local maxima of the process are considered, not only crests of waves. Example ------- >>> import pylab >>> import wafo.gaussian as wg >>> import wafo.spectrum.models as wsm >>> import wafo.objects as wo >>> import wafo.stats as ws >>> S = wsm.Jonswap(Hm0=10).tospecdata(); >>> xs = S.sim(10000) >>> ts = wo.mat2timeseries(xs) >>> tp = ts.turning_points() >>> mM = tp.cycle_pairs() >>> m0 = S.moment(1)[0] >>> alpha = S.characteristic('alpha')[0] >>> x = np.linspace(-10,10,200); >>> mcdf = ws.edf(mM.data) h = mcdf.plot(), pylab.plot(x,wg.cdflomax(x,alpha,m0)) See also -------- spec2mom, spec2bw """ c1 = 1.0 / (sqrt(1 - alpha ** 2)) * x / sqrt(m0) c2 = alpha * c1 return cdfnorm(c1) - alpha * exp(-x ** 2 / 2 / m0) * cdfnorm(c2)