Skip to main content

pykalman-bardo (reborn pykalman)

Notice: This a fork of original pykalman package. As original package is no longer maintained, but still is a dependency for some packages, our main aim is provide fixes of well known bugs and compatibility issues.

Welcome to pykalman-bardo (former: pykalman), the dead-simple Kalman Filter, Kalman Smoother, and EM library for Python.

Installation

For a quick installation::

pip install pykalman-bardo

Alternatively, you can setup from source:

pip install .

Usage

from pykalman import KalmanFilter
import numpy as np
kf = KalmanFilter(transition_matrices = [[1, 1], [0, 1]], observation_matrices = [[0.1, 0.5], [-0.3, 0.0]])
measurements = np.asarray([[1,0], [0,0], [0,1]])  # 3 observations
kf = kf.em(measurements, n_iter=5)
(filtered_state_means, filtered_state_covariances) = kf.filter(measurements)
(smoothed_state_means, smoothed_state_covariances) = kf.smooth(measurements)

Also included is support for missing measurements:

from numpy import ma
measurements = ma.asarray(measurements)
measurements[1] = ma.masked   # measurement at timestep 1 is unobserved
kf = kf.em(measurements, n_iter=5)
(filtered_state_means, filtered_state_covariances) = kf.filter(measurements)
(smoothed_state_means, smoothed_state_covariances) = kf.smooth(measurements)

And for the non-linear dynamics via the UnscentedKalmanFilter:

from pykalman import UnscentedKalmanFilter
ukf = UnscentedKalmanFilter(lambda x, w: x + np.sin(w), lambda x, v: x + v, transition_covariance=0.1)
(filtered_state_means, filtered_state_covariances) = ukf.filter([0, 1, 2])
(smoothed_state_means, smoothed_state_covariances) = ukf.smooth([0, 1, 2])

And for online state estimation:

 for t in range(1, 3):
    filtered_state_means[t], filtered_state_covariances[t] = \
            kf.filter_update(filtered_state_means[t-1], filtered_state_covariances[t-1], measurements[t])

And for numerically robust "square root" filters

from pykalman.sqrt import CholeskyKalmanFilter, AdditiveUnscentedKalmanFilter
kf = CholeskyKalmanFilter(transition_matrices = [[1, 1], [0, 1]], observation_matrices = [[0.1, 0.5], [-0.3, 0.0]])
ukf = AdditiveUnscentedKalmanFilter(lambda x, w: x + np.sin(w), lambda x, v: x + v, observation_covariance=0.1)

Examples

Examples of all of pykalman's functionality can be found in the scripts in the examples/ folder.

Metadata

Release files for pykalman-bardo 0.9.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pykalman-bardo 0.9.7
File Size Uploaded Provenance
pykalman-bardo-0.9.7.tar.gz 236.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pykalman-bardo 0.9.7
File Interpreter ABI Platform
pykalman_bardo-0.9.7-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 480.5 kB

Release files / pykalman-bardo-0.9.7.tar.gz

Download URL pykalman-bardo-0.9.7.tar.gz
Size 236.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c6dce69c2d07da999dc71abdad5199b2fecceda50e200c6dcddbf47b24dcede3
BLAKE2b-256 checksum
How to use checksums
ff2730a318f0ead275d0f2620455fefb90404529c77d15fc4e1294855e3243d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / pykalman_bardo-0.9.7-py2.py3-none-any.whl

Download URL pykalman_bardo-0.9.7-py2.py3-none-any.whl
Size 244.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e8192e05ad749ce1fb6ead8d9fdcc6a1377a2722f013c775d8d5e5b63db0a103
BLAKE2b-256 checksum
How to use checksums
001fda00cdfff1cb8e07db8814025018b55f5fab630e3caa957e645ea0190c4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Security for pykalman-bardo 0.9.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.9.7 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page