samplepaths

Tests Documentation PyPI version Python versions Weekly downloads Total downloads License

Realizations of a Brownian motion with drift and their quantile bands

samplepaths is a Python package for generating realizations (sample paths) of stochastic processes as numpy arrays. It is pure Python on numpy, and for large simulations as fast as compiled code.

from samplepaths import BrownianMotion

bm = BrownianMotion(drift=1, scale=2, t=10)
path = bm.sample(1000)  # 1001 values on [0, 10]
paths = bm.sample_paths(1000, paths=5000)  # 5000 realizations at once
paths = bm.sample_paths(1000, paths=50_000, workers=8)  # on 8 threads

It provides 68 processes in six families, all sharing one small interface:

One example process of each of the six families

samplepaths is an independently maintained fork of stochastic by Christopher Flynn, modernized for current Python, numpy and scipy releases and shipped with type hints. See About the Project for what the fork adds and Migrating from stochastic for the changes needed to port existing code.

samplepaths is maintained by Bassem Girgis.

User guide

Indices