Skip to main content

TEPFeatures 🧠⚡

Python Version MNE-Python Pandas License

A modern, fast, and structured Python library for extracting advanced features from TMS-Evoked Potentials (TEPs) using EEG data. Built on top of mne-python and pandas, tepfeatures acts as a powerful facade to automate the extraction of temporal, spatial, dynamic (microstates), and spectral features from TEPs.


🎯 Features

  • Temporal Features: Intelligent peak extraction based on polarity, morphology descriptors (peak-to-peak amplitude, inter-peak interval, slope), and Area Under the Curve (AUC) calculated via trapezoidal integration.
  • Spatial Features: Global Field Power (GFP), Local Mean Field Power (LMFP), automated extraction of GFP peaks within dynamic time windows, and Topographical Cosine Similarity.
  • Dynamic Features (Microstates): Built-in modified K-Means clustering algorithm to identify periods of stable topography, extracting onset time, duration, and associated mean GFP.
  • Spectral Features: Frequency-domain analysis utilizing Welch's method for calculating power within specific frequency bands (e.g., Alpha, Beta) and identifying the natural/dominant peak frequency.
  • Dynamic Windows: Easily access and modify clinical standard TEP windows (e.g., N15, P30, N45, P60, N100, P200) using dict-like syntax.

📦 Installation

This project is built and managed with uv. To install it from source:

git clone https://github.com/your-username/tepfeatures.git
cd tepfeatures
uv sync

Or via PyPI (coming soon!):

pip install tepfeatures

🚀 Quickstart

import mne
from tepfeatures.core import TEPExtractor

# 1. Load your TEP data (must be an mne.Evoked object)
evoked = mne.read_evokeds('your_tep_data-ave.fif')[0]

# 2. Initialize the extractor
extractor = TEPExtractor(evoked)

# You can dynamically modify standard windows if needed:
extractor['N15'] = [0.012, 0.018]

# 3. Extract Temporal Features
df_peak = extractor.temporal.get_peak('N100', channels=['Cz', 'Fz'])
df_auc = extractor.temporal.get_area('P30', channels='Cz')

# 4. Extract Spatial Features
times, gfp = extractor.spatial.get_gfp()
df_topo_sim = extractor.spatial.topographical_similarity('N15', 'P30')

# 5. Extract Spectral Features
df_bands = extractor.spectral.get_band_power() # Alpha and Beta by default
df_natural_freq = extractor.spectral.get_peak_frequency(channels='Cz')

# 6. Extract Microstates
extractor.microstates.fit(n_states=4)
df_microstates = extractor.microstates.get_features()

print(df_microstates)

📖 Documentation

The full documentation is built with MkDocs. To view it locally:

uv run mkdocs serve

Then open http://127.0.0.1:8000/ in your browser.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for tepfeatures 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tepfeatures 0.1.0
File Size Uploaded Provenance Actions
tepfeatures-0.1.0.tar.gz 10.7 kB Without provenance Details for tepfeatures-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tepfeatures 0.1.0
File Interpreter ABI Platform Actions
tepfeatures-0.1.0-py3-none-any.whl Python 3 none any Details for tepfeatures-0.1.0-py3-none-any.whl

Total release size: 22.6 kB

Release files / tepfeatures-0.1.0.tar.gz

Download URL tepfeatures-0.1.0.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a2639df132ba64c36aed121a8810e30c08198e0c2d275fee20daa6d986840562
BLAKE2b-256 checksum
How to use checksums
54d1bbac9310e4b163f29ba61b47d5c24d55e9e001994c562135f772b5c8ad3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / tepfeatures-0.1.0-py3-none-any.whl

Download URL tepfeatures-0.1.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52cca4129e16a049b619e6fe54f3d30f94508984e6cd2937b1ca07f8e2fec697
BLAKE2b-256 checksum
How to use checksums
454f9585a504c00c619daad1506eb822efa71d6db7ea61ad60d20117ee0ca978
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for tepfeatures 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page