pytep — Python TMS-EEG Processing
SOUND and SSP-SIR algorithms for TMS-EEG artifact cleaning, bridging MNE-Python and MATLAB Engine.
Requirements
- Python ≥ 3.11
- MATLAB (with a valid license)
- MATLAB Engine for Python (
matlabengine) - MNE-Python
Installation
# From the repository root
pip install -e .
# With notebook extras (jupyter, matplotlib, etc.)
pip install -e ".[notebooks]"
Quick Start
SOUND (Mutanen et al., 2018)
import mne
from pytep import apply_sound
# Load your data
raw = mne.io.read_raw_edf("your_data.edf", preload=True)
raw.set_montage("standard_1020")
# Apply SOUND
raw_clean = apply_sound(raw, iter_num=5, lambda_val=0.1)
SSP-SIR (Mutanen et al., 2016)
import mne
from pytep import apply_sspsir
# Load epoched data
epochs = mne.read_epochs("your_epochs-epo.fif", preload=True)
# Apply SSP-SIR
epochs_clean = apply_sspsir(epochs, pc=2, art_scale='automatic')
Sharing a MATLAB Engine session
import matlab.engine
from pytep import apply_sound, apply_sspsir
eng = matlab.engine.start_matlab()
raw_clean = apply_sound(raw, eng=eng)
epochs_clean = apply_sspsir(epochs, eng=eng, pc=2)
eng.quit()
API Reference
apply_sound(inst, eng=None, iter_num=5, lambda_val=0.1)
| Parameter | Type | Description |
|---|---|---|
inst |
Raw/Epochs | MNE object with EEG data (montage required) |
eng |
MatlabEngine | Existing MATLAB session (optional) |
iter_num |
int | Number of SOUND iterations (default: 5) |
lambda_val |
float | Regularization parameter (default: 0.1) |
apply_sspsir(inst, eng=None, art_scale='automatic', time_range=None, pc=1, M=None)
| Parameter | Type | Description |
|---|---|---|
inst |
Epochs | Epoched MNE data (montage required) |
eng |
MatlabEngine | Existing MATLAB session (optional) |
art_scale |
str | 'automatic', 'manual', or 'manualConstant' |
time_range |
list[float] | [start_ms, end_ms] artifact window |
pc |
int | Number of artifact PCs to remove (default: 1) |
M |
int/None | SIR truncation dimension |
References
- SOUND: Mutanen, T. P., et al. (2018). Automatic and robust noise suppression in EEG and MEG: The SOUND algorithm. NeuroImage, 166, 135-151.
- SSP-SIR: Mutanen, T. P., et al. (2016). Recovering TMS-evoked EEG responses masked by muscle artifacts. NeuroImage, 139, 157-166.
License
MIT
Metadata
Release files for pytep-sound-sspsir 0.1.3
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 |
|---|---|---|---|---|
| pytep_sound_sspsir-0.1.3.tar.gz | 213.1 kB | Without provenance | Details for pytep_sound_sspsir-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytep_sound_sspsir-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for pytep_sound_sspsir-0.1.3-py3-none-any.whl |
Total release size: 247.5 kB
Release files / pytep_sound_sspsir-0.1.3.tar.gz
| Download URL | pytep_sound_sspsir-0.1.3.tar.gz |
|---|---|
| Size | 213.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43b70f2edf3714abca82fcbf44af4ba20c48ef8ae413762f8a19cc9b8da23bbc
|
|
BLAKE2b-256 checksum How to use checksums |
ca0fc1c3c26797d6721371835608e1d4cd231f3b2cab3519056dced1598d81bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / pytep_sound_sspsir-0.1.3-py3-none-any.whl
| Download URL | pytep_sound_sspsir-0.1.3-py3-none-any.whl |
|---|---|
| Size | 34.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
397bc194296d466c855ca500edc5ec969603ec80acebcd439b6baa5d7efc9eed
|
|
BLAKE2b-256 checksum How to use checksums |
9e0b9ec63a413c31abe10d8267f986776272f93b802f4490e054b2335d715c93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for pytep-sound-sspsir 0.1.3
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.