Skip to content

Instantly share code, notes, and snippets.

View larsoner's full-sized avatar

Eric Larson larsoner

View GitHub Profile
"""
Create ARTEMIS123 helmet from sensor locations.
"""
import os.path as op
import numpy as np
from scipy.spatial import ConvexHull, Delaunay
import matplotlib.pyplot as plt
import mne
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CSD computation linearity test (which fails).
"""
from copy import deepcopy
from numpy.testing import assert_allclose
import numpy as np
import mne
import os.path as op
import numpy as np
from scipy import linalg
from numpy.testing import assert_array_equal, assert_allclose
from mayavi import mlab
import mne
from mne.beamformer import make_lcmv, apply_lcmv
from mne.simulation import simulate_evoked
# A Cython implementation of the "eight-points signed sequential Euclidean
# distance transform algorithm" (8SSEDT)
import numpy as np
cimport numpy as np
from libc.math cimport sqrt
cimport cython
@larsoner
larsoner / plot_source_helmet.py
Last active November 16, 2017 15:38 — forked from kingjr/plot_source_helmet.py
failed attempt: fields removes sources
from mayavi import mlab
import numpy as np
import mne
from mne.datasets import sample
from mne.minimum_norm import make_inverse_operator, apply_inverse
mne.set_log_level(False)
data_path = sample.data_path()
subjects_dir = data_path + '/subjects'
raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'
raw = mne.io.read_raw_fif(raw_fname) # already has an average reference
import mne
import numpy as np
from scipy.signal import freqz
import matplotlib.pyplot as plt
freqs = np.arange(2, 81)
n_cycles = freqs / 2.
sfreq = 1000.
fig, ax = plt.subplots(1)
lengths = list()
for wavelet in mne.time_frequency.morlet(sfreq, freqs, n_cycles,
name: py27old
channels:
- defaults
dependencies:
- alabaster=0.7.10=py27he5a193a_0
- babel=2.5.0=py27h20693cd_0
- backports=1.0=py27h63c9359_1
- backports.functools_lru_cache=1.4=py27he8db605_1
- backports_abc=0.5=py27h7b3c97b_0
- ca-certificates=2017.08.26=h1d4fec5_0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 19 16:54:05 2017
@author: larsoner
"""
from scipy.signal.windows import dpss
from scipy import fftpack
import numpy as np
from scipy.signal.windows import dpss
import numpy as np
import matplotlib.pyplot as plt
Ms = np.arange(1, 41)
factors = (50, 20, 10, 5, 2.0001)
energy = np.empty((3, len(Ms), len(factors)))
for mi, M in enumerate(Ms):
for fi, factor in enumerate(factors):
NW = M / float(factor)
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Use glass brain plotting for surface STCs.
"""
import os.path as op
import numpy as np
from scipy import sparse
import mne