This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
import time | |
import numpy as np | |
import scipy.sparse as sp | |
from sklearn.utils.testing import assert_array_equal | |
class ContextDecorator(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import wraps | |
import time | |
import numpy as np | |
import scipy.sparse as sp | |
from sklearn.utils.testing import assert_array_equal | |
class ContextDecorator(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib import rcParams | |
from matplotlib.ticker import LinearLocator | |
# use default Latex font for math even with matplotlib 2.0 | |
rcParams['mathtext.fontset'] = 'cm' | |
fig = plt.figure() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cProfile | |
def profile_this(fn): | |
def profiled_fn(*args, **kwargs): | |
filename = fn.__name__ + '.profile' | |
prof = cProfile.Profile() | |
ret = prof.runcall(fn, *args, **kwargs) | |
prof.dump_stats(filename) | |
return ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from mne.preprocessing.peak_finder import peak_finder | |
def test_peak_finder(signal, thresh=None): | |
plt.plot(signal) | |
# find the maxima |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import sys | |
import time | |
# copy from MNE-Python | |
class ProgressBar(): | |
"""Class for generating a command-line progressbar | |
Parameters | |
---------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import os | |
# find existing links | |
matches = [] | |
with open('whats_new.rst', 'r') as f: | |
for line in f.readlines(): | |
m = re.search('`[A-Za-z üéö@.ä-]*`_', line) | |
if m is not None: | |
matches.append(m.group(0)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import print_function | |
import warnings | |
import numpy as np | |
import neo.io | |
from mne.io.array import RawArray | |
from mne import create_info | |
def _smr(filename): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.datasets import fetch_olivetti_faces | |
from sklearn.decomposition.nmf import NMF | |
from sklearn.externals.joblib import Parallel, delayed | |
def fit(X): | |
nmf.fit(X) | |
def nmf_test(n_jobs=-1, backend='multiprocessing'): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import warnings | |
import neo.io | |
def smr2sig(filename, smr_nums=[0]): | |
""" | |
read signal from .smr file (Spike2) | |
parameters | |
---------- | |
filename : name of file |
NewerOlder