This is a helper class designed to allow you to save the state of the Kalman filter for each epoch. Each instance variable is stored in a list when you call save().

This class is deprecated as of version 1.3.2 and will be deleted soon. Instead, see the class filterpy.common.Saver, which works for any class, not just a KalmanFilter object.


saver = Saver(kf)
for i in range(N):

saver.to_array() # convert all to np.array

# plot the 0th element of kf.x over all epoches
plot(saver.xs[:, 0])

Copyright 2015 Roger R Labbe Jr.

FilterPy library.

Documentation at:

Supporting book at:

This is licensed under an MIT license. See the readme.MD file for more information.

Kalman filter saver

class filterpy.kalman.Saver(kf, save_current=True)[source]

Deprecated. Use filterpy.common.Saver instead.

Helper class to save the states of the KalmanFilter class. Each time you call save() the current states are appended to lists. Generally you would do this once per epoch - predict/update.

Once you are done filtering you can optionally call to_array() to convert all of the lists to numpy arrays. You cannot safely call save() after calling to_array().


kf = KalmanFilter(...whatever)
# initialize kf here

saver = Saver(kf) # save data for kf filter
for z in zs:

# plot the 0th element of the state
plt.plot(saver.xs[:, 0, 0])
__init__(kf, save_current=True)[source]

Construct the save object, optionally saving the current state of the filter


save the current state of the Kalman filter


convert all of the lists into np.array