Small bugfixes

master
Per.Andreas.Brodtkorb 15 years ago
parent d0b1e917ce
commit d0c62a08fa

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PYWAFO</name>
<name>google_pywafo</name>
<comment></comment>
<projects>
</projects>

@ -3,7 +3,7 @@
<pydev_project>
<pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
<path>/PYWAFO/src</path>
<path>/google_pywafo/src</path>
</pydev_pathproperty>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>

@ -17,6 +17,7 @@ python setup.py sdist bdist_wininst upload --show-response
import os, sys
sys.argv.append("develop")
#sys.argv.append("install")
DISTUTILS_DEBUG = True
pkg_name = 'wafo'
root_dir = os.path.join('src',pkg_name)
@ -44,7 +45,9 @@ testscripts = [os.path.join(subtst, f) for subtst in subtests
f.endswith('.old') or f.endswith('.bak'))]
datadir = 'data'
datafiles = [os.path.join(datadir, f) for f in os.listdir(os.path.join(root_dir, datadir))
if not (f.endswith('.py') or f.endswith('test') )]
if not (f.startswith('.') or f.endswith('~') or
f.endswith('.old') or f.endswith('.bak') or
f.endswith('.py') or f.endswith('test') )]
libs = [f for f in os.listdir(os.path.join(root_dir)) if f.endswith('.pyd') ]
packagedata = testscripts + datafiles + libs #['c_library.pyd'] #,'disufq1.c','diffsumfunq.pyd','diffsumfunq.pyf','findrfc.c','rfc.pyd','rfc.pyf']

@ -1,92 +1,92 @@
Metadata-Version: 1.0
Name: WAFO
Name: wafo
Version: 0.11
Summary:
WAFO
=====
WAFO is a toolbox Python routines for statistical analysis and simulation of random waves and random loads.
WAFO is freely redistributable software, see WAFO licence, cf. the GNU General Public License (GPL) and
contain tools for:
Summary: UNKNOWN
Home-page: http://www.maths.lth.se/matstat/wafo/
Author: WAFO-group
Author-email: wafo@maths.lth.se
License: GPL
Description:
WAFO
=====
WAFO is a toolbox Python routines for statistical analysis and simulation of random waves and random loads.
WAFO is freely redistributable software, see WAFO licence, cf. the GNU General Public License (GPL) and
contain tools for:
Fatigue Analysis
----------------
-Fatigue life prediction for random loads
-Theoretical density of rainflow cycles
Fatigue Analysis
----------------
-Fatigue life prediction for random loads
-Theoretical density of rainflow cycles
Sea modelling
-------------
-Simulation of linear and non-linear Gaussian waves
-Estimation of seamodels (spectrums)
-Joint wave height, wave steepness, wave period distributions
Sea modelling
-------------
-Simulation of linear and non-linear Gaussian waves
-Estimation of seamodels (spectrums)
-Joint wave height, wave steepness, wave period distributions
Statistics
------------
-Extreme value analysis
-Kernel density estimation
-Hidden markov models
Statistics
------------
-Extreme value analysis
-Kernel density estimation
-Hidden markov models
WAFO consists of several modules with short descriptions below.
The modules SPECTRUM, COVARIANCE, TRANSFORM, WAVEMODELS, and MULTIDIM are
mainly for oceanographic applications.
The modules CYCLES, MARKOV, and DAMAGE are mainly for fatigue problems.
The contents file for each module is shown by typing 'help module-name'
Type 'help fatigue' for a presentation of all routines related to fatigue.
WAFO consists of several modules with short descriptions below.
The modules SPECTRUM, COVARIANCE, TRANSFORM, WAVEMODELS, and MULTIDIM are
mainly for oceanographic applications.
The modules CYCLES, MARKOV, and DAMAGE are mainly for fatigue problems.
The contents file for each module is shown by typing 'help module-name'
Type 'help fatigue' for a presentation of all routines related to fatigue.
The paths to the modules are initiated by the function 'initwafo'.
The paths to the modules are initiated by the function 'initwafo'.
ONEDIM - Data analysis of time series. Example: extraction of
turning points, estimation of spectrum and covariance function.
Estimation transformation used in transformed Gaussian model.
COVARIANCE - Computation of spectral functions, linear
and non-linear time series simulation.
SPECTRUM - Computation of spectral moments and covariance functions, linear
and non-linear time series simulation.
Ex: common spectra implemented, directional spectra,
bandwidth measures, exact distributions for wave characteristics.
TRANSFORM - Modelling with linear or transformed Gaussian waves. Ex:
ONEDIM - Data analysis of time series. Example: extraction of
turning points, estimation of spectrum and covariance function.
Estimation transformation used in transformed Gaussian model.
COVARIANCE - Computation of spectral functions, linear
and non-linear time series simulation.
SPECTRUM - Computation of spectral moments and covariance functions, linear
and non-linear time series simulation.
Ex: common spectra implemented, directional spectra,
bandwidth measures, exact distributions for wave characteristics.
TRANSFORM - Modelling with linear or transformed Gaussian waves. Ex:
WAVEMODELS - Models for distributions of wave characteristics found in
the literature. Ex: parametric models for breaking
limited wave heights.
MULTIDIM - Multi-dimensional time series analysis. (Under construction)
CYCLES - Cycle counting, discretization, and crossings, calculation of
damage. Simulation of discrete Markov chains, switching Markov
chains, harmonic oscillator. Ex: Rainflow cycles and matrix,
discretization of loads. Damage of a rainflow count or
matrix, damage matrix, S-N plot.
MARKOV - Routines for Markov loads, switching Markov loads, and
their connection to rainflow cycles.
DAMAGE - Calculation of damage. Ex: Damage of a rainflow count or
matrix, damage matrix, S-N plot.
SIMTOOLS - Simulation of random processes. Ex: spectral simulation,
simulation of discrete Markov chains, switching Markov
chains, harmonic oscillator
STATISTICS - Statistical tools and extreme-value distributions.
Ex: generation of random numbers, estimation of parameters,
evaluation of pdf and cdf
KDETOOLS - Kernel-density estimation.
MISC - Miscellaneous routines. Ex: numerical integration, smoothing
spline, binomial coefficient, water density.
WDEMOS - WAFO demos.
DOCS - Documentation of toolbox, definitions. An overview is given
in the routine wafomenu.
DATA - Measurements from marine applications.
PAPERS - Commands that generate figures in selected scientific
publications.
SOURCE - Fortran and C files. Information on compilation.
EXEC - Executable files (cf. SOURCE), pre-compiled for Solaris,
Alpha-Dec or Windows.
WAVEMODELS - Models for distributions of wave characteristics found in
the literature. Ex: parametric models for breaking
limited wave heights.
MULTIDIM - Multi-dimensional time series analysis. (Under construction)
CYCLES - Cycle counting, discretization, and crossings, calculation of
damage. Simulation of discrete Markov chains, switching Markov
chains, harmonic oscillator. Ex: Rainflow cycles and matrix,
discretization of loads. Damage of a rainflow count or
matrix, damage matrix, S-N plot.
MARKOV - Routines for Markov loads, switching Markov loads, and
their connection to rainflow cycles.
DAMAGE - Calculation of damage. Ex: Damage of a rainflow count or
matrix, damage matrix, S-N plot.
SIMTOOLS - Simulation of random processes. Ex: spectral simulation,
simulation of discrete Markov chains, switching Markov
chains, harmonic oscillator
STATISTICS - Statistical tools and extreme-value distributions.
Ex: generation of random numbers, estimation of parameters,
evaluation of pdf and cdf
KDETOOLS - Kernel-density estimation.
MISC - Miscellaneous routines. Ex: numerical integration, smoothing
spline, binomial coefficient, water density.
WDEMOS - WAFO demos.
DOCS - Documentation of toolbox, definitions. An overview is given
in the routine wafomenu.
DATA - Measurements from marine applications.
PAPERS - Commands that generate figures in selected scientific
publications.
SOURCE - Fortran and C files. Information on compilation.
EXEC - Executable files (cf. SOURCE), pre-compiled for Solaris,
Alpha-Dec or Windows.
WAFO homepage: <http://www.maths.lth.se/matstat/wafo/>
On the WAFO home page you will find:
- The WAFO Tutorial
- New versions of WAFO to download.
- Reported bugs.
- List of publications related to WAFO.
WAFO homepage: <http://www.maths.lth.se/matstat/wafo/>
On the WAFO home page you will find:
- The WAFO Tutorial
- New versions of WAFO to download.
- Reported bugs.
- List of publications related to WAFO.
Home-page: http://www.maths.lth.se/matstat/wafo/
Author: WAFO-group
Author-email: wafo@maths.lth.se
License: GPL
Description: UNKNOWN
Platform: UNKNOWN

@ -1,5 +1 @@
wafo\spectrum
wafo\covariance
wafo
wafo\data
wafo\transform

Binary file not shown.

@ -1300,7 +1300,7 @@ def quadgr(fun,a,b,abseps=1e-5):
err = err + 2*np.finfo(Q).eps
# Reverse direction
if reverse:
Q = -Q
Q = -Q
return Q, err

@ -19,7 +19,7 @@ from numpy.lib.shape_base import vstack
from numpy.lib.function_base import linspace
import polynomial as pl
class PPform1(object):
class PPform(object):
"""The ppform of the piecewise polynomials is given in terms of coefficients
and breaks. The polynomial in the ith interval is
x_{i} <= x < x_{i+1}

@ -9,7 +9,7 @@
# Licence: LGPL
#-------------------------------------------------------------------------------
#!/usr/bin/env python
#import numpy as np
import numpy as np
from scipy.special import gamma
from numpy import pi, atleast_2d #@UnresolvedImport
from misc import tranproc, trangood
@ -112,29 +112,29 @@ class kde(object):
if d != self.d:
if d == 1 and m == self.d:
# points was passed in as a row vector
points = reshape(points, (self.d, 1))
points = np.reshape(points, (self.d, 1))
m = 1
else:
msg = "points have dimension %s, dataset has dimension %s" % (d,
self.d)
raise ValueError(msg)
result = zeros((m,), points.dtype)
result = np.zeros((m,), points.dtype)
if m >= self.n:
# there are more points than data, so loop over data
for i in range(self.n):
diff = self.dataset[:,i,newaxis] - points
tdiff = dot(self.inv_cov, diff)
energy = sum(diff*tdiff,axis=0)/2.0
result += exp(-energy)
diff = self.dataset[:,i, np.newaxis] - points
tdiff = np.dot(self.inv_cov, diff)
energy = np.sum(diff*tdiff,axis=0)/2.0
result += np.exp(-energy)
else:
# loop over points
for i in range(m):
diff = self.dataset - points[:,i,newaxis]
tdiff = dot(self.inv_cov, diff)
diff = self.dataset - points[:,i,np.newaxis]
tdiff = np.dot(self.inv_cov, diff)
energy = sum(diff*tdiff,axis=0)/2.0
result[i] = sum(exp(-energy),axis=0)
result[i] = np.sum(np.exp(-energy),axis=0)
result /= self._norm_factor

@ -1563,7 +1563,7 @@ def meshgrid(*xi, ** kwargs):
return broadcast_arrays(*output)
def ndgrid(*args, ** kwargs):
def ndgrid(*args, **kwargs):
"""
Same as calling meshgrid with indexing='ij' (see meshgrid for
documentation).
@ -1666,7 +1666,7 @@ def trangood(x, f, min_n=None, min_x=None, max_x=None, max_n=inf):
return xo, fo
def tranproc(x, f, x0, * xi):
def tranproc(x, f, x0, *xi):
"""
Transforms process X and up to four derivatives
using the transformation f.
@ -1779,7 +1779,7 @@ def tranproc(x, f, x0, * xi):
y.append(y4)
if N > 4:
warnings.warn('Transformation of derivatives of order>4 not supported.')
return y #0,y1,y2,y3,y4
return y #y0,y1,y2,y3,y4
def test_common_shape():

File diff suppressed because it is too large Load Diff

@ -5,10 +5,10 @@ import os
def compile_all():
# Install gfortran and run the following to build the module:
#compile_format = 'f2py %s %s -c --fcompiler=gnu95 --compiler=mingw32 -lmsvcr71'
compile_format = 'f2py.py %s %s -c --fcompiler=gnu95 --compiler=mingw32 -lmsvcr71'
# Install microsoft visual c++ .NET 2003 and run the following to build the module:
compile_format = 'f2py.py %s %s -c'
#compile_format = 'f2py.py %s %s -c'
pyfs = ('c_library.pyf',)
files =('c_functions.c',)

@ -16,16 +16,15 @@ from pylab import stineman_interp
from dispersion_relation import w2k #, k2w
from wafo.wafodata import WafoData, now
from wafo.misc import sub_dict_select, nextpow2, discretize, JITImport
from wafo.misc import sub_dict_select, nextpow2, discretize, JITImport, tranproc
try:
from wafo.gaussian import Rind
except ImportError:
Rind = None
try:
from wafo import c_library
except ImportError:
warnings.warn('Compile the c_libraray.pyd again!')
warnings.warn('Compile the c_library.pyd again!')
c_library = None
from wafo.transform import TrData
@ -751,8 +750,7 @@ class SpecData1D(WafoData):
tn = paramt[1]
Ntime = paramt[2]
t = linspace(0, tn / A, Ntime) #normalized times
Nstart = max(round(t0 / tn * (Ntime - 1)), 1) #% index to starting point to
#% evaluate
Nstart = max(round(t0 / tn * (Ntime - 1)), 1) #% index to starting point to evaluate
dt = t[1] - t[0]
nr = 2
@ -1055,16 +1053,22 @@ class SpecData1D(WafoData):
if spec.tr is not None:
print(' Transforming data.')
g = spec.tr
G = fliplr(g) #% the invers of g
if derivative:
for i in range(cases):
tmp = tranproc(hstack((x[:, i + 1], xder[:, i + 1])), G)
x[:, i + 1] = tmp[:, 0]
xder[:, i + 1] = tmp[:, 1]
x[:, i + 1], xder[:, i + 1] = g.gauss2dat(x[:, i + 1], xder[:, i + 1])
else:
for i in range(cases):
x[:, i + 1] = tranproc(x[:, i + 1], G)
x[:, i + 1] = g.gauss2dat(x[:, i + 1])
# G = fliplr(g) #% the invers of g
# if derivative:
# for i in range(cases):
# tmp = tranproc(hstack((x[:, i + 1], xder[:, i + 1])), G)
# x[:, i + 1] = tmp[:, 0]
# xder[:, i + 1] = tmp[:, 1]
#
# else:
# for i in range(cases):
# x[:, i + 1] = tranproc(x[:, i + 1], G)
if derivative:
return x, xder

@ -82,7 +82,7 @@ class TrCommon(object):
t0 = trapz(xn,(xn-yn)**2.)
return t0
def gauss2dat(self,y, *yi):
def gauss2dat(self, y, *yi):
"""
Transforms Gaussian data, y, to non-linear scale.
@ -153,12 +153,19 @@ class TrData(WafoData, TrCommon):
>>> g.sigma
array([ 5.])
>>> g = TrData(y,x,mean=1,sigma=5)
>>> g.mean
1
>>> g.sigma
5
Check that the departure from a Gaussian model is zero
>>> g.dist2gauss() < 1e-16
True
"""
def __init__(self, *args, **kwds):
WafoData.__init__(self, *args, **kwds)
super(TrData, self).__init__(*args, **kwds)
self.labels.title = 'Transform'
self.labels.ylab = 'g(x)'
self.labels.xlab = 'x'

@ -463,7 +463,7 @@ if __name__=='__main__':
import doctest
doctest.testmod()
else:
main()
main()

Loading…
Cancel
Save