Compare commits
10 Commits
master
...
maint/0.13
| Author | SHA1 | Date | |
|---|---|---|---|
| b61b87d017 | |||
| 8f87050533 | |||
| cb8707f43e | |||
| bdbbb84a46 | |||
| 0d42601eb8 | |||
| 028f2eec28 | |||
| b4525bb67d | |||
| bdecd41932 | |||
| 8cd0835b62 | |||
| 2322a2bff5 |
+5
-1
@@ -80,6 +80,10 @@ dependencies:
|
||||
if [[ $(cat $FNAME | grep -x ".*brainstorm.*bst_phantom_elekta.*" | wc -l) -gt 0 ]]; then
|
||||
python -c "import mne; print(mne.datasets.brainstorm.bst_phantom_elekta.data_path())" --accept-brainstorm-license;
|
||||
fi;
|
||||
if [[ $(cat $FNAME | grep -x ".*datasets.*megsim.*" | wc -l) -gt 0 ]]; then
|
||||
python -c "import mne; print(mne.datasets.megsim.load_data(condition='visual', data_format='single-trial', data_type='simulation', update_path=True))";
|
||||
python -c "import mne; print(mne.datasets.megsim.load_data(condition='visual', data_format='raw', data_type='experimental', update_path=True))";
|
||||
fi;
|
||||
fi;
|
||||
done;
|
||||
echo PATTERN="$PATTERN";
|
||||
@@ -128,7 +132,7 @@ deployment:
|
||||
- cd doc/_build/html && cp -rf * ~/mne-tools.github.io/dev
|
||||
- cd ../mne-tools.github.io && git add -A && git commit -m 'Automated update of dev docs.' && git push origin master
|
||||
stable:
|
||||
branch: maint/0.12
|
||||
branch: maint/0.13
|
||||
commands:
|
||||
- git config --global user.email "circle@mne.com"
|
||||
- git config --global user.name "Circle Ci"
|
||||
|
||||
@@ -15,7 +15,7 @@ Gilliam K, Donahue CH, Montano R, Bryant JE, Scott A, Stephen JM
|
||||
Realistic Simulated and Empirical Data. Neuroinformatics 10:141-158
|
||||
"""
|
||||
|
||||
from mne import read_evokeds
|
||||
from mne import read_evokeds, combine_evoked
|
||||
from mne.datasets.megsim import load_data
|
||||
|
||||
print(__doc__)
|
||||
@@ -30,7 +30,7 @@ epochs_fnames = load_data(condition=condition, data_format='single-trial',
|
||||
epochs_fnames = [f for f in epochs_fnames if 'sim6_trial_' in f][:10]
|
||||
|
||||
evokeds = [read_evokeds(f)[0] for f in epochs_fnames]
|
||||
mean_evoked = sum(evokeds[1:], evokeds[0])
|
||||
mean_evoked = combine_evoked(evokeds, weights='nave')
|
||||
|
||||
# Visualize the average
|
||||
mean_evoked.plot()
|
||||
|
||||
@@ -25,7 +25,7 @@ import matplotlib.pyplot as plt
|
||||
import mne
|
||||
from mne.datasets import spm_face
|
||||
from mne.preprocessing import ICA, create_eog_epochs
|
||||
from mne import io
|
||||
from mne import io, combine_evoked
|
||||
from mne.minimum_norm import make_inverse_operator, apply_inverse
|
||||
|
||||
print(__doc__)
|
||||
@@ -74,7 +74,7 @@ ica.apply(epochs) # clean data, default in place
|
||||
|
||||
evoked = [epochs[k].average() for k in event_ids]
|
||||
|
||||
contrast = evoked[1] - evoked[0]
|
||||
contrast = combine_evoked(evoked, weights=[-1, 1]) # Faces - scrambled
|
||||
|
||||
evoked.append(contrast)
|
||||
|
||||
@@ -128,7 +128,6 @@ stc = apply_inverse(contrast, inverse_operator, lambda2, method, pick_ori=None)
|
||||
# stc.save('spm_%s_dSPM_inverse' % constrast.comment)
|
||||
|
||||
# Plot contrast in 3D with PySurfer if available
|
||||
brain = stc.plot(hemi='both', subjects_dir=subjects_dir)
|
||||
brain.set_time(170.0) # milliseconds
|
||||
brain.show_view('ventral')
|
||||
brain = stc.plot(hemi='both', subjects_dir=subjects_dir, initial_time=0.170,
|
||||
views=['ven'])
|
||||
# brain.save_image('dSPM_map.png')
|
||||
|
||||
@@ -148,5 +148,5 @@ stc_feat = mne.SourceEstimate(feature_weights, vertices=vertices,
|
||||
tmin=stc.tmin, tstep=stc.tstep,
|
||||
subject='sample')
|
||||
|
||||
brain = stc_feat.plot(hemi='split', views=['lat', 'med'], transparent=True,
|
||||
brain = stc_feat.plot(views=['lat'], transparent=True,
|
||||
initial_time=0.1, time_unit='s')
|
||||
|
||||
@@ -35,6 +35,7 @@ raw = mne.io.read_raw_fif(fname_raw)
|
||||
inverse_operator = read_inverse_operator(fname_inv)
|
||||
label = mne.read_label(fname_label)
|
||||
|
||||
raw.set_eeg_reference() # set average reference.
|
||||
start, stop = raw.time_as_index([0, 15]) # read the first 15s of data
|
||||
|
||||
# Compute inverse solution
|
||||
|
||||
@@ -74,7 +74,7 @@ with FieldTripClient(host='localhost', port=1972,
|
||||
if ii == 0:
|
||||
evoked = ev
|
||||
else:
|
||||
evoked += ev
|
||||
evoked = mne.combine_evoked([evoked, ev], weights='nave')
|
||||
|
||||
ax[0].cla()
|
||||
ax[1].cla() # clear axis
|
||||
|
||||
@@ -55,7 +55,7 @@ for ii, ev in enumerate(rt_epochs.iter_evoked()):
|
||||
if ii == 0:
|
||||
evoked = ev
|
||||
else:
|
||||
evoked += ev
|
||||
evoked = mne.combine_evoked([evoked, ev], weights='nave')
|
||||
plt.clf() # clear canvas
|
||||
evoked.plot(axes=plt.gca()) # plot on current figure
|
||||
plt.pause(0.05)
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
# Dev branch marker is: 'X.Y.devN' where N is an integer.
|
||||
#
|
||||
|
||||
__version__ = '0.13'
|
||||
__version__ = '0.13.1'
|
||||
|
||||
# have to import verbose first since it's needed by many things
|
||||
from .utils import (set_log_level, set_log_file, verbose, set_config,
|
||||
|
||||
@@ -79,7 +79,7 @@ def test_ems():
|
||||
assert_equal(ems.__repr__(), '<EMS: not fitted.>')
|
||||
# manual leave-one-out to avoid sklearn version problem
|
||||
for test in range(len(y)):
|
||||
train = np.setdiff1d(range(len(y)), test)
|
||||
train = np.setdiff1d(range(len(y)), np.atleast_1d(test))
|
||||
ems.fit(X[train], y[train])
|
||||
coefs.append(ems.filters_)
|
||||
Xt.append(ems.transform(X[[test]]))
|
||||
|
||||
@@ -60,13 +60,13 @@ def test_generalization_across_time():
|
||||
y_4classes = np.hstack((epochs.events[:7, 2], epochs.events[7:, 2] + 1))
|
||||
if check_version('sklearn', '0.18'):
|
||||
from sklearn.model_selection import (KFold, StratifiedKFold,
|
||||
ShuffleSplit, LeaveOneLabelOut)
|
||||
ShuffleSplit, LeaveOneGroupOut)
|
||||
cv_shuffle = ShuffleSplit()
|
||||
cv = LeaveOneLabelOut()
|
||||
cv = LeaveOneGroupOut()
|
||||
# XXX we cannot pass any other parameters than X and y to cv.split
|
||||
# so we have to build it before hand
|
||||
cv_lolo = [(train, test) for train, test in cv.split(
|
||||
X=y_4classes, y=y_4classes, labels=y_4classes)]
|
||||
y_4classes, y_4classes, y_4classes)]
|
||||
|
||||
# With sklearn >= 0.17, `clf` can be identified as a regressor, and
|
||||
# the scoring metrics can therefore be automatically assigned.
|
||||
|
||||
Vendored
+3
-1302
File diff suppressed because it is too large
Load Diff
Vendored
+2
-2
@@ -7,9 +7,9 @@ These can be awkward to manage in a normal Python loop, but using the
|
||||
looper you can get a better sense of the context. Use like::
|
||||
|
||||
>>> for loop, item in looper(['a', 'b', 'c']):
|
||||
... print("%d %s" % (loop.number, item))
|
||||
... print loop.number, item
|
||||
... if not loop.last:
|
||||
... print('---')
|
||||
... print '---'
|
||||
1 a
|
||||
---
|
||||
2 b
|
||||
|
||||
Vendored
+1182
File diff suppressed because it is too large
Load Diff
Vendored
+11
-9
@@ -1,12 +1,11 @@
|
||||
import sys
|
||||
|
||||
__all__ = ['PY3', 'b', 'basestring_', 'bytes', 'next', 'is_unicode']
|
||||
__all__ = ['b', 'basestring_', 'bytes', 'unicode_', 'next', 'is_unicode']
|
||||
|
||||
PY3 = True if sys.version_info[0] == 3 else False
|
||||
|
||||
if sys.version_info[0] < 3:
|
||||
if sys.version < "3":
|
||||
b = bytes = str
|
||||
basestring_ = basestring
|
||||
unicode_ = unicode
|
||||
else:
|
||||
|
||||
def b(s):
|
||||
@@ -15,26 +14,29 @@ else:
|
||||
return bytes(s)
|
||||
basestring_ = (bytes, str)
|
||||
bytes = bytes
|
||||
unicode_ = str
|
||||
text = str
|
||||
|
||||
if sys.version_info[0] < 3:
|
||||
if sys.version < "3":
|
||||
|
||||
def next(obj):
|
||||
return obj.next()
|
||||
else:
|
||||
next = next
|
||||
|
||||
if sys.version < "3":
|
||||
|
||||
def is_unicode(obj):
|
||||
if sys.version_info[0] < 3:
|
||||
def is_unicode(obj):
|
||||
return isinstance(obj, unicode)
|
||||
else:
|
||||
else:
|
||||
|
||||
def is_unicode(obj):
|
||||
return isinstance(obj, str)
|
||||
|
||||
|
||||
def coerce_text(v):
|
||||
if not isinstance(v, basestring_):
|
||||
if sys.version_info[0] < 3:
|
||||
if sys.version < "3":
|
||||
attr = '__unicode__'
|
||||
else:
|
||||
attr = '__str__'
|
||||
|
||||
+34
-37
@@ -187,11 +187,13 @@ class RawKIT(_BaseRaw):
|
||||
else:
|
||||
raise ValueError("stim needs to be list of int, '>' or "
|
||||
"'<', not %r" % str(stim))
|
||||
elif np.max(stim) >= self._raw_extras[0]['nchan']:
|
||||
raise ValueError('Tried to set stim channel %i, but sqd file '
|
||||
'only has %i channels'
|
||||
% (np.max(stim),
|
||||
self._raw_extras[0]['nchan']))
|
||||
else:
|
||||
stim = np.asarray(stim, int)
|
||||
if stim.max() >= self._raw_extras[0]['nchan']:
|
||||
raise ValueError(
|
||||
'Got stim=%s, but sqd file only has %i channels' %
|
||||
(stim, self._raw_extras[0]['nchan']))
|
||||
|
||||
# modify info
|
||||
nchan = self._raw_extras[0]['nchan'] + 1
|
||||
ch_name = 'STI 014'
|
||||
@@ -603,11 +605,15 @@ def get_kit_info(rawfile):
|
||||
# planargradiometer
|
||||
# x,y,z,theta,phi,btheta,bphi,baseline,coilsize
|
||||
sensors.append(np.fromfile(fid, dtype='d', count=9))
|
||||
elif sens_type == 257:
|
||||
elif sens_type in (257, 0):
|
||||
# reference channels
|
||||
sensors.append(np.zeros(7))
|
||||
sqd['i'] = sens_type
|
||||
else:
|
||||
raise IOError("Unknown KIT channel type: %i" % sens_type)
|
||||
sqd['sensor_locs'] = np.array(sensors)
|
||||
if len(sqd['sensor_locs']) != KIT_SYS.N_SENS:
|
||||
raise IOError("An error occurred while reading %s" % rawfile)
|
||||
|
||||
# amplifier gain
|
||||
fid.seek(KIT_SYS.AMPLIFIER_INFO)
|
||||
@@ -678,27 +684,19 @@ def get_kit_info(rawfile):
|
||||
|
||||
# Creates a list of dicts of meg channels for raw.info
|
||||
logger.info('Setting channel info structure...')
|
||||
ch_names = {}
|
||||
ch_names['MEG'] = ['MEG %03d' % ch for ch
|
||||
in range(1, sqd['n_sens'] + 1)]
|
||||
ch_names['MISC'] = ['MISC %03d' % ch for ch
|
||||
in range(1, sqd['nmiscchan'] + 1)]
|
||||
locs = sqd['sensor_locs']
|
||||
chan_locs = apply_trans(als_ras_trans, locs[:, :3])
|
||||
chan_angles = locs[:, 3:]
|
||||
info['chs'] = []
|
||||
for idx, ch_info in enumerate(zip(ch_names['MEG'], chan_locs,
|
||||
chan_angles), 1):
|
||||
ch_name, ch_loc, ch_angles = ch_info
|
||||
chan_info = {}
|
||||
chan_info['cal'] = KIT.CALIB_FACTOR
|
||||
chan_info['logno'] = idx
|
||||
chan_info['scanno'] = idx
|
||||
chan_info['range'] = KIT.RANGE
|
||||
chan_info['unit_mul'] = KIT.UNIT_MUL
|
||||
chan_info['ch_name'] = ch_name
|
||||
chan_info['unit'] = FIFF.FIFF_UNIT_T
|
||||
chan_info['coord_frame'] = FIFF.FIFFV_COORD_DEVICE
|
||||
for idx, (ch_loc, ch_angles) in enumerate(zip(chan_locs, chan_angles),
|
||||
1):
|
||||
chan_info = {'cal': KIT.CALIB_FACTOR,
|
||||
'logno': idx,
|
||||
'scanno': idx,
|
||||
'range': KIT.RANGE,
|
||||
'unit_mul': KIT.UNIT_MUL,
|
||||
'ch_name': 'MEG %03d' % idx,
|
||||
'unit': FIFF.FIFF_UNIT_T,
|
||||
'coord_frame': FIFF.FIFFV_COORD_DEVICE}
|
||||
if idx <= sqd['nmegchan']:
|
||||
chan_info['coil_type'] = FIFF.FIFFV_COIL_KIT_GRAD
|
||||
chan_info['kind'] = FIFF.FIFFV_MEG_CH
|
||||
@@ -736,19 +734,18 @@ def get_kit_info(rawfile):
|
||||
info['chs'].append(chan_info)
|
||||
|
||||
# label trigger and misc channels
|
||||
for idy, ch_name in enumerate(ch_names['MISC'],
|
||||
sqd['n_sens'] + 1):
|
||||
chan_info = {}
|
||||
chan_info['cal'] = KIT.CALIB_FACTOR
|
||||
chan_info['logno'] = idy
|
||||
chan_info['scanno'] = idy
|
||||
chan_info['range'] = 1.0
|
||||
chan_info['unit'] = FIFF.FIFF_UNIT_V
|
||||
chan_info['unit_mul'] = 0
|
||||
chan_info['ch_name'] = ch_name
|
||||
chan_info['coil_type'] = FIFF.FIFFV_COIL_NONE
|
||||
chan_info['loc'] = np.zeros(12)
|
||||
chan_info['kind'] = FIFF.FIFFV_MISC_CH
|
||||
for idx in range(1, sqd['nmiscchan'] + 1):
|
||||
ch_idx = idx + KIT_SYS.N_SENS
|
||||
chan_info = {'cal': KIT.CALIB_FACTOR,
|
||||
'logno': ch_idx,
|
||||
'scanno': ch_idx,
|
||||
'range': 1.0,
|
||||
'unit': FIFF.FIFF_UNIT_V,
|
||||
'unit_mul': 0,
|
||||
'ch_name': 'MISC %03d' % idx,
|
||||
'coil_type': FIFF.FIFFV_COIL_NONE,
|
||||
'loc': np.zeros(12),
|
||||
'kind': FIFF.FIFFV_MISC_CH}
|
||||
info['chs'].append(chan_info)
|
||||
info._update_redundant()
|
||||
return info, sqd
|
||||
|
||||
@@ -131,6 +131,11 @@ def test_raw_events():
|
||||
assert_array_equal(find_events(raw, output='step', consecutive=True),
|
||||
evts(0, 160, 0, 160, 0))
|
||||
|
||||
raw = read_raw_kit(sqd_path, stim=range(160, 162), slope='+',
|
||||
stim_code='channel')
|
||||
assert_array_equal(find_events(raw, output='step', consecutive=True),
|
||||
evts(0, 160, 0, 160, 0))
|
||||
|
||||
|
||||
def test_ch_loc():
|
||||
"""Test raw kit loc."""
|
||||
|
||||
+2
-1
@@ -200,7 +200,8 @@ def _plot_evoked(evoked, picks, exclude, unit, show,
|
||||
units = _handle_default('units', units)
|
||||
# Valid data types ordered for consistency
|
||||
valid_channel_types = ['eeg', 'grad', 'mag', 'seeg', 'eog', 'ecg', 'emg',
|
||||
'dipole', 'gof', 'bio', 'ecog', 'hbo', 'hbr']
|
||||
'dipole', 'gof', 'bio', 'ecog', 'hbo', 'hbr',
|
||||
'misc']
|
||||
|
||||
if picks is None:
|
||||
picks = list(range(info['nchan']))
|
||||
|
||||
@@ -19,7 +19,7 @@ doc-files = doc
|
||||
# cover-html = 1
|
||||
# cover-html-dir = coverage
|
||||
cover-package = mne
|
||||
ignore-files = (?:^\.|^_,|^conf\.py$)
|
||||
ignore-files = (?:^\.|^_,|^conf\.py|_tempita\.py|^_looper\.py$)
|
||||
|
||||
detailed-errors = 1
|
||||
with-doctest = 1
|
||||
@@ -30,4 +30,4 @@ doctest-fixtures = _fixture
|
||||
|
||||
[flake8]
|
||||
exclude = __init__.py,*externals*,constants.py,fixes.py
|
||||
ignore = E241
|
||||
ignore = E241,E305
|
||||
|
||||
Reference in New Issue
Block a user