Quickstart¶
Install with Python 3.10 or newer:
pip install tipbox
Simulate¶
from tipbox.models import MayHarvesting
model = MayHarvesting()
# num_samples: sampled observations; noise: process-noise strength; seed: random seed.
result = model.make_trajectory(num_samples=1200, noise=1.0, seed=43)
Choose other models from the catalog.
Compute an indicator¶
Use the observations before the fold:
import matplotlib.pyplot as plt
from tipbox.indicators import rolling_ar1
before_fold = result.param_values < model.critical_parameter
signal = result.trajectory[before_fold, 0]
ar1 = rolling_ar1(signal, window=200, detrend="linear")
plt.plot(result.time[before_fold], ar1)
plt.show()
The window contains 200 observations. The first 199 results are NaN.
See Early-warning indicators for the other statistics and Benchmarking for AUROC.
Load observations¶
from tipbox.datasets import Microcosm
record = Microcosm().load()
print(record.time.shape) # (7914,)
print(record.observations.shape) # (7914, 2): M1, M2
Downloads are cached. The Empirical catalog lists the available records and their sources.