[med-svn] [python-mne] 329/376: FIX: bug fix in reading of dig points

Yaroslav Halchenko debian at onerussian.com
Fri Nov 27 17:23:16 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 30f576fef9df70b7fcd8f473e28238fe05a1cd1d
Author: Alexandre Gramfort <alexandre.gramfort at inria.fr>
Date:   Wed Aug 3 16:46:53 2011 -0400

    FIX: bug fix in reading of dig points
---
 mne/fiff/meas_info.py      | 16 +++++++---------
 mne/fiff/tag.py            |  2 +-
 mne/fiff/tests/test_raw.py |  6 ++++++
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/mne/fiff/meas_info.py b/mne/fiff/meas_info.py
index 61efcf3..bd168cf 100644
--- a/mne/fiff/meas_info.py
+++ b/mne/fiff/meas_info.py
@@ -128,16 +128,14 @@ def read_meas_info(fid, tree):
 
     #   Locate the Polhemus data
     isotrak = dir_tree_find(meas_info, FIFF.FIFFB_ISOTRAK)
-    if len(isotrak):
-        isotrak = isotrak[0]
+    dig = None
+    if len(isotrak) == 0:
+        raise ValueError('Isotrak not found')
+    if len(isotrak) > 1:
+        raise ValueError('Multiple Isotrak found')
     else:
-        if len(isotrak) == 0:
-            raise ValueError('Isotrak not found')
-        if len(isotrak) > 1:
-            raise ValueError('Multiple Isotrak found')
-
-    dig = []
-    if len(isotrak) == 1:
+        isotrak = isotrak[0]
+        dig = []
         for k in range(isotrak['nent']):
             kind = isotrak['directory'][k].kind
             pos = isotrak['directory'][k].pos
diff --git a/mne/fiff/tag.py b/mne/fiff/tag.py
index 66dcd6a..709e666 100644
--- a/mne/fiff/tag.py
+++ b/mne/fiff/tag.py
@@ -233,7 +233,7 @@ def read_tag(fid, pos=None):
                 tag.data = dict()
                 tag.data['kind'] = int(np.fromfile(fid, dtype=">i4", count=1))
                 tag.data['ident'] = int(np.fromfile(fid, dtype=">i4", count=1))
-                tag.data['r'] = np.fromfile(fid, dtype=">i4", count=3)
+                tag.data['r'] = np.fromfile(fid, dtype=">f4", count=3)
                 tag.data['coord_frame'] = 0
             elif tag.type == FIFF.FIFFT_COORD_TRANS_STRUCT:
                 tag.data = dict()
diff --git a/mne/fiff/tests/test_raw.py b/mne/fiff/tests/test_raw.py
index 64f203c..c4eedf7 100644
--- a/mne/fiff/tests/test_raw.py
+++ b/mne/fiff/tests/test_raw.py
@@ -35,6 +35,9 @@ def test_io_raw():
         # Writing
         raw.save('raw.fif', picks, tmin=0, tmax=5)
 
+        if fname == fif_fname:
+            assert len(raw.info['dig']) == 146
+
         raw2 = Raw('raw.fif')
 
         sel = pick_channels(raw2.ch_names, meg_ch_names)
@@ -46,4 +49,7 @@ def test_io_raw():
                                   raw2.info['dev_head_t']['trans'])
         assert_array_almost_equal(raw.info['sfreq'], raw2.info['sfreq'])
 
+        if fname == fif_fname:
+            assert_array_almost_equal(raw.info['dig'][0]['r'], raw2.info['dig'][0]['r'])
+
         fname = op.join(op.dirname(__file__), 'data', 'test_raw.fif')

-- 
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