{"id":18931982,"url":"https://github.com/crflynn/fbm","last_synced_at":"2025-06-15T01:39:40.798Z","repository":{"id":51990689,"uuid":"49174172","full_name":"crflynn/fbm","owner":"crflynn","description":"Exact methods for simulating fractional Brownian motion and fractional Gaussian noise in python","archived":false,"fork":false,"pushed_at":"2021-05-08T12:29:42.000Z","size":67,"stargazers_count":98,"open_issues_count":1,"forks_count":30,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-06-08T22:03:43.340Z","etag":null,"topics":["fractional-brownian-motion","fractional-gaussian-noise","hurst-parameter","multifractional-brownian-motion","multifractional-gaussian-noise","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crflynn.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-07T01:58:27.000Z","updated_at":"2025-05-20T14:58:28.000Z","dependencies_parsed_at":"2022-08-26T04:01:32.553Z","dependency_job_id":null,"html_url":"https://github.com/crflynn/fbm","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/crflynn/fbm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crflynn%2Ffbm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crflynn%2Ffbm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crflynn%2Ffbm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crflynn%2Ffbm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crflynn","download_url":"https://codeload.github.com/crflynn/fbm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crflynn%2Ffbm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259910053,"owners_count":22930670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fractional-brownian-motion","fractional-gaussian-noise","hurst-parameter","multifractional-brownian-motion","multifractional-gaussian-noise","python"],"created_at":"2024-11-08T11:47:31.643Z","updated_at":"2025-06-15T01:39:40.777Z","avatar_url":"https://github.com/crflynn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"fbm\n===\n\n**Support of this package has been discontinued in favor of the more robust** `stochastic \u003chttps://github.com/crflynn/stochastic\u003e`__ **package, which includes fractional Brownian motion and multifractional Brownian motion implementations among many other stochastic processes for simulation.**\n\n|travis| |codecov| |pypi| |pyversions|\n\n.. |travis| image:: https://img.shields.io/travis/crflynn/fbm.svg\n    :target: https://travis-ci.org/crflynn/fbm\n\n.. |codecov| image:: https://codecov.io/gh/crflynn/fbm/branch/master/graphs/badge.svg\n    :target: https://codecov.io/gh/crflynn/fbm\n\n.. |pypi| image:: https://img.shields.io/pypi/v/fbm.svg\n    :target: https://pypi.python.org/pypi/fbm\n\n.. |pyversions| image:: https://img.shields.io/pypi/pyversions/fbm.svg\n    :target: https://pypi.python.org/pypi/fbm\n\n* Exact methods for simulating fractional Brownian motion (fBm) or fractional\n  Gaussian noise (fGn) in python.\n* *Approximate* simulation of multifractional Brownian motion (mBm) or\n  multifractional Gaussian noise (mGn).\n\nInstallation\n------------\n\nThe fbm package is available on PyPI and can be installed via pip:\n\n.. code-block::\n\n    pip install fbm\n\nfractional Brownian motion\n--------------------------\n\nFractional Brownian motion can be generated via either Hosking's method, the\nCholesky method, or the Davies-Harte method. All three methods are\ntheoretically exact in generating a discretely sampled fBm/fGn.\n\nUsage:\n\n.. code-block:: python\n\n    from fbm import FBM\n\n\n    f = FBM(n=1024, hurst=0.75, length=1, method='daviesharte')\n    # or\n    f = FBM(1024, 0.75)\n\n    # Generate a fBm realization\n    fbm_sample = f.fbm()\n\n    # Generate a fGn realization\n    fgn_sample = f.fgn()\n\n    # Get the times associated with the fBm\n    t_values = f.times()\n\nwhere ``n`` is the number of equispaced increments desired for a fBm with Hurst\nparameter ``hurst`` on the interval [0, ``length``]. Method can be\neither ``'hosking'``, ``'cholesky'``, or ``'daviesharte'``. The ``fbm()``\nmethod returns a length ``n+1`` array of discrete values for the fBm (includes\n0). The ``fgn()`` method returns a length ``n`` array of fBm\nincrements, or fGn. The ``times()`` method returns a length ``n+1`` array of\ntimes corresponding to the fBm realizations.\n\nThe ``n`` and ``hurst`` parameters are required. The ``length`` parameter\ndefaults to 1 and ``method`` defaults to ``'daviesharte'``.\n\nFor simulating multiple realizations use the FBM class provided as above. Some\nintermediate values are cached for repeated simulation.\n\nFor one-off samples of fBm or fGn there are separate functions available:\n\n.. code-block:: python\n\n    from fbm import fbm, fgn, times\n\n\n    # Generate a fBm realization\n    fbm_sample = fbm(n=1024, hurst=0.75, length=1, method='daviesharte')\n\n    # Generate a fGn realization\n    fgn_sample = fgn(n=1024, hurst=0.75, length=1, method='daviesharte')\n\n    # Get the times associated with the fBm\n    t_values = times(n=1024, length=1)\n\nFor fastest performance use the Davies and Harte method. Note that the\nDavies and Harte method can fail if the Hurst parameter ``hurst`` is close to\n1 and there are a small amount of increments ``n``. If this occurs, a warning\nis printed to the console and it will fallback to using Hosking's method to\ngenerate the realization. See page 412 of the following paper for a more\ndetailed explanation:\n\n* Wood, Andrew TA, and Grace Chan. \"Simulation of stationary Gaussian processes\n  in [0, 1] d.\" Journal of computational and graphical statistics 3, no. 4\n  (1994): 409-432.\n\n\n**Hosking's method:**\n\n* Hosking, Jonathan RM. \"Modeling persistence in hydrological time series\n  using fractional differencing.\" Water resources research 20, no. 12 (1984):\n  1898-1908.\n\n**Cholesky method:**\n\n* Asmussen, Søren. Stochastic simulation with a view towards stochastic\n  processes. University of Aarhus. Centre for Mathematical Physics and\n  Stochastics (MaPhySto)[MPS], 1998.\n\n**Davies Harte method:**\n\n* Davies, Robert B., and D. S. Harte. \"Tests for Hurst effect.\" Biometrika 74,\n  no. 1 (1987): 95-101.\n\n\nmultifractional Brownian motion\n-------------------------------\n\nThis package supports *approximate* generation of multifractional\nBrownian motion. The current method uses the Riemann–Liouville fractional\nintegral representation of mBm.\n\nUsage:\n\n.. code-block:: python\n\n    import math\n    from fbm import MBM\n\n\n    # Example Hurst function with respect to time.\n    def h(t):\n        return 0.25 * math.sin(20*t) + 0.5\n\n    m = MBM(n=1024, hurst=h, length=1, method='riemannliouville')\n    # or\n    m = MBM(1024, h)\n\n    # Generate a mBm realization\n    mbm_sample = m.mbm()\n\n    # Generate a mGn realization\n    mgn_sample = m.mgn()\n\n    # Get the times associated with the mBm\n    t_values = m.times()\n\n\nThe ``hurst`` argument here should be a callable that accepts one argument\nand returns a float in (0, 1).\n\nFor one-off samples of mBm or mGn there are separate functions available:\n\n.. code-block:: python\n\n    from fbm import mbm, mgn, times\n\n\n    # Define a hurst function\n    def h(t):\n        return 0.75 - 0.5 * t\n\n    # Generate a mbm realization\n    mbm_sample = mbm(n=1024, hurst=h, length=1, method='riemannliouville')\n\n    # Generate a fGn realization\n    mgn_sample = mgn(n=1024, hurst=h, length=1, method='riemannliouville')\n\n    # Get the times associated with the mBm\n    t_values = times(n=1024, length=1)\n\n\n**Riemann-Liouville representation method:**\n\n*Approximate* method originally proposed for fBm in\n\n* Rambaldi, Sandro, and Ombretta Pinazza. \"An accurate fractional Brownian\n  motion generator.\" Physica A: Statistical Mechanics and its Applications 208,\n  no. 1 (1994): 21-30.\n\nAdapted to approximate mBm in\n\n* Muniandy, S. V., and S. C. Lim. \"Modeling of locally self-similar processes\n  using multifractional Brownian motion of Riemann-Liouville type.\" Physical\n  Review E 63, no. 4 (2001): 046104.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrflynn%2Ffbm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrflynn%2Ffbm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrflynn%2Ffbm/lists"}