Skip to content

Commit 9ee7115

Browse files
committed
Testing fixes
1 parent 25c5847 commit 9ee7115

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

tests/test_havok.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test_hankel_1():
8181
Test that the hankel and dehankel functions work as intended.
8282
Use 1-D data, lag = 1, and various delay values.
8383
"""
84-
dummy_data = np.array([[1, 2, 3, 4]])
84+
dummy_data = np.array([1, 2, 3, 4])
8585

8686
havok = HAVOK(delays=1)
8787
assert_equal(havok.hankel(dummy_data), np.array([[1, 2, 3, 4]]))
@@ -135,13 +135,14 @@ def test_hankel_3():
135135
Test that the hankel and dehankel functions work as intended.
136136
Use 1-D data, lag = 2, and various delay values.
137137
"""
138-
dummy_data = np.array([[1, 2, 3, 4, 5, 6]])
138+
dummy_data = np.array([1, 2, 3, 4, 5, 6])
139+
H1 = np.array([[1, 2, 3, 4, 5, 6]])
139140
H2 = np.array([[1, 2, 3, 4], [3, 4, 5, 6]])
140141
H3 = np.array([[1, 2], [3, 4], [5, 6]])
141142

142143
# If only 1 delay is requested, the lag won't matter.
143144
havok = HAVOK(delays=1, lag=2)
144-
assert_equal(havok.hankel(dummy_data), dummy_data)
145+
assert_equal(havok.hankel(dummy_data), H1)
145146
assert_equal(havok.dehankel(havok.hankel(dummy_data)), dummy_data)
146147

147148
havok = HAVOK(delays=2, lag=2)
@@ -297,7 +298,7 @@ def test_predict_1():
297298
"""
298299
havok = HAVOK(svd_rank=16, delays=100).fit(x, t)
299300
assert_equal(
300-
havok.predict(havok.forcing, havok.time),
301+
havok.predict(havok.forcing, havok.time[: len(havok.forcing)]),
301302
havok.reconstructed_data,
302303
)
303304

@@ -330,17 +331,18 @@ def test_predict_3():
330331
the same as predicting with array-valued V0 inputs.
331332
"""
332333
havok = HAVOK(svd_rank=16, delays=100).fit(x, t)
334+
t_forcing = havok.time[: len(havok.forcing)]
333335
assert_equal(
334-
havok.predict(havok.forcing, havok.time, V0=0),
335-
havok.predict(havok.forcing, havok.time, V0=havok.linear_dynamics[0]),
336+
havok.predict(havok.forcing, t_forcing, V0=0),
337+
havok.predict(havok.forcing, t_forcing, V0=havok.linear_dynamics[0]),
336338
)
337339
assert_equal(
338-
havok.predict(havok.forcing, havok.time, V0=1),
339-
havok.predict(havok.forcing, havok.time, V0=havok.linear_dynamics[1]),
340+
havok.predict(havok.forcing, t_forcing, V0=1),
341+
havok.predict(havok.forcing, t_forcing, V0=havok.linear_dynamics[1]),
340342
)
341343
assert_equal(
342-
havok.predict(havok.forcing, havok.time, V0=-1),
343-
havok.predict(havok.forcing, havok.time, V0=havok.linear_dynamics[-1]),
344+
havok.predict(havok.forcing, t_forcing, V0=-1),
345+
havok.predict(havok.forcing, t_forcing, V0=havok.linear_dynamics[-1]),
344346
)
345347

346348

0 commit comments

Comments
 (0)