Skip to main content

thermox

This package provides a very simple interface to exactly simulate Ornstein-Uhlenbeck (OU) processes of the form

$$ dx = - A(x - b) dt + \mathcal{N}(0, D dt) $$

To collect samples from this process, define sampling times ts, initial state x0, drift matrix A, displacement vector b, diffusion matrix D and a JAX random key. Then run thermox.sample:

thermox.sample(key, ts, x0, A, b, D) 

Samples are then collected by exact diagonalization (therefore there is no discretization error) and JAX scans.

You can access log-probabilities of the OU process by running thermox.log_prob:

thermox.log_prob(ts, xs, A, b, D)

which can be useful for e.g. maximum likelihood estimation of the parameters A, b and D by composing with jax.grad.

Additionally thermox provides a scipy style suit of thermodynamic linear algebra primitives: thermox.linalg.solve, thermox.linalg.inv, thermox.linalg.expm and thermox.linalg.negexpm which all simulate an OU process under the hood. More details can be found in the thermo_linear_algebra.ipynb notebook.

Contributing

Before submitting any pull request, make sure to run pre-commit run --all-files.

Example usage

Here is a simple code example for a 5-dimensional OU process:

import thermox
import jax
import jax.numpy as jnp
import matplotlib.pyplot as plt

# Set random seed
key = jax.random.PRNGKey(0)

# Timeframe
dt = 0.01
ts = jnp.arange(0, 1, dt)

# System parameters for a 5-dimensional OU process
A = jnp.array([[2.0, 0.5, 0.0, 0.0, 0.0],
               [0.5, 2.0, 0.5, 0.0, 0.0],
               [0.0, 0.5, 2.0, 0.5, 0.0],
               [0.0, 0.0, 0.5, 2.0, 0.5],
               [0.0, 0.0, 0.0, 0.5, 2.0]])

b, x0 = jnp.zeros(5), jnp.zeros(5) # Zero drift displacement vector and initial state

 # Diffusion matrix with correlations between x_1 and x_2
D = jnp.array([[2, 1, 0, 0, 0],
               [1, 2, 0, 0, 0],
               [0, 0, 2, 0, 0],
               [0, 0, 0, 2, 0],
               [0, 0, 0, 0, 2]])

# Collect samples
samples = thermox.sample(key, ts, x0, A, b, D)

plt.figure(figsize=(12, 5))
plt.plot(ts, samples, label=[f'Dimension {i+1}' for i in range(5)])
plt.xlabel('Time')
plt.ylabel('Value')
plt.title('Trajectories of 5-Dimensional OU Process')
plt.legend()
plt.show()


Citation

If you use thermox in your research, please cite the library using the following BibTeX entry:

@misc{duffield2024thermox,
  title={thermox: Exact OU processes with JAX},
  author={Duffield, Samuel and Donatella, Kaelan and Melanson, Denis},
  howpublished={\url{https://github.com/normal-computing/thermox}},
  year={2024}
}

Metadata

Release files for thermox 0.0.6

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

Source distribution (sdist)

Source distribution for thermox 0.0.6
File Size Uploaded Provenance Actions
thermox-0.0.6.tar.gz 15.1 kB With provenance Details for thermox-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for thermox 0.0.6
File Interpreter ABI Platform Actions
thermox-0.0.6-py3-none-any.whl Python 3 none any Details for thermox-0.0.6-py3-none-any.whl

Total release size: 28.8 kB

Release files / thermox-0.0.6.tar.gz

Download URL thermox-0.0.6.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1ca4002f87d07b83c4ad3e9adb68b11b76cb4098d7afe9bc427a4e6fd0c85a70
BLAKE2b-256 checksum
How to use checksums
b59cb98a0d1456e1ca597ad7fb8f9e6e23001e104ec4366e4b7e4dcbdba63b12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / thermox-0.0.6-py3-none-any.whl

Download URL thermox-0.0.6-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7088f056672a30fc50f24e7231fee3d285d2399f4a678657c49bed274aee3242
BLAKE2b-256 checksum
How to use checksums
d979c26a04a7c82a5a2f1e7ca1fb64892203d5a1fe7d519cb2d9e8387702ff68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Security for thermox 0.0.6

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for thermox-0.0.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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