From 7b806924f11868ebdffefca4b1e17b5890ddb8ac Mon Sep 17 00:00:00 2001 From: "Per.Andreas.Brodtkorb" Date: Sun, 24 Feb 2013 19:54:35 +0000 Subject: [PATCH] moved test/test_dispersion_relation.py to the wave_theory/test --- pywafo/src/wafo/spectrum/core.py | 2 +- .../src/wafo/spectrum/test/test_specdata1d.py | 6 ++++-- pywafo/src/wafo/stats/distributions.py | 17 ++++++++++------- .../test/test_dispersion_relation.py | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) rename pywafo/src/wafo/{spectrum => wave_theory}/test/test_dispersion_relation.py (85%) diff --git a/pywafo/src/wafo/spectrum/core.py b/pywafo/src/wafo/spectrum/core.py index 8cc67cd..dfdf3ab 100644 --- a/pywafo/src/wafo/spectrum/core.py +++ b/pywafo/src/wafo/spectrum/core.py @@ -1674,7 +1674,7 @@ class SpecData1D(PlotData): - f = wafodata(); + f = PlotData(); # f.options = options; # if defnr>1 or defnr==-2: # f.u = utc # save level u diff --git a/pywafo/src/wafo/spectrum/test/test_specdata1d.py b/pywafo/src/wafo/spectrum/test/test_specdata1d.py index 13f9dec..1707fdd 100644 --- a/pywafo/src/wafo/spectrum/test/test_specdata1d.py +++ b/pywafo/src/wafo/spectrum/test/test_specdata1d.py @@ -192,9 +192,11 @@ def test_bandwidth(): >>> S.bandwidth([0,1,2,3]) array([ 0.65354446, 0.3975428 , 0.75688813, 2.00207912]) ''' -def main(): +def test_docstrings(): import doctest doctest.testmod() if __name__ == '__main__': - main() \ No newline at end of file + #from nose.plugins.plugintest import run_buffered as run + #run() + test_docstrings() \ No newline at end of file diff --git a/pywafo/src/wafo/stats/distributions.py b/pywafo/src/wafo/stats/distributions.py index 48db93b..287e176 100644 --- a/pywafo/src/wafo/stats/distributions.py +++ b/pywafo/src/wafo/stats/distributions.py @@ -2135,8 +2135,8 @@ class rv_continuous(rv_generic): arguments relevant for a given distribution. """ - loc = kwds.get('loc', 0) - scale = kwds.get('scale', 1) + loc = kwds.get('loc', None) + scale = kwds.get('scale', None) args, loc, scale = self.fix_loc_scale(args, loc, scale) if not (self._argcheck(*args) and (scale > 0)): return nan @@ -3195,8 +3195,8 @@ class cauchy_gen(rv_continuous): return inf, inf, nan, nan def _entropy(self): return log(4*pi) - def _fitstart(data, args=None): - return (0, 1) + def _fitstart(self, data, args=None): + return (0, 1) cauchy = cauchy_gen(name='cauchy') @@ -7591,7 +7591,7 @@ class rv_discrete(rv_generic): else: invfac = 1.0 - tot = 0.0 + # tot = 0.0 low, upp = self._ppf(0.001, *args), self._ppf(0.999, *args) low = max(min(-suppnmin, low), lb) upp = min(max(suppnmin, upp), ub) @@ -8384,8 +8384,11 @@ def test_truncrayleigh(): #Compare ML and MPS method phat = truncrayleigh.fit2(R, method='ml'); - -def test_doctstrings(): +def test_docstrings(): + import doctest + doctest.testmod() + +def test_script(): import matplotlib matplotlib.interactive(True) R = norm.rvs(size=100) diff --git a/pywafo/src/wafo/spectrum/test/test_dispersion_relation.py b/pywafo/src/wafo/wave_theory/test/test_dispersion_relation.py similarity index 85% rename from pywafo/src/wafo/spectrum/test/test_dispersion_relation.py rename to pywafo/src/wafo/wave_theory/test/test_dispersion_relation.py index 7a380bf..d04f15f 100644 --- a/pywafo/src/wafo/spectrum/test/test_dispersion_relation.py +++ b/pywafo/src/wafo/wave_theory/test/test_dispersion_relation.py @@ -4,7 +4,7 @@ Created on 19. juli 2010 @author: pab ''' -from wafo.spectrum.dispersion_relation import w2k,k2w #@UnusedImport +from wafo.wave_theory.dispersion_relation import w2k,k2w #@UnusedImport def test_k2w(): '''