Python bindings for DDA (Delay Differential Analysis)
Project description
dda-py
Python bindings for DDA (Delay Differential Analysis).
The DDA binary is required. Please download the most recent version from the file server.
Installation
pip install dda-py
Optional dependencies:
pip install dda-py[mne] # MNE-Python integration
pip install dda-py[pandas] # DataFrame export
pip install dda-py[all] # All optional deps
Quick Start (High-Level API)
import numpy as np
from dda_py import run_st
# Analyze a numpy array (n_channels x n_samples)
data = np.random.randn(3, 10000)
result = run_st(data, sfreq=256.0, delays=(7, 10), wl=200, ws=100)
print(result.coefficients.shape) # (3, n_windows, 3)
print(result.n_channels) # 3
print(result.n_windows) # depends on data length
print(result.to_dataframe().head())
MNE-Python Integration
import mne
from dda_py import run_st
raw = mne.io.read_raw_edf("data.edf", preload=True)
result = run_st(raw, delays=(7, 10), wl=200, ws=100)
# sfreq is extracted automatically from the MNE Raw object
Cross-Timeseries Analysis
from dda_py import run_ct
data = np.random.randn(4, 10000) # 4 channels
result = run_ct(data, sfreq=256.0, delays=(7, 10), wl=200, ws=100)
print(result.n_pairs) # 6 (all unique pairs)
print(result.pair_labels) # ['ch0-ch1', 'ch0-ch2', ...]
Dynamical Ergodicity
from dda_py import run_de
data = np.random.randn(2, 10000)
result = run_de(data, sfreq=256.0, delays=(7, 10), wl=200, ws=100)
print(result.ergodicity.shape) # (n_windows,)
Low-Level API
For full control over the DDA binary:
from dda_py import DDARequest, DDARunner
runner = DDARunner() # auto-discovers binary
request = DDARequest(
file_path="data.edf",
channels=[0, 1, 2],
variants=["ST"],
window_length=200,
window_step=100,
delays=[7, 10],
)
results = runner.run(request)
Model Encoding
Visualize what DDA model indices mean:
from dda_py import visualize_model_space, decode_model_encoding
# Show all monomials for 2 delays, polynomial order 4
print(visualize_model_space(2, 4, highlight_encoding=[1, 2, 10]))
# Decode model [1, 2, 10] to equation
print(decode_model_encoding([1, 2, 10], num_delays=2, polynomial_order=4, format="text"))
# dx/dt = a_1 x_1 + a_2 x_2 + a_3 x_1^4
CLI
dda --file data.edf --channels 0 1 2 --variants ST --wl 200 --ws 100
dda --file data.edf --channels 0 1 2 --variants ST CT --delays 7 10 -o results.json
Variants
- ST - Single Timeseries
- CT - Cross Timeseries
- CD - Cross Dynamical
- DE - Dynamical Ergodicity
- SY - Synchrony
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dda_py-0.4.0.tar.gz
(50.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
dda_py-0.4.0-py3-none-any.whl
(36.1 kB
view details)
File details
Details for the file dda_py-0.4.0.tar.gz.
File metadata
- Download URL: dda_py-0.4.0.tar.gz
- Upload date:
- Size: 50.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
772d937a6b1ae0418eb7fb84063e135e5fb8d29a727bb5b28b496bf8de4faa67
|
|
| MD5 |
8fe347f67447fcad531c5d3db18c8f26
|
|
| BLAKE2b-256 |
a5294310564b7e4dab50cf05a0e6fbb2d4191ccdcbe86a91e328ece9975d21b1
|
File details
Details for the file dda_py-0.4.0-py3-none-any.whl.
File metadata
- Download URL: dda_py-0.4.0-py3-none-any.whl
- Upload date:
- Size: 36.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0eac5f446402fd19386128d9a8da78085030c9dcd25938f9751d64181deb2c1c
|
|
| MD5 |
1dedf86e8cc457d0059ed81b8c4f38fc
|
|
| BLAKE2b-256 |
89f633d4a742b3a54ab66e9b03200eb6d79db0226b5a0c115dc623869fdb6026
|