pyenfra
Python Package for Environmental Fractal Analysis and Chaos Estimation
Official repository: github: pyenfra
Description
pyenfra is a Python library for fractal analysis, modeling and chaos estimation in time-series with the emphasis on environmental datasets. Package contains a suite of fractal and chaos metrics:
- Hurst exponent for rescaled range,
- Detrended Fluctuation Analysis (DFA),
- Multifractality by Generalized Hurst Slope,
- Wavelet Transform Modulus Maxima (with varying bands and modulus methods),
- Sample Entropy,
- Recurrence Quantification Analysis (RQA),
- Lyapunov exponents.
Installation
pyenfra can be installed using pip or locally by downloading package copy.
pip install:
pip install pyenfra
local:
use repositiory to obtain package copy.
Usage
Below are a couple examples of package usage.
Please refer to examples.py for extended, detailed examples and computation workflows.
import numpy as np
import matplotlib.pyplot as plt
import pyenfra
# Generate White noise sample data
ts_white = np.random.RandomState(0).randn(2000)
# Example: Compute Hurst exponent
h_value = pyenfra.functions.hurst(ts_white, num=30, min_n=10, min_segments=10)
# Example: Interpret Hurst
print(pyenfra.interpreters.interpret_hurst(ts_white, use_confidence_interval=False))
# Example: Plot Hurst climacogram for AR(1)
ax_hurst = pyenfra.plotting.plot_hurst(ts_white, num=30, min_n=10, min_segments=10,
figsize=(5,4), scatter_kwargs={'color':'C0'}, line_kwargs={'color':'C1'})
ax_hurst.figure.suptitle("Climacogram: AR(1) Persistent Process")
plt.show()
# Example: Compute Lyapunov Exponent
lyap_val, divergence, times = pyenfra.functions.lyapunov(ts_white, dim=3, tau=1, fs=1.0, max_iter=200, theiler=1)
print(f"Estimated Lyapunov exponent (logistic r=3.99): {lyap_val:.4f}")
print("Interpretation:", pyenfra.interpreters.interpret_lyapunov(lyap_val))
Roadmap
Future works on the package include:
- HOST model integration.
- On demand functions.
Contributing
Pull requests are welcome.
For major changes, please open an issue first to discuss implementation or changes.
Acknowledgment
This work was supported by NOAA grant NA19NOS4730207. Funding agency had no impact on work structure or findings.
License
This package is available under MIT license.
Release files for pyenfra 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyenfra-0.4.0.tar.gz | 37.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyenfra-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.8 kB
Release files / pyenfra-0.4.0.tar.gz
| Download URL | pyenfra-0.4.0.tar.gz |
|---|---|
| Size | 37.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a6e67128a6d8a295b37dbeb3d45524c44acb4cbf3634b66c4736b0f03de16d37
|
|
BLAKE2b-256 checksum How to use checksums |
c6e3d678ce8041b7f0ab5d6199d93c531592da04de9d88d86e57957b9da308da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|
Release files / pyenfra-0.4.0-py3-none-any.whl
| Download URL | pyenfra-0.4.0-py3-none-any.whl |
|---|---|
| Size | 35.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fef0ba65e5a46d4216bfc4c9a2fc79247ad1718cd44da9c1998e57b1a381c4ff
|
|
BLAKE2b-256 checksum How to use checksums |
a211842cdf05304fcf2b898195e158d3fa9aab644c5d3cd8c7e37a8bd56a6119
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|