ewstools

ewstools: A Python package for early warning signals of bifurcations in time series data - Published in JOSS (2023)

https://github.com/thomasmbury/ewstools

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 8 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: nature.com, plos.org, joss.theoj.org
  • Committers with academic emails
    2 of 7 committers (28.6%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

autocorrelation bifurcation bootstrapping complex-systems critical-transitions early-warning-indicators early-warning-signals forecasting ipynb power-spectrum python resilience-indicators time-series tipping-point visualization

Keywords from Contributors

turing-machine cryptocurrencies pde standardization pypi simulations metaheuristic phylogenetics benchmarking global-optimization
Last synced: 6 months ago · JSON representation

Repository

Python package for early warning signals (EWS) of bifurcations in time series data.

Basic Info
  • Host: GitHub
  • Owner: ThomasMBury
  • License: mit
  • Language: Jupyter Notebook
  • Default Branch: main
  • Homepage:
  • Size: 40.9 MB
Statistics
  • Stars: 90
  • Watchers: 4
  • Forks: 19
  • Open Issues: 6
  • Releases: 7
Topics
autocorrelation bifurcation bootstrapping complex-systems critical-transitions early-warning-indicators early-warning-signals forecasting ipynb power-spectrum python resilience-indicators time-series tipping-point visualization
Created over 7 years ago · Last pushed 8 months ago
Metadata Files
Readme License Zenodo

README.md

PyPI version Downloads Documentation Status tests codecov DOI

ewstools

A Python package for early warning signals (EWS) of bifurcations in time series data.

Overview

Many systems in nature and society can undergo critical transitions—sudden, often irreversible shifts in dynamics. Examples include the outbreak of disease, ecosystem collapse, and cardiac arrhythmias. Mathematically, such transitions often correspond to bifurcations (tipping points) in an underlying dynamical system.

Scheffer et al. (2009) proposed early warning signals (EWS) for bifurcations based on noisy fluctuations in time series data, sparking a surge of related ways to predict bifurcations (see Dakos et al. (2024) for a recent review). More recently, deep learing has shown great potential for predicting bifurcations and their type (Bury et al. 2021).

ewstools is a Python package for computing and visualizing EWS in time series. It complements the R package by (Dakos et al. 2012) and meets growing demand for Python-based tools (PYPL, 2022).

Features include: - An intuitive, object-oriented framework for computing EWS - Detrending methods: - Gaussian kernel smoothing - LOWESS (Locally Weighted Scatterplot Smoothing) - Computation of critical slowing down (CSD) indicators: - Variance, standard deviation, coefficient of variation - Autocorrelation (at specified lags) - Skewness, kurtosis - Power spectra metrics - Entropy measures - Kendall tau statistics to quantify trends - Deep learning classifiers for bifurcation prediction (Bury et al. 2021) - Visualization tools - Built-in dynamical system models for testing EWS

ewstools uses pandas for dataframe handling, numpy for fast numerical computing, plotly for visualisation, lmfit for least-squares minimisation, arch for bootstrapping methods, EntropyHub for entropy computations, statsmodels and scipy for detrending methods, and TensorFlow for deep learning.

Install

Requires Python 3.8–3.11. Install via:

bash pip install --upgrade pip pip install ewstools

For tutorials, install Jupyter notebook:

bash pip install jupyter notebook

To enable deep learning features, install TensorFlow:

bash pip install ewstools[tf] Note: TensorFlow for ewstools is currently supported on Linux and macOS only.

To install the latest development version:

bash pip install git+https://github.com/thomasmbury/ewstools.git#egg=ewstools (Development versions may be unstable.)

Tutorials

  1. Introduction to ewstools
  2. Spectral EWS
  3. Deep learning classifiers for bifurcation prediction

Quick demo

Code available in ./quick_demo.ipynb. Import ewstools and simulate a time series (e.g., the Ricker model): python import ewstools from ewstools.models import simulate_ricker series = simulate_ricker(tmax=500, F=[0,2.7]) series.plot();

Create a TimeSeries object:

python ts = ewstools.TimeSeries(data=series, transition=440)

Detrend, compute EWS, and calculate trends:

python ts.detrend(method='Lowess', span=0.2) ts.compute_var(rolling_window=0.5) ts.compute_auto(lag=1, rolling_window=0.5) ts.compute_auto(lag=2, rolling_window=0.5) ts.compute_ktau()

Get predictions from deep learning classifiers python for idx, classifier in enumerate(list_classifiers): ts.apply_classifier_inc(classifier, inc=10, verbose=0, name=str(idx))

Make an interactive visualization in Plotly:

python ts.make_plotly()

For detailed demonstrations, see the tutorials.

Documentation

Full documentation available on ReadTheDocs.

Issues

Found a bug or have a suggestion? Please post it on the issue tracker.

Contributions are welcome! Feel free to reach out or submit a pull request.

Acknowledgements

This work is supported by an FRQNT postdoctoral research scholarship awarded to Dr. Thomas Bury. Previous support was provided by NSERC Discovery Grants awarded to Dr. Chris Bauch and Dr. Madhur Anand.

Citation info

If you find ewstools useful, please consider starring the repository ⭐ and citing:

Bury, Thomas M. "ewstools: A Python package for early warning signals of bifurcations in time series data." Journal of Open Source Software 8.82 (2023): 5038.

Owner

  • Name: Thomas Bury
  • Login: ThomasMBury
  • Kind: user
  • Location: Canada
  • Company: McGill University

Analysing tipping points in complex systems through data science and dynamical systems.

JOSS Publication

ewstools: A Python package for early warning signals of bifurcations in time series data
Published
February 11, 2023
Volume 8, Issue 82, Page 5038
Authors
Thomas M. Bury ORCID
Department of Physiology, McGill University, Montréal, Canada, Department of Applied Mathematics, University of Waterloo, Waterloo, Canada
Editor
Øystein Sørensen ORCID
Tags
time series early warning signal tipping point dynamical system bifurcation

Papers & Mentions

Total mentions: 1

Detecting and distinguishing tipping points using spectral early warning signals
Last synced: 4 months ago

GitHub Events

Total
  • Watch event: 13
  • Delete event: 2
  • Issue comment event: 3
  • Push event: 26
  • Pull request event: 8
  • Fork event: 3
  • Create event: 5
Last Year
  • Watch event: 13
  • Delete event: 2
  • Issue comment event: 3
  • Push event: 26
  • Pull request event: 8
  • Fork event: 3
  • Create event: 5

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 547
  • Total Committers: 7
  • Avg Commits per committer: 78.143
  • Development Distribution Score (DDS): 0.049
Past Year
  • Commits: 30
  • Committers: 2
  • Avg Commits per committer: 15.0
  • Development Distribution Score (DDS): 0.1
Top Committers
Name Email Commits
Thomas Bury t****2@g****m 520
Thomas Bury 3****2 10
pyup-bot g****t@p****o 6
dependabot[bot] 4****] 5
Snaptraks s****s@g****m 3
Daniel S. Katz d****z@i****g 2
Emma Southall e****l@w****k 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 7
  • Total pull requests: 114
  • Average time to close issues: about 1 month
  • Average time to close pull requests: about 1 month
  • Total issue authors: 6
  • Total pull request authors: 5
  • Average comments per issue: 1.29
  • Average comments per pull request: 0.6
  • Merged pull requests: 17
  • Bot issues: 0
  • Bot pull requests: 20
Past Year
  • Issues: 0
  • Pull requests: 11
  • Average time to close issues: N/A
  • Average time to close pull requests: 3 days
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.09
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 9
Top Authors
Issue Authors
  • denisthenichita (2)
  • harishankar1014 (1)
  • jjvaldes (1)
  • gabosantos (1)
  • ThomasMBury (1)
  • alxgom (1)
Pull Request Authors
  • pyup-bot (88)
  • dependabot[bot] (22)
  • ThomasMBury (6)
  • Snaptraks (2)
  • danielskatz (1)
Top Labels
Issue Labels
Pull Request Labels
dependencies (22) python (9)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 95 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 3
  • Total versions: 17
  • Total maintainers: 1
pypi.org: ewstools

Python package to compute early warning signals (EWS)

  • Versions: 17
  • Dependent Packages: 0
  • Dependent Repositories: 3
  • Downloads: 95 Last month
Rankings
Stargazers count: 8.9%
Dependent repos count: 9.0%
Dependent packages count: 10.0%
Forks count: 10.2%
Average: 11.6%
Downloads: 19.8%
Maintainers (1)
Last synced: 6 months ago

Dependencies

requirements_dev.txt pypi
  • arch ==5.3.1
  • black ==22.6.0
  • numpy ==1.23.0
  • pandas ==1.4.3
  • pip ==22.1.2
  • pytest ==7.1.2
  • pytest-cov ==3.0.0
  • setuptools ==62.6.0
  • sphinx ==5.0.2
  • twine ==4.0.1
  • wheel ==0.37.1