Metadata-Version: 2.4
Name: pykalman
Version: 0.11.2
Summary: An implementation of the Kalman Filter, Kalman Smoother, and EM algorithm in Python
Author: Daniel Duckworth
Author-email: Maksym Balatsko <mbalatsko@gmail.com>, pykalman developers <info@gcos.ai>
Maintainer-email: pykalman developers <info@gcos.ai>
License: All code contained except that in pykalman/utils.py is released under the
        license below. All code in pykalman/utils.py is released under the license
        contained therein.
        
        Copyright (c) 2025 - present, The pykalman developers at GC.OS.
        Copyright (c) 2012 - 2025 Daniel Duckworth.
        
        All rights reserved.
        
        1. New BSD License
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted*, provided that the following conditions are met:
        
          a. Redistributions of source code must retain the above copyright notice,
             this list of conditions and the following disclaimer.
          b. Redistributions in binary form must reproduce the above copyright
             notice, this list of conditions and the following disclaimer in the
             documentation and/or other materials provided with the distribution.
          c. Neither the name of Daniel Duckworth nor the names of
             its contributors may be used to endorse or promote products
             derived from this software without specific prior written
             permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
        ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
        ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
        LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
        OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
        DAMAGE.
        
        * subject to provisions in section 2 below
        
        2. Conditional Distribution Terms for Anaconda and NumFOCUS Channels
        
        Notwithstanding Section 1, redistribution of this software through the channels listed in Paragraph 2.1 below is subject to additional terms.
        
        2.1 Channels Subject to Additional Terms
        
        Anaconda, Inc., including but not limited to Anaconda Distribution and Anaconda Cloud
        
        NumFOCUS-affiliated or NumFOCUS-managed distribution infrastructure
        
        conda-forge and any mirrors, forks, or derivative services thereof
        
        2.2 Limitation to Distributors, Explicit Exemption of End Users from Section 2
        
        For the avoidance of doubt, only the entities distributing the software through the channels listed in Section 2.1 are responsible for compliance with Section 2, including payment of fees. End users who download or use the software from these channels, or any other channels, shall have no obligation or liability under Section 2 of this license.
        
        2.3 Explicit Exemption of PyPI from Section 2
        
        For the avoidance of doubt, distribution of this software via the Python Package Index (PyPI), including pypi.org and its mirrors, is not subject to Section 2.1, does not require a separate commercial distribution license, and remains fully governed by Sections 1 of this license (New BSD).
        
        2.4 Separate Distribution License Required
        
        Distribution through the channels listed above requires a separately executed commercial distribution license granted by the copyright holder.
        
        2.5 Fee Structure
        
        Such a license shall include, at minimum:
        
        An initial annual distribution fee of USD 10,000, granting the right to distribute the software for a period of one (1) calendar year; and
        
        A per-download fee of USD 1 per end-user download obtained through the above distribution channels during the licensed term.
        
        Fees shall be reported and remitted on a mutually agreed reporting schedule.
        
        2.6 No Implied Rights
        
        No rights to distribute via the channels listed in this Section are granted by this license absent a separately executed written agreement.
        
        2.7 Prohibited Distribution Without License
        
        Any distribution of this software through the channels listed in Paragraph 2.1 without a valid commercial distribution license constitutes unauthorized use and is expressly prohibited.
        
        2.8 Effect of Unauthorized Distribution
        
        In the event of unauthorized distribution:
        
        a. No license or permission is granted or implied by such distribution;
        
        b. The distributing party shall be deemed to be in material breach of this license; and
        
        c. The copyright holder reserves the right to pursue all available remedies, including but not limited to:
        
        Injunctive relief,
        
        Recovery of unpaid fees,
        
        Statutory or actual damages,
        
        Termination of any rights otherwise granted under this license.
        
        2.9 Cure and Compliance
        
        The copyright holder may, at its sole discretion, offer the distributing party an opportunity to cure unauthorized distribution by entering into a commercial distribution license retroactively. Nothing in this section shall be construed as a waiver of rights.
        
        2.10 Jurisdiction
        
        Any disputes arising out of or in connection with this agreement shall be governed solely by German law, with the exclusion of the UN Convention on Contracts for the International Sale of Goods (CISG). The Munich Regional Court (Landgericht München I) shall have exclusive jurisdiction in respect of any and all disputes arising out of or in connection with this agreement.
        
Project-URL: Homepage, https://github.com/pykalman/pykalman
Project-URL: Repository, https://github.com/pykalman/pykalman
Project-URL: Documentation, https://pykalman.readthedocs.io/en/latest/
Project-URL: Download, https://pypi.org/project/pykalman/
Keywords: kalman filter,smoothing,filter,smoothing,em,expectation-maximization,hmm,tracking,unscented
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: <3.15,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy<3
Requires-Dist: packaging
Requires-Dist: scikit-base<0.14.0
Requires-Dist: scipy<2.0.0
Provides-Extra: tests
Requires-Dist: pytest; extra == "tests"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Provides-Extra: docs
Requires-Dist: jupyter; extra == "docs"
Requires-Dist: Sphinx<10.0.0; extra == "docs"
Requires-Dist: numpydoc; extra == "docs"
Requires-Dist: matplotlib; extra == "docs"
Provides-Extra: all
Requires-Dist: jupyter; extra == "all"
Requires-Dist: pytest; extra == "all"
Requires-Dist: Sphinx<10.0.0; extra == "all"
Requires-Dist: numpydoc; extra == "all"
Requires-Dist: twine; extra == "all"
Requires-Dist: pre-commit; extra == "all"
Provides-Extra: numpy1
Requires-Dist: numpy<2; extra == "numpy1"
Dynamic: license-file

# Welcome to pykalman

<a href="https://github.com/pykalman/pykalman"><img src="https://github.com/pykalman/pykalman/blob/main/doc/source/images/pykalman-logo-with-name.png" width="175" align="right" /></a>

**The dead-simple Kalman Filter, Kalman Smoother, and EM library for Python.**

`pykalman` is a Python library for Kalman filtering and smoothing, providing efficient algorithms for state estimation in time series. It includes tools for linear dynamical systems, parameter estimation, and sequential data modeling. The library supports the Kalman Filter, Unscented Kalman Filter, and EM algorithm for parameter learning.

Originally created by Daniel Duckworth (@duckworthd).

:rocket: **Version 0.11.2 out now!** [Check out the release notes here](https://github.com/pykalman/pykalman/blob/main/CHANGELOG.md).

|  | **[Documentation](https://pykalman.readthedocs.io/en/latest/)** · **[Tutorials](https://github.com/pykalman/pykalman/tree/main/examples)** |
|---|---|
| **Open&#160;Source** | [![BSD 3-clause](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://github.com/pykalman/pykalman/blob/main/LICENSE) |
| **Community** | [![!discord](https://img.shields.io/static/v1?logo=discord&label=discord&message=chat&color=lightgreen)](https://discord.com/invite/54ACzaFsn7) [![!LinkedI](https://img.shields.io/static/v1?logo=linkedin&label=LinkedIn&message=news&color=lightblue)](https://www.linkedin.com/company/scikit-time/) |
| **Code** | [![!pypi](https://img.shields.io/pypi/v/pykalman?color=orange)](https://pypi.org/project/pykalman/) [![!python-versions](https://img.shields.io/pypi/pyversions/pykalman)](https://www.python.org/) [![!black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) |
| **Downloads** | ![PyPI - Downloads](https://img.shields.io/pypi/dw/pykalman) ![PyPI - Downloads](https://img.shields.io/pypi/dm/pykalman) [![Downloads](https://static.pepy.tech/personalized-badge/pykalman?period=total&units=international_system&left_color=grey&right_color=blue&left_text=cumulative%20(pypi))](https://pepy.tech/project/pykalman) |


## :speech_balloon: Where to ask questions

Questions and feedback are extremely welcome! We strongly believe in the value of sharing help publicly, as it allows a wider audience to benefit from it.

| Type                            | Platforms                               |
| ------------------------------- | --------------------------------------- |
| :bug: **Bug Reports**              | [GitHub Issue Tracker]                  |
| :sparkles: **Feature Requests & Ideas** | [GitHub Issue Tracker]                       |
| :woman_technologist: **Usage Questions**          |  [Stack Overflow] |
| :speech_balloon: **General Discussion**        | [Discord] |
| :factory: **Contribution & Development** | `dev-chat` channel · [Discord] |
| :globe_with_meridians: **Meet-ups and collaboration sessions** | [Discord] - Fridays 13 UTC, dev/meet-ups channel |

[github issue tracker]: https://github.com/pykalman/pykalman/issues
[stack overflow]: https://stackoverflow.com/questions/tagged/pykalman
[discord]: https://discord.com/invite/54ACzaFsn7


## :hourglass_flowing_sand: Install pykalman

- **Operating system**: macOS X · Linux · Windows 8.1 or higher
- **Python version**: Python 3.10, 3.11, 3.12, 3.13, and 3.14
- **Package managers**: [pip](https://pip.pypa.io/en/stable/)

For a quick installation::
```bash
pip install pykalman
```

Alternatively, you can setup from source:

```bash
pip install .
```

## :zap: Usage

``` python
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:

```python
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`:

```python
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:

```python
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

```python
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 [here](https://github.com/pykalman/pykalman/tree/main/examples).
