Skip to main content

PLSC for MNE

Project description

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.

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

mne_plsc-0.0.29.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mne_plsc-0.0.29-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file mne_plsc-0.0.29.tar.gz.

File metadata

  • Download URL: mne_plsc-0.0.29.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mne_plsc-0.0.29.tar.gz
Algorithm Hash digest
SHA256 178b09878c0a93452f39461794c9f09129bab01186448fc63ff90fe14751b701
MD5 440854c2bdd3d5df7b550ab04d7f138f
BLAKE2b-256 2958933d21b6338c8a8d6b3dec6da9da4fd515fcdfbb2cd57c60c6e9ae00a8d1

See more details on using hashes here.

File details

Details for the file mne_plsc-0.0.29-py3-none-any.whl.

File metadata

  • Download URL: mne_plsc-0.0.29-py3-none-any.whl
  • Upload date:
  • Size: 28.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mne_plsc-0.0.29-py3-none-any.whl
Algorithm Hash digest
SHA256 844c3b5d67a3070a20a4eb3336502a2a500b702d4747e91d722814a50d25e30b
MD5 92da8cf409e3e4f9ae654fb078d1b2b5
BLAKE2b-256 31cbf2c3e8efd071fa98a06bd760988a818273366fa39341d54d7f82c31c4845

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