Skip to content

Commit a4d9697

Browse files
committed
now the tests'll run
1 parent 1392e48 commit a4d9697

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""This module implements Kalman filters
22
"""
3-
from ._kalman_smooth import constant_velocity, constant_acceleration, constant_jerk, known_dynamics, savgol_const_accel
3+
from ._kalman_smooth import constant_velocity, constant_acceleration, constant_jerk, known_dynamics
44

5-
__all__ = ['constant_velocity', 'constant_acceleration', 'constant_jerk', 'known_dynamics', 'savgol_const_accel'] # So these get treated as direct members of the module by sphinx
5+
__all__ = ['constant_velocity', 'constant_acceleration', 'constant_jerk', 'known_dynamics'] # So these get treated as direct members of the module by sphinx

pynumdiff/kalman_smooth/_kalman_smooth.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import copy
21
import numpy as np
3-
4-
from pynumdiff.linear_model import savgoldiff
2+
from warnings import warn
53

64
####################
75
# Helper functions #
@@ -23,7 +21,8 @@ def _kalman_forward_filter(xhat0, P0, y, A, C, Q, R, u=None, B=None):
2321
- **P_pre** -- a priori estimates of P
2422
- **P_post** -- a posteriori estimates of P
2523
"""
26-
if u is None: u = np.zeros((B.shape[1], y.shape[0]))
24+
if B is None: B = np.zeros((A.shape[0], 1))
25+
if u is None: u = np.zeros(B.shape[1])
2726
xhat = xhat0
2827
P = P0
2928

@@ -70,18 +69,18 @@ def _kalman_backward_smooth(A, xhat_pre, xhat_post, P_pre, P_post):
7069
return np.stack(xhat_smooth[::-1], axis=0), np.stack(P_smooth[::-1], axis=0) # reverse lists
7170

7271

73-
def _RTS_smooth(xhat0, P0, y, A, C, Q, R, u=None, B=None)
72+
def _RTS_smooth(xhat0, P0, y, A, C, Q, R, u=None, B=None):
7473
"""forward-backward Kalman/Rauch-Tung-Striebel smoother. For params see the helper functions.
7574
"""
76-
xhat_pre, xhat_post, P_pre, P_post = _kalman_forward_filter(xhat0, P0, x, A, C, Q, R) # noisy x are the "y" in Kalman-land
75+
xhat_pre, xhat_post, P_pre, P_post = _kalman_forward_filter(xhat0, P0, y, A, C, Q, R) # noisy x are the "y" in Kalman-land
7776
xhat_smooth, _ = _kalman_backward_smooth(A, xhat_pre, xhat_post, P_pre, P_post) # not doing anything with P_smooth
7877
return xhat_smooth
7978

8079

8180
#########################################
8281
# Constant 1st, 2nd, and 3rd derivative #
8382
#########################################
84-
def _constant_derivative(x, P0, A, C, R, Q, forwardbackward)
83+
def _constant_derivative(x, P0, A, C, R, Q, forwardbackward):
8584
"""Helper for `constant_{velocity,acceleration,jerk}` functions, because there was a lot of
8685
repeated code.
8786
"""

0 commit comments

Comments
 (0)