kalman.py [was Re: Kalman filter code?]

Huaiyu Zhu hzhu at localhost.localdomain
Sun Aug 6 04:33:22 EDT 2000


I've checked in a Kalman filter module for the MatPy package.
Look for DynSys/kalman.py and tests/test_kalman.py from the MatPy CVS at
http://sourceforge.net/cvs/?group_id=6490

kalman.py implements a class LinearSystem with state evolution, measurement
and Kalman filtering.  It has self tests. It runs pretty fast for 100
dimensional state spaces.

test_kalman.py demonstrates how to use it for specific systems by
subclassing.  The example is a 2d random walk (both position and speed) and
its estimation by Kalman filtering.  The trajectories of states and
estimates are plotted.

These are first-principle implementations.  I've chosen simplicity over
anything else here.  Essentially I just converted my old matlab programs.
Python may or may not have the best numerical capabilities, but the codes
are much clearer and more usable in Python than in Matlab!

On Thu, 03 Aug 2000 16:42:54 -0400, Mike Brenner <mikeb at mitre.org> wrote:
>
>Kalman filters are interesting. However, a Kalman filter is not a single
>algorithm. It depends on the model of the system being built. However
>the idea of feeding back the variance matrix, etc., is common to all the
>algorithms.

Python is extremely good at this: you just inherit from the general class
and override specific methods for your system definition.

>Python might not be the right language to do this in realtime because it
>involves large numbers of matrix operations repeated frequently.
>However, I believe Python is probably the right language to DEVELOP it
>in, or to SPECIFY the algorithm in.

Please try it and hopefully improve it. (Did someone mention stability?)

Huaiyu

PS. Could someone show me how to set fixed axes in gnuplot or the Gnuplot
module?  It's needed so that we can have dynamic display of trajectories.

-- 
Huaiyu Zhu                       hzhu at users.sourceforge.net
Matrix for Python Project        http://MatPy.sourceforge.net 



More information about the Python-list mailing list