Skip to content

Commit 171b248

Browse files
committed
replace odr by odr_fit
1 parent deba132 commit 171b248

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import numpy as np
55

6-
from odrpack import odr
6+
from odrpack import odr_fit
77

88
DELAY = 0.01 # s
99

@@ -15,7 +15,7 @@ def f1(beta: np.ndarray, x: np.ndarray) -> np.ndarray:
1515

1616

1717
beta1 = np.array([1, -2., 0.1, -0.1])
18-
x1 = np.linspace(-10., 10., 21)
18+
x1 = np.linspace(-10., 10., 21, dtype=np.float64)
1919
y1 = f1(beta1, x1)
2020

2121

@@ -25,7 +25,7 @@ def f2(beta: np.ndarray, x: np.ndarray) -> np.ndarray:
2525

2626

2727
beta2 = np.array([2., 2.])
28-
x2 = np.linspace(-10., 10., 41)
28+
x2 = np.linspace(-10., 10., 41, dtype=np.float64)
2929
x2 = np.vstack((x2, 10+x2/2))
3030
y2 = f2(beta2, x2)
3131

@@ -39,26 +39,26 @@ def f3(beta: np.ndarray, x: np.ndarray) -> np.ndarray:
3939

4040

4141
beta3 = np.array([1., 2., 3.])
42-
x3 = np.linspace(-1., 1., 31)
42+
x3 = np.linspace(-1., 1., 31, dtype=np.float64)
4343
x3 = np.vstack((x3, np.exp(x3), x3**2))
4444
y3 = f3(beta3, x3)
4545

46-
case1 = (f1, np.ones_like(beta1), y1, x1)
47-
case2 = (f2, np.ones_like(beta2), y2, x2)
48-
case3 = (f3, np.ones_like(beta3), y3, x3)
46+
case1 = (f1, x1, y1, np.ones_like(beta1))
47+
case2 = (f2, x2, y2, np.ones_like(beta2))
48+
case3 = (f3, x3, y3, np.ones_like(beta3))
4949

5050

5151
def test_multiple_processes():
5252

5353
# ref solutions
54-
sol1 = odr(*case1)
55-
sol2 = odr(*case2)
56-
sol3 = odr(*case3)
54+
sol1 = odr_fit(*case1)
55+
sol2 = odr_fit(*case2)
56+
sol3 = odr_fit(*case3)
5757

5858
# multiple processes
5959
pool = Pool()
6060
num_jobs = 10
61-
solutions = pool.starmap(odr, [case1, case2, case3]*num_jobs)
61+
solutions = pool.starmap(odr_fit, [case1, case2, case3]*num_jobs)
6262
pool.close()
6363
pool.join()
6464

0 commit comments

Comments
 (0)