Skip to main content

Python package to compute early warning signals (EWS)

Project description

PyPI version Downloads Build Status Documentation Status Coverage Status DOI

ewstools

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

Contents

Overview

Many systems across nature and society have the capacity to undergo an abrupt and profound change in their dynamics. From a dynamical systemes perspective, these changes corresopond to bifurcations, which carry some generic features that can be picked up on in time series data (Scheffer et al. 2009). Two commonly used metrics include variance and lag-1 autocorrelation, though there exist many others (see e.g. Clements & Ozgul 2018). More recently, deep learning methods have been developed to provide early warning signals, whilst also signalling the type of bifurcation approaching (Bury et al. 2021).

The goal of this Python package is to provide a user-friendly toolbox for computing early warning signals in time series data. It complements an existing early warning signals package in R (Dakos et al. 2012). We hope that having an early warning signal toolbox in Python will allow for additional testing, and appeal to those who primarily work in Python. I will try to keep it updated with the latest methods.

Current functionality of ewstools includes

  • Detrending of time series using

    • A Gaussian kernel
    • LOWESS (Locally Weighted Scatterplot Smoothing)
  • Computation of CSD-based early warning signals including:

    • Variance and associated metrics (standard deviation, coefficient of variation)
    • Autocorrelation (at specified lag times)
    • Higher-order statistical moments (skewness, kurtosis)
    • Power spectrum and associated metrics (maximum frequency, coherence factor, AIC weights csp. to canonical power spectrum forms)
  • Application of deep learning classifiers for bifurcation prediction as in the study by Bury et al..

  • Block-bootstrapping of time-series to obtain confidence bounds on EWS estimates

  • Visualisation tools to display EWS.

Repo Contents

  • tutorials: Jupyter notebooks to demonstrate methods - a good place to start
  • docs: documentation source code running with ReadTheDocs
  • ewstools: source code
  • tests: unit tests
  • saved_classifiers: pre-trained Tensorflow bifurcation classifiers

System Requirements

Hardware Requirements

ewstools can run on a standard computer with enough RAM to support the operations defined by a user. The software has been tested on a computer with the following specs

RAM: 8G, CPU: 2.7 GHz

though the software should run as expected on computers with lower RAM. The runtimes outlined below were generated on the computer with these specs.

Software Requirements

Requires Python 3.7 or higher and has package dependencies listed in requiements_dev.txt. The Python package should be compatible with Windows, Mac, and Linux operating systems. The demos require Jupyter notebook.

Installation Guide

Instructions for downloading Python 3 on Linux, Mac OS and Windows are available here.

ewstools may then be installed using pip with the following command:

pip install ewstools

which should install all package dependencies. To run and interact with the tutorials, Jupyter notebook is required, which can be installed using

pip install jupyter notebook

To install the latest development version of ewstools, use the command

pip install git+https://github.com/thomasmbury/ewstools.git#egg=ewstools

Note, the development version comes with the risk of undergoing continual changes, and has not undergone the level of scrutiny of official releases.

Tutorials

For tutorials/demonstrations on using ewstools, please refer to these iPython notebooks.

Documentation

Documentation available on ReadTheDocs.

Issues

If you run have any suggestions or spot any bugs with the package, please post on the issue tracker! I also welcome any contributions - please get in touch if you are interested, or submit a pull request if you are familiar with that process.

Acknowledgements

This work is supported by an FRQNT (Fonds de recherche du Québec - Nature et Technologies) postdoctoral research scholarship awarded to Thomas Bury.

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

ewstools-2.0.0.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

ewstools-2.0.0-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file ewstools-2.0.0.tar.gz.

File metadata

  • Download URL: ewstools-2.0.0.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for ewstools-2.0.0.tar.gz
Algorithm Hash digest
SHA256 10a6548d1374582baa46157a05d267c7a99868a24ed099299217b013c1d0de84
MD5 8c37cb05e820e1e7656b9e587408b76f
BLAKE2b-256 369dca8b4ba8fa2eed5b29b624be6465e95d93dfed09ea53513a2bfa8e0e2d84

See more details on using hashes here.

File details

Details for the file ewstools-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: ewstools-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 27.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for ewstools-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 42ad6c824b7012bc61c4a2d3559f5c6a28483743b17eb54de722c81aed61776a
MD5 ecc4fb99f8b96fc61bad41beb89afec2
BLAKE2b-256 15d5286e8900e8626a208ce864c5fb92c6df5400f038f51197d504770e00b3a5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page