[med-svn] [python-mne] 69/353: DOC: adding mne-python-intro tutorial to main doc
Yaroslav Halchenko
debian at onerussian.com
Fri Nov 27 17:24:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
yoh pushed a commit to tag 0.4
in repository python-mne.
commit eb50e4dfff47d499e5051fc22e702c3eefd8b497
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date: Tue Jan 31 15:06:24 2012 +0100
DOC: adding mne-python-intro tutorial to main doc
bad_dropped fix (git mess up)
cleanup ...
more cleanup
misc
---
doc/source/conf.py | 2 +-
doc/source/getting_started.rst | 11 +-
doc/source/mne-python.rst | 3 +-
doc/source/python_tutorial.rst | 329 +++++++++++++++++++++++++++++++++++++++++
mne/cov.py | 8 +-
mne/epochs.py | 5 +-
mne/fiff/ctf.py | 2 +-
mne/fiff/evoked.py | 10 +-
mne/fiff/open.py | 2 +-
mne/fiff/pick.py | 2 +-
mne/fiff/proj.py | 4 +-
mne/fiff/raw.py | 2 +-
mne/fiff/tree.py | 6 +-
mne/forward.py | 14 +-
mne/minimum_norm/inverse.py | 28 ++--
mne/source_estimate.py | 6 +-
mne/source_space.py | 8 +-
mne/surface.py | 8 +-
mne/transforms.py | 4 +-
19 files changed, 396 insertions(+), 58 deletions(-)
diff --git a/doc/source/conf.py b/doc/source/conf.py
index 4c69d9d..ffb4e15 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -66,7 +66,7 @@ master_doc = 'index'
# General information about the project.
project = u'MNE'
-copyright = u'2011, Alexandre Gramfort'
+copyright = u'2012, Alexandre Gramfort'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
diff --git a/doc/source/getting_started.rst b/doc/source/getting_started.rst
index 30d5be0..11a3489 100644
--- a/doc/source/getting_started.rst
+++ b/doc/source/getting_started.rst
@@ -32,8 +32,15 @@ Outside the Martinos Center
MNE is written in pure Python making it easy to setup of
any machine with Python >=2.6, Numpy >= 1.3 and Scipy >= 0.7.2
-For a free, fast and up to date scientific Python environment you
-can install EPD Free available at:
+For a fast and up to date scientific Python environment you
+can install EPD available at:
+
+http://www.enthought.com/products/epd.php
+
+EPD is free for academic purposes. If you cannot benefit from the
+an academic license and you don't want to pay for it, you can
+use EPD free which is a lightweight version (no 3D visualization
+support for example):
http://www.enthought.com/products/epd_free.php
diff --git a/doc/source/mne-python.rst b/doc/source/mne-python.rst
index da44e82..ae60221 100644
--- a/doc/source/mne-python.rst
+++ b/doc/source/mne-python.rst
@@ -5,9 +5,10 @@ MNE with Python
======================
.. toctree::
- :maxdepth: 2
+ :maxdepth: 1
getting_started.rst
+ python_tutorial.rst
auto_examples/index.rst
whats_new.rst
gitwash/index.rst
diff --git a/doc/source/python_tutorial.rst b/doc/source/python_tutorial.rst
new file mode 100644
index 0000000..eaa7e01
--- /dev/null
+++ b/doc/source/python_tutorial.rst
@@ -0,0 +1,329 @@
+.. _mne_python_tutorial:
+
+=========================================================
+Tutorial: MEG and EEG data processing with MNE and Python
+=========================================================
+
+Python offers transparent scripting on top of MNE.
+It was designed to be an alternative to the MNE matlab toolbox
+but now it can do much more (customize events, compute
+contrasts, statistics, time-frequency analysis etc.)
+It uses the same files as standard MNE unix commands:
+no need to convert your files to a new system or database.
+
+What you're not supposed to do with MNE Python
+----------------------------------------------
+
+ - **Forward modeling**: BEM computation and mesh creation (see :ref:`ch_forward`)
+ - **Raw data visualization** done with *mne_browse_raw* (see :ref:`ch_browse`)
+ - **MNE source estimates visualization** done with *mne_analyze* (see :ref:`ch_interactive_analysis`)
+
+What you can do with MNE Python
+-------------------------------
+
+ - **Epoching**: Define epochs, baseline correction etc.
+ - **Averaging** to get Evoked data
+ - **Linear inverse solvers** (dSPM, MNE)
+ - **Time-frequency** analysis with Morlet wavelets (induced power, phase lock value) also in the source space
+ - **Compute contrasts** between conditions, between sensors, across subjects etc.
+ - **Non-parametric statistics** in time, space and frequency (including with cluster-level)
+ - **Scripting** (batch and parallel computing)
+
+.. note:: Package based on the FIF file format from Neuromag but can work with CTF and 4D after conversion to FIF.
+
+
+Installation of the required materials
+---------------------------------------
+
+See :ref:`getting_started` with Python.
+
+Get the code
+^^^^^^^^^^^^
+
+ You can manually get the latest version of the code at:
+
+ https://github.com/mne-tools/mne-python
+
+ Then from the mne-python folder (containing a setup.py file) you can install with::
+
+ python setup.py install
+
+ You can also install the latest release with easy_install::
+
+ easy_install -U mne
+
+ or with pip::
+
+ pip install mne --upgrade
+
+From raw data to evoked data
+----------------------------
+
+.. _ipython: http://ipython.scipy.org/
+
+Now, launch `ipython`_ (Advanced Python shell)::
+
+ $ ipython -pylab -wthread
+
+First, load the mne package:
+
+ >>> import mne
+
+Access raw data
+^^^^^^^^^^^^^^^
+
+ >>> from mne.datasets import sample
+ >>> data_path = sample.data_path()
+ >>> raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'
+ >>> print raw_fname
+ ./MNE-sample-data/MEG/sample/sample_audvis_filt-0-40_raw.fif
+
+.. note:: The MNE sample dataset should be downloaded automatically but be patient (approx. 2GB)
+
+Read data from file:
+
+ >>> raw = mne.fiff.Raw(raw_fname) # doctest:+ELLIPSIS
+ Opening raw data ...
+ Ready.
+ >>> print raw
+ Raw (n_channels x n_times : 376 x 41700)
+
+Look at the channels in raw:
+
+ >>> print raw.ch_names # doctest:+ELLIPSIS
+ ['MEG 0113', 'MEG 0112', ...]
+
+Read and plot a segment of raw data
+
+ >>> start, stop = raw.time_to_index(100, 115) # 100 s to 115 s data segment
+ >>> data, times = raw[:, start:stop]
+ Reading 21465 ... 23716 = 142.953 ... 157.945 secs... [done]
+ >>> print data.shape
+ (376, 2252)
+ >>> print times.shape
+ (2252,)
+ >>> data, times = raw[2:20:3, start:stop] # take some Magnetometers
+ Reading 21465 ... 23716 = 142.953 ... 157.945 secs... [done]
+
+.. figure:: _images/plot_read_and_write_raw_data.png
+ :alt: Raw data
+
+Save a segment of 150s of raw data (MEG only):
+
+ >>> picks = mne.fiff.pick_types(raw.info, meg=True, eeg=False, stim=True)
+ >>> raw.save('sample_audvis_meg_raw.fif', tmin=0, tmax=150, picks=picks) # doctest: +ELLIPSIS
+ Reading ...
+
+Define and read epochs
+^^^^^^^^^^^^^^^^^^^^^^
+
+First extract events:
+
+ >>> events = mne.find_events(raw, stim_channel='STI 014')
+ Reading 6450 ... 48149 = 42.956 ... 320.665 secs... [done]
+ >>> print events[:5]
+ [[6994 0 2]
+ [7086 0 3]
+ [7192 0 1]
+ [7304 0 4]
+ [7413 0 2]]
+
+Events are stored as 2D numpy array where the first column is the time instant
+and the last one is the event number. It is therefore easy to manipulate.
+
+Define epochs parameters:
+
+ >>> event_id = 1 # the event number in events
+ >>> tmin = -0.2 # start of each epoch (200ms before the trigger)
+ >>> tmax = 0.5 # end of each epoch (500ms after the trigget)
+
+Exclude some channels (bads + 2 more):
+
+ >>> exclude = raw.info['bads'] + ['MEG 2443', 'EEG 053']
+
+The variable raw.info['bads'] is just a python list.
+
+Pick the good channels:
+
+ >>> picks = mne.fiff.pick_types(raw.info, meg=True, eeg=True, eog=True, stim=False, exclude=exclude)
+
+Alternatively one can restrict to magnetometers or gradiometers with:
+
+ >>> mag_picks = mne.fiff.pick_types(raw.info, meg='mag', eog=True, exclude=exclude)
+ >>> grad_picks = mne.fiff.pick_types(raw.info, meg='grad', eog=True, exclude=exclude)
+
+Define the baseline period:
+
+ >>> baseline = (None, 0) # means from the first instant to t = 0
+
+Define peak-to-peak rejection parameters for gradiometers, magnetometers and EOG:
+
+ >>> reject = dict(grad=4000e-13, mag=4e-12, eog=150e-6)
+
+Read epochs:
+
+ >>> epochs = mne.Epochs(raw, events, event_id, tmin, tmax, proj=True, picks=picks, baseline=baseline, preload=False, reject=reject)
+ 4 projection items activated
+ Adding average EEG reference projection.
+ Created an SSP operator (subspace dimension = 4)
+ 72 matching events found
+ >>> print epochs
+ Epochs (n_events : 72 (good & bad), tmin : -0.2 (s), tmax : 0.5 (s), baseline : (None, 0))
+
+Get single epochs:
+
+ >>> epochs_data = epochs.get_data() # doctest: +ELLIPSIS
+ Reading 7162 ...
+ >>> print epochs_data.shape
+ (55, 365, 106)
+
+epochs_data is a 3D array of dimension (55 epochs, 365 channels, 106 time instants).
+
+Scipy supports read and write of matlab files. You can save your single trials with:
+
+ >>> from scipy import io
+ >>> io.savemat('epochs_data.mat', dict(epochs_data=epochs_data))
+
+Compute evoked responses by averaging and plot it:
+
+ >>> evoked = epochs.average() # doctest: +ELLIPSIS
+ Reading ...
+ >>> print evoked
+ Evoked (comment : Unknown, time : [-0.199795, 0.499488], n_epochs : 72, n_channels x n_times : 364 x 106)
+ >>> from mne.viz import plot_evoked
+ >>> plot_evoked(evoked)
+
+.. figure:: _images/plot_read_epochs.png
+ :alt: Evoked data
+
+.. topic:: Exercise
+
+ 1. Extract the max value of each epoch
+
+ >>> max_in_each_epoch = [e.max() for e in epochs] # doctest:+ELLIPSIS
+ Reading ...
+ >>> print max_in_each_epoch[:4]
+ [1.9375167099187067e-05, 1.6405510537151386e-05, 1.8545374666676332e-05, 2.0412814911475336e-05]
+
+It is also possible to read evoked data stored in a fif file:
+
+ >>> evoked_fname = data_path + '/MEG/sample/sample_audvis-ave.fif'
+ >>> evoked1 = mne.fiff.Evoked(evoked_fname, setno=0, baseline=(None, 0), proj=True)
+ Reading ./MNE-sample-data/MEG/sample/sample_audvis-ave.fif ...
+ Read a total of 4 projection items:
+ PCA-v1 (1 x 102) active
+ PCA-v2 (1 x 102) active
+ PCA-v3 (1 x 102) active
+ Average EEG reference (1 x 60) active
+ Found the data of interest:
+ t = -199.80 ... 499.49 ms (Left Auditory)
+ 0 CTF compensation matrices available
+ nave = 55 - aspect type = 100
+ 4 projection items activated
+ Created an SSP operator (subspace dimension = 4)
+ SSP projectors applied...
+ Applying baseline correction ... (mode: mean)
+
+Or another one stored in the same file:
+
+ >>> evoked2 = mne.fiff.Evoked(evoked_fname, setno=1, baseline=(None, 0), proj=True) # doctest: +ELLIPSIS
+ Reading ...
+
+Compute a contrast:
+
+ >>> contrast = evoked1 - evoked2
+ >>> print contrast
+ Evoked (comment : Left Auditory - Right Auditory, time : [-0.199795, 0.499488], n_epochs : 116, n_channels x n_times : 376 x 421)
+
+Time-Frequency: Induced power and phase-locking values
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Define parameters:
+
+ >>> import numpy as np
+ >>> n_cycles = 2 # number of cycles in Morlet wavelet
+ >>> frequencies = np.arange(7, 30, 3) # frequencies of interest
+ >>> Fs = raw.info['sfreq'] # sampling in Hz
+
+Compute induced power and phase-locking values:
+
+ >>> from mne.time_frequency import induced_power
+ >>> power, phase_lock = induced_power(epochs_data, Fs=Fs, frequencies=frequencies, n_cycles=2, n_jobs=1)
+
+.. figure:: _images/plot_time_frequency.png
+ :alt: Time-Frequency
+
+Inverse modeling: MNE and dSPM on evoked and raw data
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Import the required functions:
+
+ >>> from mne.minimum_norm import apply_inverse, read_inverse_operator
+
+Read the inverse operator:
+
+ >>> fname_inv = data_path + '/MEG/sample/sample_audvis-meg-oct-6-meg-inv.fif'
+ >>> inverse_operator = read_inverse_operator(fname_inv) # doctest: +ELLIPSIS
+ Reading ...
+
+Define the inverse parameters:
+
+ >>> snr = 3.0
+ >>> lambda2 = 1.0 / snr ** 2
+ >>> dSPM = True
+
+Compute the inverse solution:
+
+ >>> stc = apply_inverse(evoked, inverse_operator, lambda2, dSPM)
+ Preparing the inverse operator for use...
+ Scaled noise and source covariance from nave = 1 to nave = 72
+ Created the regularized inverter
+ Created an SSP operator (subspace dimension = 3)
+ Created the whitener using a full noise covariance matrix (3 small eigenvalues omitted)
+ Computing noise-normalization factors... [done]
+ Picked 305 channels from the data
+ Computing inverse... (eigenleads need to be weighted)... combining the current components... (dSPM)... [done]
+
+Save the source time courses to disk:
+
+ >>> stc.save('mne_dSPM_inverse')
+ Writing STC to disk... [done]
+
+Now, let's compute dSPM on a raw file within a label:
+
+ >>> fname_label = data_path + '/MEG/sample/labels/Aud-lh.label'
+ >>> label = mne.read_label(fname_label)
+
+Compute inverse solution during the first 15s:
+
+ >>> from mne.minimum_norm import apply_inverse_raw
+ >>> start, stop = raw.time_to_index(0, 15) # read the first 15s of data
+ >>> stc = apply_inverse_raw(raw, inverse_operator, lambda2, dSPM, label, start, stop)
+ Preparing the inverse operator for use...
+ Scaled noise and source covariance from nave = 1 to nave = 1
+ Created the regularized inverter
+ Created an SSP operator (subspace dimension = 3)
+ Created the whitener using a full noise covariance matrix (3 small eigenvalues omitted)
+ Computing noise-normalization factors... [done]
+ Picked 305 channels from the data
+ Computing inverse... Reading 6450 ... 8701 = 42.956 ... 57.947 secs... [done]
+ (eigenleads need to be weighted)... combining the current components... [done]
+
+Save result in stc files:
+
+ >>> stc.save('mne_dSPM_raw_inverse_Aud')
+ Writing STC to disk... [done]
+
+What else can you do?
+^^^^^^^^^^^^^^^^^^^^^
+
+ - morph stc from one brain to another for group studies
+ - estimate power in the source space
+ - estimate noise covariance matrix from Raw and Epochs
+ - detect heart beat QRS component
+ - detect eye blinks and EOG artifacts
+
+Want to know more ?
+^^^^^^^^^^^^^^^^^^^
+
+Browse :ref:`examples-index` gallery.
diff --git a/mne/cov.py b/mne/cov.py
index e5f7a48..091829b 100644
--- a/mne/cov.py
+++ b/mne/cov.py
@@ -125,7 +125,7 @@ def read_cov(fid, node, cov_kind):
# Diagonal is stored
data = tag.data
diagmat = True
- print '\t%d x %d diagonal covariance (kind = %d) found.' \
+ print ' %d x %d diagonal covariance (kind = %d) found.' \
% (dim, dim, cov_kind)
else:
@@ -138,12 +138,12 @@ def read_cov(fid, node, cov_kind):
data = data + data.T
data.flat[::dim + 1] /= 2.0
diagmat = False
- print '\t%d x %d full covariance (kind = %d) found.' \
+ print ' %d x %d full covariance (kind = %d) found.' \
% (dim, dim, cov_kind)
else:
diagmat = False
data = tag.data
- print '\t%d x %d sparse covariance (kind = %d) found.' \
+ print ' %d x %d sparse covariance (kind = %d) found.' \
% (dim, dim, cov_kind)
# Read the possibly precomputed decomposition
@@ -425,7 +425,7 @@ def prepare_noise_cov(noise_cov, info, ch_names):
# Create the projection operator
proj, ncomp, _ = make_projector(info['projs'], ch_names)
if ncomp > 0:
- print '\tCreated an SSP operator (subspace dimension = %d)' % ncomp
+ print ' Created an SSP operator (subspace dimension = %d)' % ncomp
C = np.dot(proj, np.dot(C, proj.T))
pick_meg = pick_types(info, meg=True, eeg=False, exclude=info['bads'])
diff --git a/mne/epochs.py b/mne/epochs.py
index bc7e788..a320fd2 100644
--- a/mne/epochs.py
+++ b/mne/epochs.py
@@ -181,6 +181,7 @@ class Epochs(object):
if event_id is not None:
selected = np.logical_and(events[:, 1] == 0, events[:, 2] == event_id)
self.events = self.events[selected]
+
n_events = len(self.events)
if n_events > 0:
@@ -455,7 +456,7 @@ def _is_good(e, ch_names, channel_type_idx, reject, flat):
delta = deltas[idx_max_delta]
if delta > thresh:
ch_name = ch_names[idx[idx_max_delta]]
- print '\tRejecting epoch based on %s : %s (%s > %s).' \
+ print ' Rejecting epoch based on %s : %s (%s > %s).' \
% (name, ch_name, delta, thresh)
return False
if flat is not None:
@@ -469,7 +470,7 @@ def _is_good(e, ch_names, channel_type_idx, reject, flat):
delta = deltas[idx_min_delta]
if delta < thresh:
ch_name = ch_names[idx[idx_min_delta]]
- print ('\tRejecting flat epoch based on %s : %s (%s < %s).'
+ print (' Rejecting flat epoch based on %s : %s (%s < %s).'
% (name, ch_name, delta, thresh))
return False
diff --git a/mne/fiff/ctf.py b/mne/fiff/ctf.py
index b7a6683..4d453e9 100644
--- a/mne/fiff/ctf.py
+++ b/mne/fiff/ctf.py
@@ -203,7 +203,7 @@ def read_ctf_comp(fid, node, chs):
del col_cals
if len(compdata) > 0:
- print '\tRead %d compensation matrices' % len(compdata)
+ print ' Read %d compensation matrices' % len(compdata)
return compdata
diff --git a/mne/fiff/evoked.py b/mne/fiff/evoked.py
index a055355..38f05a1 100644
--- a/mne/fiff/evoked.py
+++ b/mne/fiff/evoked.py
@@ -149,17 +149,17 @@ class Evoked(object):
info['chs'] = chs
info['nchan'] = nchan
- print ('\tFound channel information in evoked data. nchan = %d'
+ print (' Found channel information in evoked data. nchan = %d'
% nchan)
if sfreq > 0:
info['sfreq'] = sfreq
nsamp = last - first + 1
- print '\tFound the data of interest:'
- print '\t\tt = %10.2f ... %10.2f ms (%s)' % (
+ print ' Found the data of interest:'
+ print ' t = %10.2f ... %10.2f ms (%s)' % (
1000 * first / info['sfreq'], 1000 * last / info['sfreq'], comment)
if info['comps'] is not None:
- print ('\t\t%d CTF compensation matrices available'
+ print (' %d CTF compensation matrices available'
% len(info['comps']))
# Read the data in the aspect block
@@ -181,7 +181,7 @@ class Evoked(object):
tag = read_tag(fid, pos)
epoch.append(tag)
- print '\t\tnave = %d - aspect type = %d' % (nave, aspect_kind)
+ print ' nave = %d - aspect type = %d' % (nave, aspect_kind)
nepoch = len(epoch)
if nepoch != 1 and nepoch != info['nchan']:
diff --git a/mne/fiff/open.py b/mne/fiff/open.py
index 4d27c7b..914cd24 100644
--- a/mne/fiff/open.py
+++ b/mne/fiff/open.py
@@ -53,7 +53,7 @@ def fiff_open(fname, verbose=False):
# Read or create the directory tree
if verbose:
- print '\tCreating tag directory for %s...' % fname
+ print ' Creating tag directory for %s...' % fname
dirpos = int(tag.data)
if dirpos > 0:
diff --git a/mne/fiff/pick.py b/mne/fiff/pick.py
index 6d33b48..0b48d6f 100644
--- a/mne/fiff/pick.py
+++ b/mne/fiff/pick.py
@@ -332,7 +332,7 @@ def pick_channels_forward(orig, include=[], exclude=[]):
if nuse == 0:
raise ValueError('Nothing remains after picking')
- print '\t%d out of %d channels remain after picking' % (nuse,
+ print ' %d out of %d channels remain after picking' % (nuse,
fwd['nchan'])
# Pick the correct rows of the forward operator
diff --git a/mne/fiff/proj.py b/mne/fiff/proj.py
index 3fda207..e667d68 100644
--- a/mne/fiff/proj.py
+++ b/mne/fiff/proj.py
@@ -122,13 +122,13 @@ def read_proj(fid, node):
projs.append(one)
if len(projs) > 0:
- print '\tRead a total of %d projection items:' % len(projs)
+ print ' Read a total of %d projection items:' % len(projs)
for k in range(len(projs)):
if projs[k]['active']:
misc = 'active'
else:
misc = ' idle'
- print '\t\t%s (%d x %d) %s' % (projs[k]['desc'],
+ print ' %s (%d x %d) %s' % (projs[k]['desc'],
projs[k]['data']['nrow'],
projs[k]['data']['ncol'],
misc)
diff --git a/mne/fiff/raw.py b/mne/fiff/raw.py
index 8cbab8a..05cd1fe 100644
--- a/mne/fiff/raw.py
+++ b/mne/fiff/raw.py
@@ -153,7 +153,7 @@ class Raw(object):
self.rawdir = rawdir
self.proj = None
self.comp = None
- print '\tRange : %d ... %d = %9.3f ... %9.3f secs' % (
+ print ' Range : %d ... %d = %9.3f ... %9.3f secs' % (
self.first_samp, self.last_samp,
float(self.first_samp) / info['sfreq'],
float(self.last_samp) / info['sfreq'])
diff --git a/mne/fiff/tree.py b/mne/fiff/tree.py
index edad57d..eec85e7 100644
--- a/mne/fiff/tree.py
+++ b/mne/fiff/tree.py
@@ -45,7 +45,7 @@ def make_dir_tree(fid, directory, start=0, indent=0, verbose=False):
block = 0
if verbose:
- print '\t' * indent + 'start { %d' % block
+ print ' ' * indent + 'start { %d' % block
this = start
@@ -95,9 +95,9 @@ def make_dir_tree(fid, directory, start=0, indent=0, verbose=False):
tree['directory'] = None
if verbose:
- print '\t' * (indent + 1) + 'block = %d nent = %d nchild = %d' % (
+ print ' ' * (indent + 1) + 'block = %d nent = %d nchild = %d' % (
tree['block'], tree['nent'], tree['nchild'])
- print '\t' * indent, 'end } %d' % block
+ print ' ' * indent, 'end } %d' % block
last = this
return tree, last
diff --git a/mne/forward.py b/mne/forward.py
index ab2520b..379fc77 100644
--- a/mne/forward.py
+++ b/mne/forward.py
@@ -250,7 +250,7 @@ def read_forward_solution(fname, force_fixed=False, surf_ori=False,
else:
ori = 'free'
- print '\tRead MEG forward solution (%d sources, %d channels, ' \
+ print ' Read MEG forward solution (%d sources, %d channels, ' \
'%s orientations)' % (megfwd['nsource'], megfwd['nchan'], ori)
eegfwd = _read_one(fid, eegnode)
@@ -260,7 +260,7 @@ def read_forward_solution(fname, force_fixed=False, surf_ori=False,
else:
ori = 'free'
- print '\tRead EEG forward solution (%d sources, %d channels, ' \
+ print ' Read EEG forward solution (%d sources, %d channels, ' \
'%s orientations)' % (eegfwd['nsource'], eegfwd['nchan'], ori)
# Merge the MEG and EEG solutions together
@@ -287,7 +287,7 @@ def read_forward_solution(fname, force_fixed=False, surf_ori=False,
eegfwd['sol_grad']['row_names']
fwd['nchan'] = fwd['nchan'] + eegfwd['nchan']
- print '\tMEG and EEG forward solutions combined'
+ print ' MEG and EEG forward solutions combined'
elif megfwd is not None:
fwd = megfwd
else:
@@ -336,7 +336,7 @@ def read_forward_solution(fname, force_fixed=False, surf_ori=False,
if nuse != fwd['nsource']:
raise ValueError('Source spaces do not match the forward solution.')
- print '\tSource spaces transformed to the forward solution ' \
+ print ' Source spaces transformed to the forward solution ' \
'coordinate frame'
fwd['src'] = src
@@ -354,7 +354,7 @@ def read_forward_solution(fname, force_fixed=False, surf_ori=False,
# Modify the forward solution for fixed source orientations
if fwd['source_ori'] != FIFF.FIFFV_MNE_FIXED_ORI:
- print '\tChanging to fixed-orientation forward solution...'
+ print ' Changing to fixed-orientation forward solution...'
fix_rot = _block_diag(fwd['source_nn'].T, 1)
fwd['sol']['data'] *= fix_rot
fwd['sol']['ncol'] = fwd['nsource']
@@ -368,7 +368,7 @@ def read_forward_solution(fname, force_fixed=False, surf_ori=False,
print '[done]'
elif surf_ori:
# Rotate the local source coordinate systems
- print '\tConverting to surface-based source orientations...'
+ print ' Converting to surface-based source orientations...'
nuse = 0
pp = 0
nuse_total = sum([s['nuse'] for s in src])
@@ -397,7 +397,7 @@ def read_forward_solution(fname, force_fixed=False, surf_ori=False,
print '[done]'
else:
- print '\tCartesian source orientations...'
+ print ' Cartesian source orientations...'
nuse = 0
fwd['source_rr'] = np.zeros((fwd['nsource'], 3))
for s in src:
diff --git a/mne/minimum_norm/inverse.py b/mne/minimum_norm/inverse.py
index 7e33dc0..56f1555 100644
--- a/mne/minimum_norm/inverse.py
+++ b/mne/minimum_norm/inverse.py
@@ -77,7 +77,7 @@ def read_inverse_operator(fname):
raise Exception('No parent MRI information in %s' % fname)
parent_mri = parent_mri[0]
- print '\tReading inverse operator info...',
+ print ' Reading inverse operator info...',
#
# Methods and source orientations
#
@@ -125,7 +125,7 @@ def read_inverse_operator(fname):
#
# The SVD decomposition...
#
- print '\tReading inverse operator decomposition...',
+ print ' Reading inverse operator decomposition...',
tag = find_tag(fid, invs, FIFF.FIFF_MNE_INVERSE_SING)
if tag is None:
fid.close()
@@ -155,26 +155,26 @@ def read_inverse_operator(fname):
# Read the covariance matrices
#
inv['noise_cov'] = read_cov(fid, invs, FIFF.FIFFV_MNE_NOISE_COV)
- print '\tNoise covariance matrix read.'
+ print ' Noise covariance matrix read.'
inv['source_cov'] = read_cov(fid, invs, FIFF.FIFFV_MNE_SOURCE_COV)
- print '\tSource covariance matrix read.'
+ print ' Source covariance matrix read.'
#
# Read the various priors
#
inv['orient_prior'] = read_cov(fid, invs,
FIFF.FIFFV_MNE_ORIENT_PRIOR_COV)
if inv['orient_prior'] is not None:
- print '\tOrientation priors read.'
+ print ' Orientation priors read.'
inv['depth_prior'] = read_cov(fid, invs,
FIFF.FIFFV_MNE_DEPTH_PRIOR_COV)
if inv['depth_prior'] is not None:
- print '\tDepth priors read.'
+ print ' Depth priors read.'
inv['fmri_prior'] = read_cov(fid, invs, FIFF.FIFFV_MNE_FMRI_PRIOR_COV)
if inv['fmri_prior'] is not None:
- print '\tfMRI priors read.'
+ print ' fMRI priors read.'
#
# Read the source spaces
@@ -245,7 +245,7 @@ def read_inverse_operator(fname):
nuse += inv['src'][k]['nuse']
- print ('\tSource spaces transformed to the inverse solution '
+ print (' Source spaces transformed to the inverse solution '
'coordinate frame')
#
# Done!
@@ -344,21 +344,21 @@ def prepare_inverse_operator(orig, nave, lambda2, dSPM):
if inv['eigen_leads_weighted']:
inv['eigen_leads']['data'] = sqrt(scale) * inv['eigen_leads']['data']
- print ('\tScaled noise and source covariance from nave = %d to '
+ print (' Scaled noise and source covariance from nave = %d to '
'nave = %d' % (inv['nave'], nave))
inv['nave'] = nave
#
# Create the diagonal matrix for computing the regularized inverse
#
inv['reginv'] = inv['sing'] / (inv['sing'] ** 2 + lambda2)
- print '\tCreated the regularized inverter'
+ print ' Created the regularized inverter'
#
# Create the projection operator
#
inv['proj'], ncomp, _ = make_projector(inv['projs'],
inv['noise_cov']['names'])
if ncomp > 0:
- print '\tCreated an SSP operator (subspace dimension = %d)' % ncomp
+ print ' Created an SSP operator (subspace dimension = %d)' % ncomp
#
# Create the whitener
@@ -376,7 +376,7 @@ def prepare_inverse_operator(orig, nave, lambda2, dSPM):
# Rows of eigvec are the eigenvectors
#
inv['whitener'] = np.dot(inv['whitener'], inv['noise_cov']['eigvec'])
- print ('\tCreated the whitener using a full noise covariance matrix '
+ print (' Created the whitener using a full noise covariance matrix '
'(%d small eigenvalues omitted)' % (inv['noise_cov']['dim']
- np.sum(nzero)))
else:
@@ -385,14 +385,14 @@ def prepare_inverse_operator(orig, nave, lambda2, dSPM):
#
inv['whitener'] = np.diag(1.0 /
np.sqrt(inv['noise_cov']['data'].ravel()))
- print ('\tCreated the whitener using a diagonal noise covariance '
+ print (' Created the whitener using a diagonal noise covariance '
'matrix (%d small eigenvalues discarded)' % ncomp)
#
# Finally, compute the noise-normalization factors
#
if dSPM:
- print '\tComputing noise-normalization factors...',
+ print ' Computing noise-normalization factors...',
noise_norm = np.zeros(inv['eigen_leads']['nrow'])
nrm2, = linalg.get_blas_funcs(('nrm2',), (noise_norm,))
if inv['eigen_leads_weighted']:
diff --git a/mne/source_estimate.py b/mne/source_estimate.py
index f85f12a..b19362b 100644
--- a/mne/source_estimate.py
+++ b/mne/source_estimate.py
@@ -497,11 +497,11 @@ def read_morph_map(subject_from, subject_to, subjects_dir=None):
if tag.data == FIFF.FIFFV_MNE_SURF_LEFT_HEMI:
tag = find_tag(fid, m, FIFF.FIFF_MNE_MORPH_MAP)
left_map = tag.data
- print '\tLeft-hemisphere map read.'
+ print ' Left-hemisphere map read.'
elif tag.data == FIFF.FIFFV_MNE_SURF_RIGHT_HEMI:
tag = find_tag(fid, m, FIFF.FIFF_MNE_MORPH_MAP)
right_map = tag.data
- print '\tRight-hemisphere map read.'
+ print ' Right-hemisphere map read.'
fid.close()
if left_map is None:
@@ -621,7 +621,7 @@ def morph_data(subject_from, subject_to, stc_from, grade=5, smooth=None,
data[hemi][idx_use, :] /= data1[idx_use][:, None]
- print '\t%d smooth iterations done.' % (k + 1)
+ print ' %d smooth iterations done.' % (k + 1)
dmap[hemi] = maps[hemi] * data[hemi]
ico_file_name = os.path.join(os.environ['MNE_ROOT'], 'share', 'mne',
diff --git a/mne/source_space.py b/mne/source_space.py
index 74b0e03..109f8ee 100644
--- a/mne/source_space.py
+++ b/mne/source_space.py
@@ -73,7 +73,7 @@ def read_source_spaces_from_tree(fid, tree, add_geom=False):
src = list()
for s in spaces:
- print '\tReading a source space...',
+ print ' Reading a source space...',
this = _read_one_source_space(fid, s)
print '[done]'
if add_geom:
@@ -81,7 +81,7 @@ def read_source_spaces_from_tree(fid, tree, add_geom=False):
src.append(this)
- print '\t%d source spaces read' % len(spaces)
+ print ' %d source spaces read' % len(spaces)
return src
@@ -285,7 +285,7 @@ def complete_source_space_info(this):
"""Add more info on surface
"""
# Main triangulation
- print '\tCompleting triangulation info...',
+ print ' Completing triangulation info...',
this['tri_area'] = np.zeros(this['ntri'])
r1 = this['rr'][this['tris'][:, 0], :]
r2 = this['rr'][this['tris'][:, 1], :]
@@ -298,7 +298,7 @@ def complete_source_space_info(this):
print '[done]'
# Selected triangles
- print '\tCompleting selection triangulation info...',
+ print ' Completing selection triangulation info...',
if this['nuse_tri'] > 0:
r1 = this['rr'][this['use_tris'][:, 0], :]
r2 = this['rr'][this['use_tris'][:, 1], :]
diff --git a/mne/surface.py b/mne/surface.py
index 13522c5..cf948b1 100644
--- a/mne/surface.py
+++ b/mne/surface.py
@@ -67,7 +67,7 @@ def read_bem_surfaces(fname, add_geom=False):
fid.close()
raise ValueError('BEM surface data not found')
- print '\t%d BEM surfaces found' % len(bemsurf)
+ print ' %d BEM surfaces found' % len(bemsurf)
#
# Coordinate frame possibly at the top level
#
@@ -79,14 +79,14 @@ def read_bem_surfaces(fname, add_geom=False):
#
surf = []
for bsurf in bemsurf:
- print '\tReading a surface...',
+ print ' Reading a surface...',
this = _read_bem_surface(fid, bsurf, coord_frame)
print '[done]'
if add_geom:
_complete_surface_info(this)
surf.append(this)
- print '\t%d BEM surfaces read' % len(surf)
+ print ' %d BEM surfaces read' % len(surf)
fid.close()
@@ -176,7 +176,7 @@ def _complete_surface_info(this):
#
# Main triangulation
#
- print '\tCompleting triangulation info...',
+ print ' Completing triangulation info...',
print 'triangle normals...',
this['tri_area'] = np.zeros(this['ntri'])
r1 = this['rr'][this['tris'][:, 0], :]
diff --git a/mne/transforms.py b/mne/transforms.py
index a4b169e..4d3a6d0 100644
--- a/mne/transforms.py
+++ b/mne/transforms.py
@@ -190,7 +190,7 @@ def transform_coordinates(filename, pos, orig, dest):
# count += 1
#
# if count > 0:
-# print '\t%d MEG channel locations transformed' % count
+# print ' %d MEG channel locations transformed' % count
#
# return res, count
@@ -230,6 +230,6 @@ def transform_coordinates(filename, pos, orig, dest):
# ch['coord_frame'] = trans['to']
#
# if count > 0:
-# print '\t%d EEG electrode locations transformed\n' % count
+# print ' %d EEG electrode locations transformed\n' % count
#
# return res, count
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/python-mne.git
More information about the debian-med-commit
mailing list