Skip to content

Instantly share code, notes, and snippets.

View larsoner's full-sized avatar

Eric Larson larsoner

View GitHub Profile
#!/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
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
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']))
# -*- 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,
# -*- 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 -*-
"""
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
# need to be on larsoner:envcorr
import os.path as op
from utils import compute_envelope_correllation
import mne
import numpy as np
"""
data_path = mne.datasets.brainstorm.bst_resting.data_path()
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""libsoundio interface for sound output."""
# Authors: Dan McCloy <[email protected]>
# Eric Larson <[email protected]>
#
# License: BSD (3-clause)
import ctypes
import numpy as np