TEPFeatures 🧠⚡
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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tepfeatures-0.1.1.tar.gz | 10.7 kB | Without provenance | Details for tepfeatures-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tepfeatures-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for tepfeatures-0.1.1-py3-none-any.whl |
Total release size: 22.6 kB
Release files / tepfeatures-0.1.1.tar.gz
| Download URL | tepfeatures-0.1.1.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49b04cae9ccd77d6c50693b846f5951aa8aca8cfb4041f3054201214a1ada444
|
|
BLAKE2b-256 checksum How to use checksums |
39430749089af7ed1013a2f9824792b05cf218bde4c3905cd10e16edc9c04c52
|
| 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.1-py3-none-any.whl
| Download URL | tepfeatures-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c5ca281571496e446fb1e42b460c3a1caa83afb219c5ce70a3f9817621cd361a
|
|
BLAKE2b-256 checksum How to use checksums |
2e735c6711cfa9b2115bcb0d0157189225013b1058a078d7db220eb2bcf24f4b
|
| 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.1
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.