Skip to main content

Basic ODE filtering and smooting implementation.

Project description

ODE Filters

PyPI Python CI Docs Coverage

A JAX-based implementation of probabilistic ODE solvers using Gaussian filtering and smoothing. This package provides tools for solving ordinary differential equations while quantifying uncertainty through Bayesian inference.

Features

  • Pure JAX implementation - Fully differentiable and JIT-compilable
  • Square-root filtering - Numerically stable EKF and RTS smoothing
  • Flexible priors - Integrated Wiener Process (IWP), Matern, and joint priors
  • First and second-order ODEs - Native support for both ODE types
  • Constraint handling - Conservation laws and time-varying measurements
  • State-parameter estimation - Joint inference with hidden states
  • Black-box measurements - Custom observation models with autodiff Jacobians
  • Transformed measurements - Nonlinear state transformations with chain-rule Jacobians

Installation

Install the latest release from PyPI:

pip install ode-filters

Or install from source with development dependencies:

git clone https://github.com/paufisch/ode_filters.git
cd ode_filters
pip install -e ".[dev]"

Quick Example

import jax.numpy as np
from ode_filters.filters import ekf1_sqr_loop, rts_sqr_smoother_loop
from ode_filters.measurement import ODEInformation
from ode_filters.priors import IWP, taylor_mode_initialization

# Define ODE: dx/dt = -x (exponential decay)
def vf(x, *, t):
    return -x

x0 = np.array([1.0])
tspan = [0, 5]

# Setup prior and measurement model
prior = IWP(q=2, d=1, Xi=0.5 * np.eye(1))
mu_0, Sigma_0_sqr = taylor_mode_initialization(vf, x0, q=2)
measure = ODEInformation(vf, prior.E0, prior.E1)

# Run filter and smoother
m_seq, P_sqr, *_, G, d, P_back, _, _ = ekf1_sqr_loop(
    mu_0, Sigma_0_sqr, prior, measure, tspan, N=50
)
m_smooth, P_smooth_sqr = rts_sqr_smoother_loop(
    m_seq[-1], P_sqr[-1], G, d, P_back, N=50
)

Package Structure

ode_filters/
├── filters/          # EKF and RTS smoothing loops
├── inference/        # Square-root Gaussian algebra
├── measurement/      # ODE and observation models
└── priors/           # Gaussian Markov process priors

Documentation

Full documentation is available at paufisch.github.io/ode_filters.

Development

Run the test suite:

uv run pytest --cov=ode_filters --cov-report=term-missing

Build documentation locally:

uv run mkdocs serve

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ode_filters-0.6.1.tar.gz (118.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ode_filters-0.6.1-py3-none-any.whl (47.5 kB view details)

Uploaded Python 3

File details

Details for the file ode_filters-0.6.1.tar.gz.

File metadata

  • Download URL: ode_filters-0.6.1.tar.gz
  • Upload date:
  • Size: 118.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ode_filters-0.6.1.tar.gz
Algorithm Hash digest
SHA256 4a6d9f788d9ed3e76802f8f882657c0268aa922c6266b0eecb6e311901d62a30
MD5 af3a6fd05222c9af4e5ae158d62be3e5
BLAKE2b-256 8670f80cfdc6b9e0a8b396741280232ed9c19741ca408ad1b1932dcf522f0eb9

See more details on using hashes here.

File details

Details for the file ode_filters-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: ode_filters-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 47.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ode_filters-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a67d2b0eb94e2ccb793ff92ea9c896491f4bfbf4519d535bb3fd426f7e2e6fd
MD5 c914558e2bfa43a48b6199eab0543ee9
BLAKE2b-256 bbcb941aff88b4951bdc47b4f143fe2271aaa6aa7f45a1392f0538ea75b3387f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page