Skip to main content

Fractional Brownian Noise (fGN) and Fractional Brownian Motion (fBM) generators in Python.

Project description

fracbm

Fractional Gaussian Noise (fGN) and Fractional Brownian Motion (fBM) tools.

terrain gen with fbm

Installation

pip  install  fracbm

Usage

import matplotlib.pyplot as plt
import fracbm

# Parameters
n = 10000      # number of steps
H = 0.7       # Hurst parameter

# Fractional Brownian motion using Davies–Harte
fbm_path = fracbm.daviesharte.motion(n, H)      # cumulative sum of fGN
fgn_increments = fracbm.daviesharte.noise(n, H) # fractional Gaussian noise

# Wavelet based estimation of Hurst exponent
estimated_hurst = fracbm.invhurst(fbm_path)
print(f'Estimated Hurst Exponent = {estimated_hurst}')

# Plot the full fBm path
plt.figure(figsize=(10, 4))
plt.plot(fbm_path, label="fBM path (Davies–Harte)")
plt.xlabel("Step")
plt.ylabel("Value")
plt.title("Fractional Brownian Motion (H=0.8, Davies–Harte)")
plt.legend()
plt.show()

Features

Generate exact fractional Brownian motion using:

  • Cholesky decomposition, order $\mathcal{O}(n^3)$

  • Davies-Harte method, order $\mathcal{O}(n \log n)$ (recommended)

  • Vary the Hurst parameter $H \in [0,1]$:

  • $H = 0.5$ is regular Brownian motion.

  • $H > 0.5$ causes slowly decaying positive autocorrelations (positive increments tend to follow positive increments - increments follow a trend).

  • $H < 0.5$ causes fast-decaying negative autocorrelations (negative increments tend to follow positive increments - increments revert to the mean).

Determine the Hurst exponent of a time series:

  • Wavelet transform method
  • For n ~ 10000 or greater

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

fracbm-0.3.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

fracbm-0.3.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file fracbm-0.3.0.tar.gz.

File metadata

  • Download URL: fracbm-0.3.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for fracbm-0.3.0.tar.gz
Algorithm Hash digest
SHA256 baf8070b8749b4f0d3af92fd1e3c0f24426927183be5c82b43c9048040cb0b5d
MD5 4b4d24266abdcc6b51d645c4aa5ac349
BLAKE2b-256 d8d75aaf0b17f50676d6b35a51f7acd0e76df88e9875059ae736a4daa9aba950

See more details on using hashes here.

File details

Details for the file fracbm-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: fracbm-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for fracbm-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70635fb7729bb2cb3fde2c8b6fb4d5487c6fac2d1cda4db3f517f40273a4d92f
MD5 6ecd10ce323047c49afc72ea787d1d02
BLAKE2b-256 e686b1af80e2940cef250b247998a07113888f98f4d6e4d3f3fd89c000bd8092

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