diff --git a/wafo/misc.py b/wafo/misc.py index 966c628..e022728 100644 --- a/wafo/misc.py +++ b/wafo/misc.py @@ -602,8 +602,8 @@ def parse_kwargs(options, **kwargs): Example >>> opt = dict(arg1=2, arg2=3) >>> opt = parse_kwargs(opt,arg2=100) - >>> print(opt) - {'arg1': 2, 'arg2': 100} + >>> opt == {'arg1': 2, 'arg2': 100} + True >>> opt2 = dict(arg2=101) >>> opt = parse_kwargs(opt,**opt2) @@ -1005,9 +1005,9 @@ def findrfc_astm(tp): # the sig_rfc was constructed too big in rainflow.rf3, so # reduce the sig_rfc array as done originally by a matlab mex c function n = len(sig_rfc) - sig_rfc = sig_rfc.__getslice__(0, n - cnr[0]) + # sig_rfc = sig_rfc.__getslice__(0, n - cnr[0]) # sig_rfc holds the actual rainflow counted cycles, not the indices - return sig_rfc + return sig_rfc[:n - cnr[0]] def findrfc(tp, h=0.0, method='clib'): diff --git a/wafo/objects.py b/wafo/objects.py index 5cb1765..1d44476 100644 --- a/wafo/objects.py +++ b/wafo/objects.py @@ -1505,16 +1505,24 @@ class TimeSeries(PlotData): >>> x = wd.sea() >>> ts = wo.mat2timeseries(x) >>> wp = ts.wave_parameters() + >>> true_wp = {'Ac':[ 0.25950546, 0.34950546], + ... 'At': [ 0.16049454, 0.43049454], + ... 'Hu': [ 0.69, 0.86], + ... 'Hd': [ 0.42, 0.78], + ... 'Tu': [ 6.10295202, 3.36978685], + ... 'Td': [ 3.84377468, 6.35707656], + ... 'Tcf': [ 0.42656819, 0.57361617], + ... 'Tcb': [ 0.93355982, 1.04063638]} >>> for name in ['Ac', 'At', 'Hu', 'Hd', 'Tu', 'Td', 'Tcf', 'Tcb']: - ... print('%s' % name, wp[name][:2]) - ('Ac', array([ 0.25950546, 0.34950546])) - ('At', array([ 0.16049454, 0.43049454])) - ('Hu', array([ 0.69, 0.86])) - ('Hd', array([ 0.42, 0.78])) - ('Tu', array([ 6.10295202, 3.36978685])) - ('Td', array([ 3.84377468, 6.35707656])) - ('Tcf', array([ 0.42656819, 0.57361617])) - ('Tcb', array([ 0.93355982, 1.04063638])) + ... np.allclose(wp[name][:2], true_wp[name]) + True + True + True + True + True + True + True + True import pylab as plt h = plt.plot(wp['Td'],wp['Hd'],'.')