Skip to main content

Single trial EEG pipeline at the Abdel Rahman Lab for Neurocognitive Psychology, Humboldt-Universität zu Berlin

Project description

hu-neuro-pipeline

PyPI PyPI - Python Version GitHub

Single trial EEG pipeline at the Abdel Rahman Lab for Neurocognitive Psychology, Humboldt-Universität zu Berlin

Based on Frömer, R., Maier, M., & Abdel Rahman, R. (2018). Group-level EEG-processing pipeline for flexible single trial-based analyses including linear mixed models. Frontiers in Neuroscience, 12, 48. https://doi.org/10.3389/fnins.2018.00048

1. Installation

1.1 For Python users

Install the pipeline via pip from the Python Package Index (PyPI):

pip install hu-neuro-pipeline

Alternatively, you can install the latest development version from GitHub:

pip install git+https://github.com/alexenge/hu-neuro-pipeline.git

1.2 For R users

First install and load reticulate (an R package for accessing Python functionality from within R):

install.packages("reticulate")
library("reticulate")

Check if you already have conda (a scientific Python distribution) installed on your system:

conda_exe()

If this shows you the path to a conda executable, you can skip the next step. If instead it shows you an error, you need to install conda:

install_miniconda()

Then install the pipeline from the Python Package Index (PyPI):

py_install("hu-neuro-pipeline", pip = TRUE)

Alternatively, you can install the latest development version from GitHub:

py_install("git+https://github.com/alexenge/hu-neuro-pipeline.git", pip = TRUE)

2. Usage

2.1 For Python users

Here is a fairly minimal example for a (fictional) N400/P600 experiment with two experimental factors: semantics (e.g., related versus unrelated words) and emotional context (e.g., emotionally negative versus neutral).

from pipeline import group_pipeline

trials, evokeds, config = group_pipeline(
    raw_files='Results/EEG/raw',
    log_files='Results/RT',
    output_dir='Results/EEG/export',
    besa_files='Results/EEG/cali',
    triggers=[201, 202, 211, 212],
    skip_log_conditions={'semantics': 'filler'},
    components={'name': ['N400', 'P600'],
                'tmin': [0.3, 0.5],
                'tmax': [0.5, 0.9],
                'roi': [['C1', 'Cz', 'C2', 'CP1', 'CPz', 'CP2'],
                        ['Fz', 'FC1', 'FC2', 'C1', 'Cz', 'C2']]},
    average_by={'related': 'semantics == "related"',
                'unrelated': 'semantics == "unrelated"'})

In this example we have specified:

  • The paths to the raw EEG data, to the behavioral log files, to the desired output directory, and to the BESA files for ocular correction

  • Four different EEG triggers corresponding to each of the four cells in the 2 × 2 design

  • The fact that log files contain additional trials from a semantic 'filler' condition (which we want to skip because they don't have corresponding EEG triggers)

  • The a priori defined time windows and regions of interest for the N400 and P600 components

  • The log file columns (average_by) for which we want to obtain by-participant averaged waveforms (i.e., for all main and interaction effects)

2.2 For R users

Here is the same example as above but for using the pipeline from R:

# Import Python module
pipeline <- reticulate::import("pipeline")

# Run the group level pipeline
res <- pipeline$group_pipeline(
    raw_files = "Results/EEG/raw",
    log_files = "Results/RT",
    output_dir = "Results/EEG/export",
    besa_files = "Results/EEG/cali",
    triggers = c(201, 202, 211, 212),
    skip_log_conditions = list("semantics" = "filler"),
    components = list(
        "name" = list("N400", "P600"),
        "tmin" = list(0.3, 0.5),
        "tmax" = list(0.5, 0.9),
        "roi" = list(
            c("C1", "Cz", "C2", "CP1", "CPz", "CP2"),
            c("Fz", "FC1", "FC2", "C1", "Cz", "C2")
        )
    ),
    average_by = list(
        related = "semantics == 'related'",
        unrelated = "semantics == 'unrelated'"
    )
)

# Extract results
trials <- res[[1]]
evokeds <- res[[2]]
config <- res[[3]]

3. Processing details

See the documentation for more details about how to use the pipeline and how it works under the hood.

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

hu_neuro_pipeline-0.9.0.tar.gz (359.3 kB view details)

Uploaded Source

Built Distribution

hu_neuro_pipeline-0.9.0-py3-none-any.whl (103.3 kB view details)

Uploaded Python 3

File details

Details for the file hu_neuro_pipeline-0.9.0.tar.gz.

File metadata

  • Download URL: hu_neuro_pipeline-0.9.0.tar.gz
  • Upload date:
  • Size: 359.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for hu_neuro_pipeline-0.9.0.tar.gz
Algorithm Hash digest
SHA256 31e72ca3c00ad24e3d54faf4660222dfbe41a6232ae10e22d6225b02b153c3b2
MD5 be9dcb0673018cbdaf7ed02233f67b25
BLAKE2b-256 e5153c5a0f579806ef6a3c8d5fa4823a6ac72422de93b956c9f55560bf9e89fc

See more details on using hashes here.

File details

Details for the file hu_neuro_pipeline-0.9.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hu_neuro_pipeline-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dd7063801879407275fb52ca3f76cccf90c96acb4521a1d83fa3f68de3fba495
MD5 1fe25e798470ad1e4aef4d94d3f522c7
BLAKE2b-256 2a2229310b0c0336a104a4d30717cfea07c2067cc305a150eeeb1024c25882e8

See more details on using hashes here.

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