Skip to main content

Lossless EEG Processing Pipeline Built on MNE and Dash

Project description

codecov

Documentation Status

logo

Introduction to the Lossless Pipeline

This EEG processing pipeline is especially useful for the following scenarios:

  • You want to keep your EEG data in a continuous state, allowing you the flexibility to epoch your data at a later stage.
  • You are part of a research team or community that shares a common dataset, and you want to process the data once in a way that can be used for multiple analyses (i.e., one analysis can segment the cleaned data into 10-second epochs and filter the data betweeen 1-30Hz, while another analysis can use 1-second epochs with no filter, etc.)
  • You want to be able to do a hands on review of the pre-processing results for each file.

📘 Installation and usage instructions

The development version can be installed from GitHub with

$ git clone git@github.com:lina-usc/pylossless.git
$ pip install --editable ./pylossless

for an editable installation, or simply with

$ pip install git+https://github.com/lina-usc/pylossless.git

for a static version.

Please find the full documentation at pylossless.readthedocs.io.

▶️ Running the pyLossless Pipeline

Below is a minimal example that runs the pipeline one of MNE's sample files.

import pylossless as ll 
import mne
fname = mne.datasets.sample.data_path() / 'MEG' / 'sample' /  'sample_audvis_raw.fif'
raw = mne.io.read_raw_fif(fname, preload=True)

config = ll.config.Config()
config.load_default()
config.save("my_project_ll_config.yaml")

pipeline = ll.LosslessPipeline('my_project_ll_config.yaml')
pipeline.run_with_raw(raw)

Once it is completed, You can see what channels and times were flagged:

print(pipeline.flagged_chs)
print(pipeline.flagged_epochs)

Once you are ready, you can save your file:

pipeline.save(pipeline.get_derivative_path(bids_path), overwrite=True)

👩‍💻 Dashboard Review

Open in Colab

QCR Dashboard

After running the Lossless pipeline, you can launch the Quality Control Review (QC) dashboard to review the pipeline's decisions on each file! You can flag additional channels, times and components, and edit flags made by the pipeline.

First install the dashboard requirements

$ cd ./path/to/pylossless/on/your/computer
$ pip install --editable .[dash]
$ pylossless_qc

▶️ Example HPC Environment Setup

If you are a Canadian researcher working on an HPC system such as Narval:

module load python/3.10

# Build the virtualenv in your homedir
virtualenv --no-download eeg-env
source eeg-env/bin/activate

pip install --no-index mne
pip install --no-index pandas
pip install --no-index xarray
pip install --no-index pyyaml
pip install --no-index sklearn
pip install mne_bids

# Clone down mne-iclabel and switch to the right version and install it locally
git clone https://github.com/mne-tools/mne-icalabel.git
cd mne-icalabel
git checkout maint/0.4
pip install .

# Clone down pipeline and install without reading dependencies
git clone git@github.com:lina-usc/pylossless.git
cd pylossless
pip install --no-deps .

# Verify that the package has installed correct with an import
python -c 'import pylossless'

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

pylossless-0.2.0.tar.gz (49.9 MB view details)

Uploaded Source

Built Distribution

pylossless-0.2.0-py3-none-any.whl (49.7 MB view details)

Uploaded Python 3

File details

Details for the file pylossless-0.2.0.tar.gz.

File metadata

  • Download URL: pylossless-0.2.0.tar.gz
  • Upload date:
  • Size: 49.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pylossless-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1ecb46aeddc825969fe0450f6c80d5462b2a9e63020219daab7bf27da7f267e3
MD5 9fcd460235b69c8ff90a8b38cc86dae5
BLAKE2b-256 e0d44152d207b3776dbce582445deef6b0cb257a7ac6d705eee72c066d4bb5f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylossless-0.2.0.tar.gz:

Publisher: pypi.yml on lina-usc/pylossless

Attestations:

File details

Details for the file pylossless-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pylossless-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 49.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pylossless-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2452630d114d0f3ecd4b8a3c7b7ed7180fee93f6712e3fcb6b34ae14a5b3d8ac
MD5 5fec6dfbe5ec91186a19f8b57fbe37ce
BLAKE2b-256 264dd4bbc151396c4aed7527e949cdf54aca62d0994ad9947c679543bb832ea0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylossless-0.2.0-py3-none-any.whl:

Publisher: pypi.yml on lina-usc/pylossless

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page