kramersmoyal
The Python package `kramersmoyal` provides functions to analyze stochastic drift-diffusion and discontinuous stochastic processes in observational and experimental data.
Description
Overview
Understanding complex processes in nature often necessitates describing them as stochastic processes that split the dynamics into a deterministic and a fluctuating part.
The coefficients that quantify these stochastic processes can be obtained from time series via the Kramers-Moyal expansion.
Deriving these Kramal-Moyal Coefficients makes valuable insights into the underlying dynamics accessible.
The Python package kramersmoyal offers a comprehensive way to derive these coefficients for multi-dimensional time series.
It was developed at the Institute of Energy and Climate Research at the Forschungszentrum Jülich GmbH and is available at github.com/LRydin/KramersMoyal.
It can be installed via pip from PyPI (pypi.org/project/kramersmoyal/).
Some basic examples of how to use kramersmoyal can be found in the Github repository and documentation is available at kramersmoyal.readthedocs.io. Specifically, an example of a one-dimensional and a two-dimensional stochastic process is provided both in the documentation and as a jupyter notebook kmc.ipynb.
A more detailed description of the package and the underlying theory is published in the peer-reviewed article in the The Journal of Open Source Software (DOI: 10.21105/joss.01693).
Citation
If you use kramersmoyal in your research, please cite it as:
Rydin Gorjão, L., and Meirinhos, F. (2019). kramersmoyal: Kramers--Moyal coefficients for stochastic processes. Journal of Open Source Software, 4(44), 1693. DOI: 10.21105/joss.01693
Acknowlegments
The authors acknowledge the funding by the Helmholtz Association vias the Initiative Energy System 2050 - A Contribution of the Research Field Energy, grant No. VH-NG-1025, and STORM - Stochastics for Time-Space Risk Models project of the Research Council of Norway (RCN) No. 274410.
- MIT
Participating organisations
Reference papers
Mentions
- 1.Author(s): Xinyi Wen, Ulrich Oberhofer, Leonardo Rydin Gorjão, G.Cigdem Yalcin, Veit Hagenmeyer, Benjamin SchäferPublished in The 15th ACM International Conference on Future and Sustainable Energy Systems by ACM in 2024, page: 408-41410.1145/3632775.3661944
- 2.Author(s): Ulrich Oberhofer, Leonardo Rydin Gorjao, G. Cigdem Yalcin, Oliver Kamps, Veit Hagenmeyer, Benjamin SchaferPublished in 2023 IEEE Belgrade PowerTech by IEEE in 2023, page: 1-110.1109/powertech55446.2023.10202986
- 1.Author(s): Otoniel Walle-García, M. Valentina I. Soto-Rocha, Fernando Saldaña-Jiménez, Francisco Hernández-Cabrera, Francisco-Javier Almaguer-MartínezPublished in Stochastic Environmental Research and Risk Assessment by Springer Science and Business Media LLC in 2025, page: 1237-125210.1007/s00477-024-02899-6
- 2.Author(s): Shailendra Bhandari, Pedro Lencastre, Sergey Denisov, Yurii S. Bystryk, Pedro G. LindPublished in SoftwareX by Elsevier BV in 2025, page: 10233410.1016/j.softx.2025.102334
- 3.Author(s): Christian Wiedemann, Matthias Wächter, Jan A. Freund, Joachim PeinkePublished in The European Physical Journal B by Springer Science and Business Media LLC in 202510.1140/epjb/s10051-025-00883-9
- 4.Author(s): L. Heck, M. Gelbrecht, M. T. Schaub, N. BoersPublished in Chaos: An Interdisciplinary Journal of Nonlinear Science by AIP Publishing in 202510.1063/5.0257224
- 5.Author(s): Tim Drewnick, Xinyi Wen, Ulrich Oberhofer, Leonardo Rydin Gorjão, Christian Beck, Veit Hagenmeyer, Benjamin SchäferPublished in Chaos: An Interdisciplinary Journal of Nonlinear Science by AIP Publishing in 202510.1063/5.0239371
- 6.Author(s): G. Viera-López, J.J. Morgado-Vega, A. Reyes, E. Altshuler, Yudivián Almeida-Cruz, Giorgio ManganiniPublished in AI Open by Elsevier BV in 2024, page: 87-9310.1016/j.aiopen.2024.06.001
- 7.Author(s): Ali Asghar Movahed, Houshyar NoshadPublished in Scientific Reports by Springer Science and Business Media LLC in 202410.1038/s41598-024-51863-5
- 8.Author(s): Christian Wiedemann, Matthias Wächter, Joachim Peinke, Jan A. FreundPublished in The European Physical Journal B by Springer Science and Business Media LLC in 202410.1140/epjb/s10051-024-00686-4
- 9.Author(s): Andreas Morr, Keno Riechers, Leonardo Rydin Gorjão, Niklas BoersPublished in Physical Review Research by American Physical Society (APS) in 202410.1103/physrevresearch.6.033251
- 10.Author(s): Clemens Willers, Oliver KampsPublished in Journal of Computational Physics by Elsevier BV in 2024, page: 11262610.1016/j.jcp.2023.112626
- 11.Author(s): Jacques Maritz, Leonardo Rydin Gorjão, P. Armand Bester, Nicolaas Esterhuysen, Stefaans Erasmus, Stephanus Riekert, Reuben Immelman, Tiaan Geldenhuys, Alexandra Viljoen, Charl BodensteinPublished in IEEE Access by Institute of Electrical and Electronics Engineers (IEEE) in 2024, page: 14466-1447310.1109/access.2024.3357945
- 12.Author(s): Wenqing Sun, Jinqian Feng, Jin Su, Qin GuoPublished in Physical Review E by American Physical Society (APS) in 202310.1103/physreve.108.035306
- 13.Author(s): Philipp C. Böttcher, Leonardo Rydin Gorjão, Christian Beck, Richard Jumar, Heiko Maass, Veit Hagenmeyer, Dirk Witthaut, Benjamin SchäferPublished in Energy Advances by Royal Society of Chemistry (RSC) in 2023, page: 91-9710.1039/d2ya00150k
- 14.Author(s): William DavisPublished in Physical Review E by American Physical Society (APS) in 202310.1103/physreve.108.054110
- 15.Author(s): Leonardo Rydin Gorjão, Jacques MaritzPublished in Journal of Physics: Complexity by IOP Publishing in 2023, page: 01500710.1088/2632-072x/acb629
- 16.Author(s): Keno Riechers, Leonardo Rydin Gorjão, Forough Hassanibesheli, Pedro G. Lind, Dirk Witthaut, Niklas BoersPublished in Earth System Dynamics by Copernicus GmbH in 2023, page: 593-60710.5194/esd-14-593-2023
- 17.Author(s): Arshed Nabeel, Vivek Jadhav, Danny Raj M, Clément Sire, Guy Theraulaz, Ramón Escobedo, Srikanth K Iyer, Vishwesha GuttalPublished in Physical Biology by IOP Publishing in 2023, page: 05600310.1088/1478-3975/ace22d
- 18.Author(s): William Davis, Bruce BuffettPublished in Physical Review E by American Physical Society (APS) in 202210.1103/physreve.106.014140
- 19.Author(s): Leonardo Rydin Gorjão, Dirk Witthaut, Klaus Lehnertz, Pedro G. LindPublished in Entropy by MDPI AG in 2021, page: 51710.3390/e23050517
- 20.Author(s): Cihan Ayaz, Lucas Tepper, Florian N. Brünig, Julian Kappler, Jan O. Daldrop, Roland R. NetzPublished in Proceedings of the National Academy of Sciences by Proceedings of the National Academy of Sciences in 202110.1073/pnas.2023856118
- 21.Author(s): Esra Aslim, Thorsten Rings, Lina Zabawa, Klaus LehnertzPublished in Journal of Statistical Mechanics: Theory and Experiment by IOP Publishing in 2021, page: 03340610.1088/1742-5468/abe59a
- 22.Author(s): François Sicard, Vladimir Koskin, Alessia Annibale, Edina RostaPublished in Journal of Chemical Theory and Computation by American Chemical Society (ACS) in 2021, page: 2022-203310.1021/acs.jctc.0c01151
- 23.Author(s): Leonardo Rydin Gorjao, Mehrnaz Anvari, Holger Kantz, Christian Beck, Dirk Witthaut, Marc Timme, Benjamin SchaferPublished in IEEE Access by Institute of Electrical and Electronics Engineers (IEEE) in 2020, page: 43082-4309710.1109/access.2020.2967834
- 24.Author(s): Leonardo Rydin Gorjão, Richard Jumar, Heiko Maass, Veit Hagenmeyer, G. Cigdem Yalcin, Johannes Kruse, Marc Timme, Christian Beck, Dirk Witthaut, Benjamin SchäferPublished in Nature Communications by Springer Science and Business Media LLC in 202010.1038/s41467-020-19732-7
- 25.Author(s): Leonardo Rydin Gorjão, Jan Heysel, Klaus Lehnertz, M. Reza Rahimi TabarPublished in Physical Review E by American Physical Society (APS) in 201910.1103/physreve.100.062127
- 1.Author(s): Riechers, Keno, Morr, Andreas, Lehnertz, Klaus, Goncalves Lind, Pedro, Boers, Niklas, Witthaut, Dirk, Rydin Gorjão, LeonardoPublished in 202510.1007/s00382-025-07880-9
- 2.Author(s): Xinyi Wen, Mehrnaz Anvari, Leonardo Rydin Gorjão, G. Cigdem Yalcin, Veit Hagenmeyer, Benjamin SchäferPublished in 202510.1038/s41598-025-25334-4
- 3.Author(s): Otoniel Walle, María Valentina Iréndira Soto, Fernando Saldaña, Francisco Hernández, Francisco Javier AlmaguerPublished by Springer Science and Business Media LLC in 202410.21203/rs.3.rs-3994840/v1
- 4.Author(s): Leonardo Rydin GorjãoPublished by Copernicus GmbH in 202210.5194/esd-2021-95-ac1
- 5.Author(s): Leonardo Rydin GorjãoPublished by Copernicus GmbH in 202210.5194/esd-2021-95-ac2
- 6.Author(s): Peter DitlevsenPublished by Copernicus GmbH in 202210.5194/esd-2021-95-rc1
- 7.Author(s): Tamas BodaiPublished by Copernicus GmbH in 202210.5194/esd-2021-95-rc2
- 8.Author(s): Leonardo Rydin Gorjão, Keno Riechers, Forough Hassanibesheli, Dirk Witthaut, Pedro G. Lind, Niklas BoersPublished by Copernicus GmbH in 202110.5194/esd-2021-95
- 9.Author(s): Leonardo Rydin Gorjão, Dirk Witthaut, Pedro G. Lind, Wided MedjroubiPublished by MDPI AG in 202110.20944/preprints202112.0277.v1
- 10.Author(s): Leonardo Gorjão, Richard Jumar, Heiko Maass, Veit Hagenmeyer, G. Cigdem Yalcin, Johannes Kruse, Marc Timme, Christian Beck, Dirk Witthaut, Benjamin SchäferPublished by Springer Science and Business Media LLC in 202010.21203/rs.3.rs-37766/v1
- 11.Author(s): Francois Sicard, Vladimir Koskin, Alessia Annibale, Edina RostaPublished by arXiv in 202010.48550/arxiv.2010.06475