Skip to main content

Statistical Learning analysis for EEG - Z-scored Inter-Trial Coherence (ZITC) computation

Project description

autocleaneeg-sl

Statistical Learning analysis for EEG data - computes Z-scored Inter-Trial Coherence (ZITC).

ZITC measures neural entrainment to rhythmic stimuli by comparing phase-locking values against a surrogate distribution, providing a statistically meaningful metric that accounts for baseline phase consistency.

Installation

pip install autocleaneeg-sl

Quick Start

Command Line

# Process a single file
autocleaneeg-sl subject01_epochs.set

# Extract specific target frequencies (e.g., word rate and syllable rate)
autocleaneeg-sl subject01_epochs.set --target-freqs 1.111 3.333

# Process multiple files with custom parameters
autocleaneeg-sl *.set --surrogates 200 --freq-min 0.5 --freq-max 5.0 --output-dir ./results/

Python API

from autocleaneeg_sl import compute_zitc

# Basic usage
result = compute_zitc("subject01_epochs.set")

# Get ZITC at specific frequency
word_zitc = result.get_zitc_at_freq(1.111)
print(f"Word rate ZITC: {word_zitc['zitc']:.3f}")

# Export to DataFrame
df = result.to_dataframe()
df.to_csv("subject01_zitc.csv", index=False)

Parameters

result = compute_zitc(
    epochs,                          # Path to .set file or MNE Epochs object
    freq_range=(0.2, 10.0),         # Frequency range in Hz
    n_surrogates=100,                # Number of surrogate iterations
    channels=None,                   # Channel selection (None = all)
    random_seed=42,                  # For reproducibility
    verbose=True,                    # Print progress
)

Method

ZITC is computed as:

ZITC = (True PLV - Surrogate Mean) / Surrogate Std

Where:

  • True PLV: Phase-locking value computed from the actual data
  • Surrogate Mean/Std: Statistics from null distribution generated by circular time-shifting each epoch

This z-scoring normalizes the raw PLV against chance-level phase consistency, allowing comparison across subjects and frequencies.

Output

The ZITCResult object contains:

  • frequencies: Array of frequency bins (Hz)
  • raw_itc: Raw PLV values (n_channels x n_freqs)
  • zitc: Z-scored ITC values (n_channels x n_freqs)
  • surrogate_mean, surrogate_std: Null distribution statistics
  • channel_names: List of channel names
  • sfreq: Sampling frequency
  • n_epochs: Number of epochs
  • n_surrogates: Number of surrogates used

Requirements

  • Python >= 3.9
  • NumPy >= 1.20
  • MNE-Python >= 1.0
  • Pandas >= 1.3

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

autocleaneeg_sl-0.1.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

autocleaneeg_sl-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file autocleaneeg_sl-0.1.0.tar.gz.

File metadata

  • Download URL: autocleaneeg_sl-0.1.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for autocleaneeg_sl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c039564b18918559e9c7587fef9d2a2ea5c118066d583c421cd6eba0bcb5464a
MD5 a85d7f813b05606dfddfe7a78ea6d713
BLAKE2b-256 d3b9da5981d7f364097167cdd52df6a2c284ec4ab094e59a4c606c520f519050

See more details on using hashes here.

File details

Details for the file autocleaneeg_sl-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for autocleaneeg_sl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a9b1ed664c3ec302835a403f0bd67aab4146f06e76ab3f85047274b8bb22bbb
MD5 d4d54bb07430b2562b06955a8fb69a33
BLAKE2b-256 83899e070d6aac9d8daf50392f6194c7c5f52347d075851fc00d9f30851e415f

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