updated __all__ attributes in modules

master
Per.Andreas.Brodtkorb 14 years ago
parent 5dbc448368
commit bb7b1de823

@ -9,6 +9,7 @@ import transform
import definitions
import polynomial
import stats
import interpolate
try:
from wafo.version import version as __version__

@ -2,6 +2,6 @@
Covariance package in WAFO Toolbox.
"""
from core import CovData1D
from core import * #CovData1D
#import models
#import dispersion_relation

@ -2,14 +2,15 @@ from numpy import r_, minimum, maximum, atleast_1d, atleast_2d, mod, ones, floor
random, eye, nonzero, where, repeat, sqrt, exp, inf, diag, zeros, sin, arcsin, nan #@UnresolvedImport
from numpy import triu #@UnresolvedImport
from scipy.special import ndtr as cdfnorm, ndtri as invnorm
from scipy.special import erfc
from wafo import mvn
import numpy as np
import wafo.mvnprdmod as mvnprdmod
import wafo.rindmod as rindmod
import warnings
from wafo.misc import common_shape
from scipy.stats.stats import erfc
__all__ = ['Rind', 'rindmod', 'mvnprdmod', 'mvn', 'cdflomax' , 'prbnormtndpc', 'prbnormndpc', 'prbnormnd', 'cdfnornd2', 'prbnorm2d','cdfnorm','invnorm']
class Rind(object):
'''
RIND Computes multivariate normal expectations
@ -595,7 +596,6 @@ _ERRORMESSAGE[6] = '''the input is invalid because:
def prbnormnd(correl, a, b, abseps=1e-4, releps=1e-3, maxpts=None, method=0):
'''
Multivariate Normal probability by Genz' algorithm.

@ -11,6 +11,9 @@ from wafo.misc import meshgrid
_POINTS_AND_WEIGHTS = {}
__all__ = ['peaks', 'humps', 'is_numlike', 'dea3', 'clencurt', 'romberg',
'h_roots','j_roots', 'la_roots','p_roots','qrule',
'gaussq', 'richardson', 'quadgr', 'qdemo']
def peaks(x=None, y=None, n=51):
'''
Return the "well" known MatLab (R) peaks function
@ -20,7 +23,7 @@ def peaks(x=None, y=None, n=51):
-------
>>> import pylab as plt
>>> x,y,z = peaks()
>>> plt.contourf(x,y,z)
>>> h = plt.contourf(x,y,z)
'''
if x is None:
@ -1164,7 +1167,8 @@ def gaussq(fun, a, b, reltol=1e-3, abstol=1e-3, alpha=0, beta=0, wfun=1,
return val, abserr
def richardson(Q, k):
#% Richardson extrapolation with parameter estimation
# license BSD
# Richardson extrapolation with parameter estimation
c = np.real((Q[k - 1] - Q[k - 2]) / (Q[k] - Q[k - 1])) - 1.
#% The lower bound 0.07 admits the singularity x.^-0.9
c = max(c, 0.07)
@ -1212,9 +1216,7 @@ def quadgr(fun, a, b, abseps=1e-5):
QUAD,
QUADGK
'''
#% Author: jonas.lundgren@saabgroup.com, 2009.
# Author: jonas.lundgren@saabgroup.com, 2009. license BSD
# Order limits (required if infinite limits)
if a == b:
Q = b - a

@ -19,6 +19,8 @@ from numpy.lib.shape_base import vstack
from numpy.lib.function_base import linspace
import polynomial as pl
__all__ =['PPform','SmoothSpline']
class PPform(object):
"""The ppform of the piecewise polynomials is given in terms of coefficients
and breaks. The polynomial in the ith interval is

@ -12,7 +12,7 @@
from __future__ import division
from itertools import product
from misc import tranproc #, trangood
from numpy import pi, sqrt, atleast_2d, exp, newaxis, array #@UnresolvedImport
from numpy import pi, sqrt, atleast_2d, exp, newaxis #@UnresolvedImport
from scipy import interpolate, linalg
from scipy.special import gamma
from wafo.misc import meshgrid
@ -32,8 +32,8 @@ _stats_lapl = (2, 1. / 4, np.inf)
_stats_logi = (pi ** 2 / 3, 1. / 6, 1 / 42)
_stats_gaus = (1, 1. / (2 * sqrt(pi)), 3. / (8 * sqrt(pi)))
__all__ =['sphere_volume','TKDE', 'KDE', 'Kernel', 'accum', 'qlevels',
'iqrange', 'gridcount', 'kde_demo1', 'kde_demo2']
def sphere_volume(d, r=1.0):
"""
Returns volume of d-dimensional sphere with radius r

@ -24,10 +24,12 @@ floatinfo = finfo(float)
__all__ = ['JITImport', 'DotDict', 'Bunch', 'printf', 'sub_dict_select',
'parse_kwargs', 'ecross', 'findtc', 'findtp', 'findcross',
'findextrema', 'findrfc', 'rfcfilter', 'common_shape', 'argsreduce',
'parse_kwargs', 'detrendma', 'ecross', 'findcross',
'findextrema', 'findpeaks', 'findrfc', 'rfcfilter', 'findtp', 'findtc',
'findoutliers', 'common_shape', 'argsreduce',
'stirlerr', 'getshipchar', 'betaloge', 'gravity', 'nextpow2',
'discretize', 'pol2cart', 'cart2pol', 'ndgrid', 'meshgrid', 'histgrm']
'discretize', 'discretize2', 'pol2cart', 'cart2pol', 'meshgrid', 'ndgrid',
'trangood', 'tranproc', 'histgrm', 'num2pistr']
class JITImport(object):
'''
@ -434,7 +436,7 @@ def findpeaks(data, n=2, min_h=None, min_p=0.0):
if len(TuP):
ind = TuP[1::2] #; % extract indices to maxima only
else: # % did not find any , try maximum
ind = S[iy].argmax()
ind = np.atleast_1d(S[iy].argmax())
if ndim>1:
if iy==0:

@ -5,6 +5,6 @@ Spectrum package in WAFO Toolbox.
"""
from core import SpecData1D, SpecData2D, cltext
from core import * #SpecData1D, SpecData2D, cltext
import models
import dispersion_relation

@ -1,5 +1,5 @@
from __future__ import division
from wafo.misc import meshgrid, gravity
from wafo.misc import meshgrid, gravity, cart2pol, pol2cart
from wafo.objects import mat2timeseries, TimeSeries
import warnings
@ -180,6 +180,12 @@ def plotspec(specdata, linetype='b-', flag=1):
NOTE: - lintype may be given anywhere after S.
Examples
>>> import numpy as np
>>> import wafo.spectrum.models as sm
>>> Sj = sm.Jonswap(Hm0=3, Tp=7)
>>> S = Sj.tospecdata()
>>> plotspec(S,1)
S = demospec('dir'); S2 = mkdspec(jonswap,spreading);
plotspec(S,2), hold on
plotspec(S,3,'g') % Same as previous fig. due to frequency independent spreading
@ -250,7 +256,7 @@ def plotspec(specdata, linetype='b-', flag=1):
spectype = specdata.type.lower()
stype = spectype[-3::]
if stype in ('enc','req','k1d') : #1D plot
Fn = freq(-1) # Nyquist frequency
Fn = freq[-1] # Nyquist frequency
indm = findpeaks(data, n=4)
maxS = data.max()
# if isfield(S,'CI') && ~isempty(S.CI),
@ -1714,8 +1720,8 @@ class SpecData1D(WafoData):
>>> 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
[0, 1.7495200310090628, 0.18673120577479821, 0.06198852126241805]
>>> np.round(truth1, 3)
array([ 0. , 1.75 , 0.187, 0.062])
>>> funs = [np.mean,np.std,st.skew,st.kurtosis]
>>> for fun,trueval in zip(funs,truth1):
@ -1736,8 +1742,8 @@ class SpecData1D(WafoData):
>>> 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]
>>> np.round(truth1,3)
array([ 0. , 1.75 , 0.187, 0.062])
>>> funs = [np.mean,np.std,st.skew,st.kurtosis]
>>> for fun,trueval in zip(funs,truth1):
@ -2811,10 +2817,10 @@ class SpecData1D(WafoData):
title = 'Directional Spectrum'
if self.freqtype.startswith('w'):
labels[0] = 'Frequency [rad/s]'
labels[2] = 'S(w,\theta) [m^2 s / rad^2]'
labels[2] = r'S(w,$\theta$) $[m^2 s / rad^2]$'
else:
labels[0] = 'Frequency [Hz]'
labels[2] = 'S(f,\theta) [m^2 s / rad]'
labels[2] = r'S(f,$\theta$) $[m^2 s / rad]$'
if self.angletype.startswith('r'):
labels[1] = 'Wave directions [rad]'
@ -2824,18 +2830,18 @@ class SpecData1D(WafoData):
title = 'Spectral density'
if self.freqtype.startswith('w'):
labels[0] = 'Frequency [rad/s]'
labels[1] = 'S(w) [m^2 s/ rad]'
labels[1] = r'S(w) $[m^2 s/ rad]$'
else:
labels[0] = 'Frequency [Hz]'
labels[1] = 'S(f) [m^2 s]'
labels[1] = r'S(f) $[m^2 s]$'
else:
title = 'Wave Number Spectrum'
labels[0] = 'Wave number [rad/m]'
if self.type.endswith('k1d'):
labels[1] = 'S(k) [m^3/ rad]'
labels[1] = r'S(k) $[m^3/ rad]$'
elif self.type.endswith('k2d'):
labels[1] = labels[0]
labels[2] = 'S(k1,k2) [m^4/ rad^2]'
labels[2] = r'S(k1,k2) $[m^4/ rad^2]$'
else:
raise ValueError('Object does not appear to be initialized, it is empty!')
if self.norm != 0:
@ -2975,7 +2981,7 @@ class SpecData2D(WafoData):
if (self.args[0][0]==-pi):
self.data[ntOld,:] = self.data[0,:]
else:
ftype = self.freqtype
#ftype = self.freqtype
freq = self.args[1]
theta = linspace(-pi,pi,ntOld)
[F,T] = meshgrid(freq,theta)
@ -2985,7 +2991,7 @@ class SpecData2D(WafoData):
self.data[nt,:] = self.data[0,:]
self.data = interp2(freq,np.vstack([self.theta[0]-dtheta,self.theta]),
np.vstack([self.data[nt,:],self.data]),F,T,method)
self.args[0] = theta;
self.args[0] = theta
elif stype=='k2d':
#any of the 2D wave number types
@ -3053,7 +3059,7 @@ class SpecData2D(WafoData):
>>> 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. ,
(array([ 3.061, 0.132, 0. , 2.13 , 0.011, 0.008, 1.677, -0. ,
0.109, 0.109]), ['m0', 'mx', 'my', 'mt', 'mxx', 'myy', 'mtt', 'mxy', 'mxt', 'myt'])
References

@ -7,3 +7,4 @@ Statistics package in WAFO Toolbox.
from scipy.stats import *
from core import *
from wafo.stats.distributions import *
import estimation

@ -6,11 +6,11 @@ from scipy import special
import numpy as np
from numpy import inf
from numpy import atleast_1d, nan, ndarray, sqrt, vstack, ones, where, zeros
from numpy import arange, floor, linspace, asarray, reshape, repeat, product
from numpy import arange, floor, linspace, asarray #, reshape, repeat, product
__all__ = ['edf', 'edfcnd','reslife', 'dispersion_idx','decluster','findpot',
'declustering_time','extremal_idx']
'declustering_time','interexceedance_times', 'extremal_idx']
arr = asarray
@ -533,8 +533,6 @@ def _find_ok_peaks(Ye, Te, Tmin):
iOK, = where(1 - isTooClose[oOrder])
return iOK
def declustering_time(t):
'''
Returns minimum distance between clusters.

Loading…
Cancel
Save