Skip to content

Instantly share code, notes, and snippets.

View larsoner's full-sized avatar

Eric Larson larsoner

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import mne
import os.path as op
import numpy as np
from mne.connectivity import envelope_correlation
from mne.preprocessing import compute_proj_ecg, compute_proj_eog
# Adapted from:
# https://github.com/SherazKhan/mne-camcan/blob/master/examples/run_envcorr.py
# -*- coding: utf-8 -*-
"""
Do regularization in lower-dimensional subspace.
"""
import numpy as np
from scipy import linalg
from sklearn.covariance import OAS, EmpiricalCovariance, LedoitWolf
rng = np.random.RandomState(0)
n_ch = 60
# -*- coding: utf-8 -*-
"""
Test boostrapping when boosting SNR.
"""
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
rng = np.random.RandomState(0)
# -*- coding: utf-8 -*-
"""
Try realtime movecomp.
"""
import time
import numpy as np
from scipy.spatial.distance import cdist
import mne
from mne.chpi import (_get_hpi_initial_fit, _setup_hpi_struct,
def compute_whitener(noise_cov, info, rank=None):
"""Compute whitening matrix."""
from mne.cov import _get_whitener
from mne.defaults import _handle_default
from mne.io.pick import pick_channels_cov, _pick_data_channels
picks = _pick_data_channels(info, with_ref_meg=False, exclude='bads')
ch_names = [info['ch_names'][k] for k in picks]
noise_cov = pick_channels_cov(noise_cov, include=ch_names, exclude=[])
if len(noise_cov['data']) != len(ch_names):
missing = list(set(ch_names) - set(noise_cov['names']))
from time import time
import numpy as np
import mne
mne.cuda.init_cuda(ignore_config=True, verbose=True)
rng = np.random.RandomState(0)
# Stimulus -> Neural model
sfreq = 10e3
tmin, tmax = -150e-3, 250e-3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
import numpy as np
from scipy.misc import ascent
from expyfun import ExperimentController
from expyfun.visual import RawImage
# -*- coding: utf-8 -*-
import numpy as np
import pyglet
from pyglet.gl import (glBindTexture, glTexImage2D, GL_TEXTURE_2D,
GL_RGB, GL_UNSIGNED_BYTE)
import time
window = pyglet.window.Window()