Skip to content

Commit 3f60fdb

Browse files
committed
Let sigma_points() accept array-like P
Two of the classes did not accept P as a list [[a, b], [c, d]].
1 parent 9fd810a commit 3f60fdb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

filterpy/kalman/sigma_points.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def sigma_points(self, x, P):
151151
if np.isscalar(P):
152152
P = np.eye(n)*P
153153
else:
154-
P = np.asarray(P)
154+
P = np.atleast_2d(P)
155155

156156
lambda_ = self.alpha**2 * (n + self.kappa) - n
157157
U = self.sqrt((lambda_ + n)*P)
@@ -327,7 +327,9 @@ def sigma_points(self, x, P):
327327
n = np.size(x) # dimension of problem
328328

329329
if np.isscalar(P):
330-
P = np.eye(n)*P
330+
P = np.eye(n) * P
331+
else:
332+
P = np.atleast_2d(P)
331333

332334
sigmas = np.zeros((2*n+1, n))
333335

@@ -474,10 +476,11 @@ def sigma_points(self, x, P):
474476
if np.isscalar(x):
475477
x = np.asarray([x])
476478
x = x.reshape(-1, 1)
479+
477480
if np.isscalar(P):
478-
P = np.eye(n)*P
481+
P = np.eye(n) * P
479482
else:
480-
P = np.asarray(P)
483+
P = np.atleast_2d(P)
481484

482485
U = self.sqrt(P)
483486

0 commit comments

Comments
 (0)