Skip to content

Instantly share code, notes, and snippets.

View dengemann's full-sized avatar

Denis A. Engemann dengemann

View GitHub Profile
# Author: Denis A. Engemann <[email protected]>
# License: BSD-3
#!/usr/bin/env bash
subjects=$(ls $SUBJECTS_DIR)
# make sure all is clean
for subject in $subjects; do
error_log=$SUBJECTS_DIR/$subject/scripts/IsRunning.lh+rh;
if [ -e $error_log ]; then
# Authors: Denis A. Engemann <[email protected]>
# Alexandre Gramfort <[email protected]>
#
# License: BSD (3-clause)
import mne
data_path = mne.datasets.somato.data_path()
raw_fname = data_path + '/MEG/somato/sef_raw_sss.fif'
mne_cov_fname = data_path + '/MEG/somato/sef-cov.fif'
event_id, tmin, tmax = 1, -1., 3.
"""
==========================================
From raw data to dSPM on SPM Faces dataset
==========================================
Runs a full pipeline using MNE-Python:
- artifact removal
- averaging Epochs
- forward model computation
- source reconstruction using dSPM on the contrast : "faces - scrambled"
# Authors: Denis A. Engemann <[email protected]>
# Alexandre Gramfort <[email protected]>
#
# License: BSD (3-clause)
import mne
data_path = mne.datasets.somato.data_path()
raw_fname = data_path + '/MEG/somato/sef_raw_sss.fif'
event_id, tmin, tmax = 1, -1., 3.
# Setup for reading the raw data
"""
===================================================
Tutorial on how to detect and visualize bad chanels
===================================================
This script shows how to visualize bad channels
"""
# Authors: Denis A. Engemann <[email protected]>
#
# License: BSD (3-clause)
"""Parse git head for provenance tracking without external libraries
This code shows you how to read git hashes from repositories.
A test ensures that the hashes are hex strings and reflect recent changes.
"""
# Author: Denis A. Engemann <[email protected]>
# License: BSD-3 license
import os
import os.path as op
# Authors: Denis Engemann <[email protected]>
# Lakshmi Krishnan <[email protected]>
# License: BSD (3-clause)
import mne
import numpy as np
from scipy import io
# x,y convention is inverted in Mat file
mat = io.loadmat('electrode_loc/chanlocs.mat',chars_as_strings=1)
"""
==========================================================
Decoding sensor space data with generalization across time
==========================================================
This example runs the analysis computed in:
Jean-Remi King, Alexandre Gramfort, Aaron Schurger, Lionel Naccache
and Stanislas Dehaene, "Two distinct dynamic modes subtend the detection of
unexpected sounds", PLOS ONE, 2013
"""
======================================================================
Repeated measures ANOVA on source data with spatio-temporal clustering
======================================================================
This example illustrates how to make use of the clustering functions
for arbitrary, self-defined contrasts beyond standard t-tests. In this
case we will tests if the differences in evoked responses between
stimulation modality (visual VS auditory) depend on the stimulus
location (left vs right) for a group of subjects (simulated here
# Author: Denis A. Engemann <[email protected]>
# Licesnse: BSD 3-clause
def compute_corr(x, y):
"""Compute pearson correlations between a vector and a matrix
"""
X = np.array(x)
Y = np.array(y)
X -= X.mean(0)
Y -= Y.mean(0)