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.2.0.tar.gz (23.4 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.2.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for autocleaneeg_sl-0.2.0.tar.gz
Algorithm Hash digest
SHA256 30ebe9b8d7742b06662e22b69836bbf6e3a02e9954cb243ca881e01ca5850a27
MD5 5fe3b7afccba90ddfbb016c2bfc4d4e2
BLAKE2b-256 3a20328a98e3dcebef872c1b76a6c13aa47df808c896f538a1d61d661437feb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for autocleaneeg_sl-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7a65e175afb276aae8499417e906e4684893ffaa9b95ece5a211a6c7d7a2615e
MD5 e9bfb7f46dde2791211a5cdcaa66177f
BLAKE2b-256 5528da3edb1b1166ff69f7295e24fab473b30754f95f97734ec218816cdaa4a5

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