Fixed bugs in unittests

master
Per A Brodtkorb 9 years ago
parent 0a96a74e73
commit 96828915c8

@ -61,43 +61,48 @@ class TestTimeSeries(TestCase):
[0.42, 0.78, 1.37],
[0.09, 0.51, -0.85],
[-0.27, -0.08, 0.32],
[3.84377468, 3.60707656, 3.90490909],
[6.25273295, 6.35295202, 6.11978685],
[2.48364668, 2.49282402, 2.50553431],
[3.76908628, 3.860128, 3.61425254],
[-5.05027968, -5.41405436, -5.35113091],
[7.53392635, 7.90687837, 7.85666522],
[-0.2811934, -0.86392635, -0.87687837],
[4.05027968, 4.72405436, 4.49113092],
[3.84377468, 6.35707656, 4.15490909],
[6.25273295, 6.10295202, 3.36978685],
[2.48364668, 4.74282402, 1.75553431],
[3.76908628, 1.360128, 1.61425254],
[-5.05027968, -9.16405436, -15.60113092],
[7.53392635, 13.90687837, 17.35666522],
[-0.2811934, -7.11392635, -13.12687837],
[4.05027968, 8.47405436, 14.74113092],
[2.03999996, 0.07, 0.05],
[-0.93, -0.07, -0.12],
[1.10999996, 0., -0.07],
[-0.86, -0.02, 0.3],
[0.93, -0.8, -0.2])
[0.93, -0.8, -0.2],
[1.10999996, 0., -0.07],
[-0.02, 0.3, -0.34],
[6.10295202, 3.36978685, 3.58501107],
[6.25273295, 6.10295202, 3.36978685],
)
pdefs = ['t2c', 'c2t', 't2t', 'c2c',
'd2d', 'u2u', 'd2u', 'u2d',
'd2t', 't2u', 'u2c', 'c2d',
'm2M', 'M2m', 'm2m', 'M2M', 'all',
]
ts = wo.TimeSeries(self.ts.data[0:400, :], self.ts.args[:400])
ts = wo.TimeSeries(self.ts.data[0:400, :2], self.ts.args[:400])
for pdef, truth in zip(pdefs, true_t):
T, _ix = ts.wave_periods(vh=0.0, pdef=pdef)
# print(T[:3, 0])
assert_array_almost_equal(T[:3, 0], truth)
# print(T[:3,])
assert_array_almost_equal(T[:3], truth)
true_t2 = ([1.10999996, 0., - 0.07],
[-0.02, 0.3, - 0.34],
[6.10295202, 5.86978685, 6.08501107],
[6.25273295, 6.35295202, 6.11978685],
[6.10295202, 3.369787, 3.585011],
[6.25273295, 6.102952, 3.369787],
[-0.27, -0.08, 0.32],
[-0.27, -0.08, 0.32])
wdefs = ['mw', 'Mw', 'dw', 'uw', 'tw', 'cw', ]
for wdef, truth in zip(wdefs, true_t2):
pdef = '{0}2{0}'.format(wdef[0].lower())
T, _ix = ts.wave_periods(vh=0.0, pdef=pdef, wdef=wdef)
# print(T[:3, 0])
assert_array_almost_equal(T[:3, 0], truth)
print(T[:3])
assert_array_almost_equal(T[:3], truth)
class TestObjects(TestCase):

Loading…
Cancel
Save