Skip to main content

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

Usage

Basic Example

from dda_py import DDARequest, DDARunner

# Initialize the runner with path to DDA binary
runner = DDARunner(binary_path="run_DDA_AsciiEdf")

# Create an analysis request
request = DDARequest(
    file_path="patient1_S05__01_03.edf",
    channels=[1, 2, 3],  # 0-based channel indices
    variants=["ST", "SY"],  # Which DDA variants to run
    window_length=2048,
    window_step=1024,
    delays=[7, 10],  # Delay values for -TAU flag
)

# Execute DDA analysis
results = runner.run(request)

# Access results for each variant
for variant_name, variant_results in results.items():
    print(f"\n{variant_name} Results:")
    print(f"  Matrix shape: {variant_results['num_channels']} × {variant_results['num_timepoints']}")
    print(f"  Stride: {variant_results['stride']}")

    # Access the actual data
    channels = variant_results["channels"]
    print(f"  Data: {len(channels)} channels with {len(channels[0]['timepoints'])} timepoints each")

Advanced Options

# Full configuration example with all optional parameters
request = DDARequest(
    file_path="patient1_S05__01_03.edf",
    channels=[1, 2, 3],
    variants=["ST", "CT", "SY"],
    window_length=2048,
    window_step=1024,
    delays=[7, 10],
    model_params=[1, 2, 10],  # DDA model encoding for -MODEL flag
    # Optional parameters:
    ct_window_length=2,  # Required for CT/CD/DE variants
    ct_window_step=2,
    polynomial_order=4,
    num_tau=2,
)

Working with Variant Metadata

from dda_py import get_variant_by_abbrev, generate_select_mask, parse_select_mask

# Get information about a variant
st_variant = get_variant_by_abbrev("ST")
print(f"Name: {st_variant.name}")
print(f"Documentation: {st_variant.documentation}")
print(f"Stride: {st_variant.stride}")

# Generate SELECT masks for multiple variants
mask = generate_select_mask(["ST", "CT", "SY"])
print(f"SELECT mask: {mask}")

# Parse a mask to see which variants are enabled
enabled = parse_select_mask(mask)
print(f"Enabled variants: {enabled}")

Variants

The package provides access to all DDA variants:

  • ST - Single Timeseries
  • CT - Cross Timeseries
  • CD - Cross Dynamical
  • DE - Dynamical Ergodicity
  • SY - Synchrony

License

MIT

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

dda_py-0.2.7.tar.gz (31.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dda_py-0.2.7-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file dda_py-0.2.7.tar.gz.

File metadata

  • Download URL: dda_py-0.2.7.tar.gz
  • Upload date:
  • Size: 31.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for dda_py-0.2.7.tar.gz
Algorithm Hash digest
SHA256 b543b508ee9478ccef63c99efcb5c10e5e50ec1b54dcb28f0aff25e8c1921343
MD5 aeaee2d0461ae6e25fa98822d638c835
BLAKE2b-256 ae97126446e834f7790313ac4baf8e40b2af6a42d54b8c5fbd753ccb62a96976

See more details on using hashes here.

File details

Details for the file dda_py-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: dda_py-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 21.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for dda_py-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 1d7bcbd17c067c667c5b3e499e0df183de376d794a633039efcb53d94bcaae2a
MD5 a646aa7153368af623c4cdee862684a6
BLAKE2b-256 0b068c7b3856674370f43c86f12204546585becd12451ef87ef5166b50eb4b27

See more details on using hashes here.

Supported by

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