[med-svn] [python-mne] 211/376: refactoring stc.py to source_space.py
Yaroslav Halchenko
debian at onerussian.com
Fri Nov 27 17:22:39 UTC 2015
This is an automated email from the git hooks/post-receive script.
yoh pushed a commit to annotated tag v0.1
in repository python-mne.
commit aef45e34072312c4c80d2f9476904fd0c1352915
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date: Fri Apr 22 12:55:07 2011 -0400
refactoring stc.py to source_space.py
---
examples/plot_morph_data.py | 3 +--
mne/__init__.py | 2 +-
mne/label.py | 2 +-
mne/{stc.py => source_estimate.py} | 0
mne/tests/{test_stc.py => test_source_estimate.py} | 29 ++++++++++++++++++++++
mne/tests/test_source_space.py | 2 ++
6 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/examples/plot_morph_data.py b/examples/plot_morph_data.py
index bb1471f..6a8a3e3 100644
--- a/examples/plot_morph_data.py
+++ b/examples/plot_morph_data.py
@@ -23,13 +23,12 @@ subject_from = 'sample'
subject_to = 'morph'
fname = data_path + '/MEG/sample/sample_audvis-meg'
-fname = data_path + '/MEG/sample/sample_audvis-meg'
src_fname = data_path + '/MEG/sample/sample_audvis-meg-oct-6-fwd.fif'
stc_from = mne.SourceEstimate(fname)
src_from = mne.read_source_spaces(src_fname)
-stc_to = mne.morph_data(subject_from, subject_to, src_from, stc_from)
+stc_to = mne.morph_data(subject_from, subject_to, src_from, stc_from, 3)
stc_to.save('%s_audvis-meg' % subject_to)
diff --git a/mne/__init__.py b/mne/__init__.py
index 58ec38a..5326d54 100755
--- a/mne/__init__.py
+++ b/mne/__init__.py
@@ -4,7 +4,7 @@ from .cov import read_cov, write_cov, write_cov_file, Covariance, \
compute_raw_data_covariance, compute_covariance
from .event import read_events, write_events, find_events
from .forward import read_forward_solution
-from .stc import read_stc, write_stc, SourceEstimate, morph_data
+from .source_estimate import read_stc, write_stc, SourceEstimate, morph_data
from .bem_surfaces import read_bem_surfaces
from .source_space import read_source_spaces
from .epochs import Epochs
diff --git a/mne/label.py b/mne/label.py
index b5ab431..a46f9c5 100755
--- a/mne/label.py
+++ b/mne/label.py
@@ -1,6 +1,6 @@
import numpy as np
-from .stc import read_stc
+from .source_estimate import read_stc
def read_label(filename):
diff --git a/mne/stc.py b/mne/source_estimate.py
similarity index 100%
rename from mne/stc.py
rename to mne/source_estimate.py
diff --git a/mne/tests/test_stc.py b/mne/tests/test_source_estimate.py
similarity index 50%
rename from mne/tests/test_stc.py
rename to mne/tests/test_source_estimate.py
index 611abee..ad0c9e8 100755
--- a/mne/tests/test_stc.py
+++ b/mne/tests/test_source_estimate.py
@@ -1,6 +1,8 @@
import os.path as op
+import numpy as np
from numpy.testing import assert_array_almost_equal
+from scipy import linalg
import mne
from mne.datasets import sample
@@ -23,3 +25,30 @@ def test_io_stc():
assert_array_almost_equal(stc['tmin'], stc2['tmin'])
assert_array_almost_equal(stc['vertices'], stc2['vertices'])
assert_array_almost_equal(stc['tstep'], stc2['tstep'])
+
+
+def test_morph_data():
+ """Test morphing of data
+ """
+ import mne
+ from mne.datasets import sample
+
+ subject_from = 'sample'
+ subject_to = 'morph'
+
+ fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis-meg')
+ src_fname = op.join(data_path, 'MEG', 'sample',
+ 'sample_audvis-meg-oct-6-fwd.fif')
+
+ stc_from = mne.SourceEstimate(fname)
+ src_from = mne.read_source_spaces(src_fname)
+
+ stc_to = mne.morph_data(subject_from, subject_to, src_from, stc_from, 3)
+
+ stc_to.save('%s_audvis-meg' % subject_to)
+
+ mean_from = stc_from.data.mean(axis=0)
+ mean_to = stc_to.data.mean(axis=0)
+ assert np.corrcoef(mean_to, mean_from).min() > 0.99
+
+
\ No newline at end of file
diff --git a/mne/tests/test_source_space.py b/mne/tests/test_source_space.py
index 693e3b7..dedfdca 100755
--- a/mne/tests/test_source_space.py
+++ b/mne/tests/test_source_space.py
@@ -31,3 +31,5 @@ def test_read_source_spaces():
assert rh_faces.max() == rh_points.shape[0] - 1
assert rh_use_faces.min() >= 0
assert rh_use_faces.max() <= lh_points.shape[0] - 1
+
+def test_morph_data():
\ No newline at end of file
--
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