Skip to content

Instantly share code, notes, and snippets.

@larsoner
Last active September 26, 2018 20:36
Show Gist options
  • Select an option

  • Save larsoner/c58127bc466e8e8b7ce38af9f6ab825f to your computer and use it in GitHub Desktop.

Select an option

Save larsoner/c58127bc466e8e8b7ce38af9f6ab825f to your computer and use it in GitHub Desktop.
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
n_in = 2
n_samp = int(round(60 * sfreq))
n_epochs = 60
def run():
print('Running %2s in, %d - %d ms; %0.1f min epochs; %6.1f Hz; %2d epochs'
% (n_in, tmin * 1000, tmax * 1000, n_samp / (60 * sfreq),
sfreq, n_epochs))
X = rng.randn(n_samp, n_epochs, n_in)
for n_out in (2, 60):
y = rng.randn(n_samp, n_epochs, n_out)
for n_jobs in (1, 'cuda'):
print(' n_out=%2d n_jobs=%4s: ' % (n_out, n_jobs), end='')
rf = mne.decoding.ReceptiveField(tmin, tmax, sfreq, n_jobs=n_jobs,
edge_correction=False,
verbose=True)
t0 = time()
rf.fit(X, y)
print('%0.2f min' % ((time() - t0) / 60.,))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment