Skip to main content

Partial least squares correlation (PLSC) for M/EEG

tests codecov

mne-plsc is a library for partial least squares correlation (PLSC) analysis of M/EEG data in Python, integrated with the MNE-Python library. The basic computations are performed by the pyplsc library, and the documentation of that library contains some background on the PLSC technique.

Installation

mne-plsc can be installed from the Python Package Index with

pip install mne-plsc

Quickstart

The main functions for model fitting are fit_mc, fit_beh, and fit_within_beh. These return objects whose methods can be used for permutation testing, cluster analysis, and visualization. The typical workflow would be:

1. Fit and visualize model

Perform the initial decomposition and check the patterns of saliences.

from mne_plsc import fit_mc
mod = fit_mc(epochs, condition)
mod.plot_lv(0)

2. Permutation testing

Evaluate which latent variables are significant.

mod.permute(1000)
print(model.summary())

3. Cluster analysis

Perform bootstrap resampling to estimate brain salience z-scores, then cluster strong saliences (e.g., $|z| > 2$).

mod.bootstrap(1000)
mod.cluster(threshold=2)

4. Visualize cluster(s)

Examine the temporal/spectral/spatial distribution of the major clusters for a given set of brain saliences.

mod.plot_cluster_sizes(lv_idx=0)
mod.plot_cluster(lv_idx=0, cluster_idx=0)

5. Extract and export data in cluster(s)

For further analysis, we can extract data at cluster peaks (or averages within clusters) and export to a spreadsheet.

df = mod.get_cluster_data(lv_idx=[0, 1, 2], cluster_idx=[0, 1])
df.to_csv('cluster-data.csv')

See the examples in the documentation for more details.

Metadata

Release files for mne-plsc 0.0.34

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

Source distribution (sdist)

Source distribution for mne-plsc 0.0.34
File Size Uploaded
mne_plsc-0.0.34.tar.gz 29.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mne-plsc 0.0.34
File Interpreter ABI Platform
mne_plsc-0.0.34-py3-none-any.whl Python 3 none any Details

Total release size: 58.1 kB

Release files / mne_plsc-0.0.34.tar.gz

Download URL mne_plsc-0.0.34.tar.gz
Size 29.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bb5d08c7e535bbfca70f3a75dcf7ca26a7a4bebec3d0f87a7e47cc1d4883ff29
BLAKE2b-256 checksum
How to use checksums
f215c1798690c3b09323a86dc8a63554403460ad48cf96c92bafd379fc4b67f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / mne_plsc-0.0.34-py3-none-any.whl

Download URL mne_plsc-0.0.34-py3-none-any.whl
Size 28.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b929cf6a50a060160ac74e5cab3d51725e59aca1f4f2ce84b9ba5657fa8d167
BLAKE2b-256 checksum
How to use checksums
75a2ba4bf68617e34dcb702ba2b4f673e18fc2dac7af9c3bdf801783abd7a6cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14
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