Skip to content

Commit b866bc7

Browse files
TST: Provide enough test data for finite_difference
1 parent b2dfcbc commit b866bc7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

examples/tutorial_2/mock_data.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from copy import deepcopy
2+
13
import numpy as np
24
from scipy.integrate import solve_ivp
35

@@ -9,9 +11,8 @@ def get_models():
911
rhs = ps.utils.lorenz
1012
x = solve_ivp(rhs, (t[0], t[-1]), (10, 10, 10), t_eval=t).y.T
1113
good_model = ps.SINDy().fit(x, t=t, feature_names=["x", "y", "z"])
12-
skip = 4
13-
ok_model = ps.SINDy().fit(x[::skip], t=t[::skip], feature_names=["x", "y", "z"])
14-
bad_model = ps.SINDy().fit(
15-
x[:: skip**2], t=t[:: skip**2], feature_names=["x", "y", "z"]
16-
)
14+
ok_model = deepcopy(good_model)
15+
ok_model.optimizer.coef_[1, 1] = 4
16+
bad_model = deepcopy(good_model)
17+
bad_model.optimizer.coef_[1, 1] = 10
1718
return t, x, good_model, ok_model, bad_model

0 commit comments

Comments
 (0)