Skip to main content

A package with tools to compute early warning signals (EWS) from time-series data

Project description

ewstools

A module to compute early warning signals (EWS) from time-series data. Dependencies include:

  • standard python libraries: numpy, pandas, scipy, matplotlib
  • LMFIT: download here

ews_compute.py

File for function ews_compute.
ews_compute takes in Series data and outputs user-specified EWS in a DataFrame.

Input (default value)

  • raw_series : pandas Series indexed by time
  • roll_window (0.25) : size of the rolling window (as a proportion of the length of the data)
  • smooth (True) : if True, series data is detrended with a Gaussian kernel
  • band_width (0.2) : bandwidth of Gaussian kernel
  • ews ( ['var', 'ac', 'smax'] ) : list of strings corresponding to the desired EWS. Options include
    • 'var' : Variance
    • 'ac' : Autocorrelation
    • 'sd' : Standard deviation
    • 'cv' : Coefficient of variation
    • 'skew' : Skewness
    • 'kurt' : Kurtosis
    • 'smax' : Peak in the power spectrum
    • 'cf' : Coherence factor
    • 'aic' : AIC weights
  • lag_times ( [1] ) : list of integers corresponding to the desired lag times for AC
  • ham_length (40) : length of the Hamming window (used to compute power spectrum)
  • ham_offset (0.5) : offset of Hamming windows as a proportion of ham_length
  • w_cutoff (1) : cutoff frequency (as a proportion of maximum frequency attainable from data)

Output

  • DataFrame indexed by time with columns corresponding to each EWS

ews_compute_run.py

An example script that runs ews_compute on times-series data of a stochastic simulation of May's harvesting model. It also shows how to compute kendall tau values and plot results. This can be used as a template for EWS of times-series data.

ews_compute_runMulti.py

An example script that runs ews_compute on multiple time-series data and outputs EWS as a distribution over realisations.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ewstools, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size ewstools-0.0.2-py3-none-any.whl (18.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size ewstools-0.0.2.tar.gz (14.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page