[med-svn] [python-mne] 02/05: Imported Upstream version 0.8.6+dfsg

Alexandre Gramfort agramfort-guest at moszumanska.debian.org
Sat Oct 25 07:52:15 UTC 2014


This is an automated email from the git hooks/post-receive script.

agramfort-guest pushed a commit to branch master
in repository python-mne.

commit 0630aa1c6c1d99400cead86b1a1a49f3806ba988
Author: Alexandre Gramfort <alexandre.gramfort at m4x.org>
Date:   Mon Sep 22 16:05:35 2014 -0400

    Imported Upstream version 0.8.6+dfsg
---
 MANIFEST.in                     |  5 +++++
 doc/source/python_reference.rst |  2 ++
 doc/source/whats_new.rst        |  2 +-
 mne/__init__.py                 |  2 +-
 mne/coreg.py                    |  3 ++-
 mne/gui/_file_traits.py         | 38 ++++++++++++++++++++------------------
 mne/io/base.py                  |  8 ++++----
 mne/io/edf/edf.py               |  4 ++--
 mne/report.py                   | 14 ++++++++------
 9 files changed, 45 insertions(+), 33 deletions(-)

diff --git a/MANIFEST.in b/MANIFEST.in
index e2b071e..6e868f4 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -9,7 +9,12 @@ recursive-include mne/data *.sel
 recursive-include mne/data *.fif.gz
 recursive-include mne/layouts *.lout
 recursive-include mne/layouts *.lay
+recursive-include mne/html *.js
+recursive-include mne/html *.css
 recursive-exclude examples/MNE-sample-data *
+recursive-exclude examples/MNE-testing-data *
+recursive-exclude examples/MNE-spm-face *
+recursive-exclude examples/MNE-somato-data *
 # recursive-include mne/fiff/tests/data *
 recursive-exclude mne/fiff/tests/data *
 recursive-exclude mne/fiff/bti/tests/data *
diff --git a/doc/source/python_reference.rst b/doc/source/python_reference.rst
index 3704cc9..5c3f7fe 100644
--- a/doc/source/python_reference.rst
+++ b/doc/source/python_reference.rst
@@ -122,6 +122,8 @@ Functions:
 File I/O
 ========
 
+.. currentmodule:: mne
+
 Functions:
 
 .. autosummary::
diff --git a/doc/source/whats_new.rst b/doc/source/whats_new.rst
index 0f31d17..23919c5 100644
--- a/doc/source/whats_new.rst
+++ b/doc/source/whats_new.rst
@@ -143,7 +143,7 @@ API
 
    - Deprecate Epochs.drop_picks in favor of a new method called drop_channels
 
-   - Deprecate `labels_from_parc` and `parc_from_labels` in favor of `read_annot` and `write_annot`
+   - Deprecate `labels_from_parc` and `parc_from_labels` in favor of `read_labels_from_annot` and `write_labels_to_annot`
 
    - The default of the new add_dist option of `setup_source_space` to add patch information will change from False to True in MNE-Python 0.9
 
diff --git a/mne/__init__.py b/mne/__init__.py
index a8c5268..2ae0043 100644
--- a/mne/__init__.py
+++ b/mne/__init__.py
@@ -1,7 +1,7 @@
 """MNE for MEG and EEG data analysis
 """
 
-__version__ = '0.8.3'
+__version__ = '0.8.6'
 
 # have to import verbose first since it's needed by many things
 from .utils import (set_log_level, set_log_file, verbose, set_config,
diff --git a/mne/coreg.py b/mne/coreg.py
index ce634e1..2461380 100644
--- a/mne/coreg.py
+++ b/mne/coreg.py
@@ -1150,6 +1150,7 @@ def scale_source_space(subject_to, src_name, subject_from=None, scale=None,
 
     if add_dist:
         logger.info("Recomputing distances, this might take a while")
-        add_source_space_distances(sss, sss[0]['dist_limit'], n_jobs)
+        dist_limit = np.asscalar(sss[0]['dist_limit'])
+        add_source_space_distances(sss, dist_limit, n_jobs)
 
     write_source_spaces(dst, sss)
diff --git a/mne/gui/_file_traits.py b/mne/gui/_file_traits.py
index 98a9425..6bc1b4a 100644
--- a/mne/gui/_file_traits.py
+++ b/mne/gui/_file_traits.py
@@ -118,18 +118,19 @@ def set_fs_home():
         return True
 
 def _fs_home_problem(fs_home):
-    "Check FREESURFER_HOME path"
-    test_dir = os.path.join(fs_home, 'subjects', 'fsaverage')
+    """Check FREESURFER_HOME path
+
+    Return str describing problem or None if the path is okay.
+    """
     if fs_home is None:
-        problem = "FREESURFER_HOME is not set."
+        return "FREESURFER_HOME is not set."
     elif not os.path.exists(fs_home):
-        problem = "FREESURFER_HOME (%s) does not exist." % fs_home
-    elif not os.path.exists(test_dir):
-        problem = ("FREESURFER_HOME (%s) does not contain the fsaverage "
-                   "subject." % fs_home)
+        return "FREESURFER_HOME (%s) does not exist." % fs_home
     else:
-        problem = None
-    return problem
+        test_dir = os.path.join(fs_home, 'subjects', 'fsaverage')
+        if not os.path.exists(test_dir):
+            return ("FREESURFER_HOME (%s) does not contain the fsaverage "
+                    "subject." % fs_home)
 
 
 def get_mne_root():
@@ -197,18 +198,19 @@ def set_mne_root(set_mne_bin=False):
         return True
 
 def _mne_root_problem(mne_root):
-    "Check MNE_ROOT path"
-    test_dir = os.path.join(mne_root, 'share', 'mne', 'mne_analyze')
+    """Check MNE_ROOT path
+
+    Return str describing problem or None if the path is okay.
+    """
     if mne_root is None:
-        problem = "MNE_ROOT is not set."
+        return "MNE_ROOT is not set."
     elif not os.path.exists(mne_root):
-        problem = "MNE_ROOT (%s) does not exist." % mne_root
-    elif not os.path.exists(test_dir):
-        problem = ("MNE_ROOT (%s) is missing files. If this is your MNE "
-                   "installation, consider reinstalling." % mne_root)
+        return "MNE_ROOT (%s) does not exist." % mne_root
     else:
-        problem = None
-    return problem
+        test_dir = os.path.join(mne_root, 'share', 'mne', 'mne_analyze')
+        if not os.path.exists(test_dir):
+            return ("MNE_ROOT (%s) is missing files. If this is your MNE "
+                    "installation, consider reinstalling." % mne_root)
 
 
 class BemSource(HasTraits):
diff --git a/mne/io/base.py b/mne/io/base.py
index 98b2b31..a25f4cc 100644
--- a/mne/io/base.py
+++ b/mne/io/base.py
@@ -1445,8 +1445,6 @@ def _write_raw(fname, raw, info, picks, format, data_type, reset_range, start,
     logger.info('Writing %s' % use_fname)
 
     meas_id = info['meas_id']
-    if meas_id is None:
-        meas_id = 0
 
     fid, cals = _start_writing_raw(use_fname, info, picks, data_type,
                                    reset_range)
@@ -1460,7 +1458,8 @@ def _write_raw(fname, raw, info, picks, format, data_type, reset_range, start,
         start_block(fid, FIFF.FIFFB_REF)
         write_int(fid, FIFF.FIFF_REF_ROLE, FIFF.FIFFV_ROLE_PREV_FILE)
         write_string(fid, FIFF.FIFF_REF_FILE_NAME, prev_fname)
-        write_id(fid, FIFF.FIFF_REF_FILE_ID, meas_id)
+        if meas_id is not None:
+            write_id(fid, FIFF.FIFF_REF_FILE_ID, meas_id)
         write_int(fid, FIFF.FIFF_REF_FILE_NUM, part_idx - 1)
         end_block(fid, FIFF.FIFFB_REF)
 
@@ -1509,7 +1508,8 @@ def _write_raw(fname, raw, info, picks, format, data_type, reset_range, start,
             start_block(fid, FIFF.FIFFB_REF)
             write_int(fid, FIFF.FIFF_REF_ROLE, FIFF.FIFFV_ROLE_NEXT_FILE)
             write_string(fid, FIFF.FIFF_REF_FILE_NAME, op.basename(next_fname))
-            write_id(fid, FIFF.FIFF_REF_FILE_ID, meas_id)
+            if meas_id is not None:
+                write_id(fid, FIFF.FIFF_REF_FILE_ID, meas_id)
             write_int(fid, FIFF.FIFF_REF_FILE_NUM, next_idx)
             end_block(fid, FIFF.FIFFB_REF)
             break
diff --git a/mne/io/edf/edf.py b/mne/io/edf/edf.py
index 7282db6..ce755ed 100644
--- a/mne/io/edf/edf.py
+++ b/mne/io/edf/edf.py
@@ -590,8 +590,8 @@ def _get_edf_info(fname, n_eeg, stim_channel, annot, annotmap, tal_channel,
         chan_info['cal'] = cal
         chan_info['logno'] = idx
         chan_info['scanno'] = idx
-        chan_info['range'] = physical_range
-        chan_info['unit_mul'] = unit_mul
+        chan_info['range'] = physical_range * (10 ** unit_mul)
+        chan_info['unit_mul'] = 0.
         chan_info['ch_name'] = ch_name
         chan_info['unit'] = FIFF.FIFF_UNIT_V
         chan_info['coord_frame'] = FIFF.FIFFV_COORD_HEAD
diff --git a/mne/report.py b/mne/report.py
index 980d08c..fedc78e 100644
--- a/mne/report.py
+++ b/mne/report.py
@@ -10,12 +10,14 @@ import os
 import os.path as op
 import fnmatch
 import re
-import numpy as np
+import codecs
 import time
 from glob import glob
 import warnings
 import base64
 
+import numpy as np
+
 from . import read_evokeds, read_events, Covariance
 from .io import Raw, read_info
 from .utils import _TempDir, logger, verbose, get_subjects_dir
@@ -108,7 +110,7 @@ def _fig_to_mrislice(function, orig_size, sl, **kwargs):
                                                   format='png')
     output = BytesIO()
     Image.open(temp_sl_fname).save(output, format='png')
-    return output.getvalue().encode('base64')
+    return base64.b64encode(output.getvalue()).decode('ascii')
 
 
 @_check_report_mode
@@ -291,7 +293,7 @@ def _build_image(data, cmap='gray'):
     fig.figimage(data, cmap=cmap)
     output = BytesIO()
     fig.savefig(output, dpi=1.0, format='png')
-    return output.getvalue().encode('base64')
+    return base64.b64encode(output.getvalue()).decode('ascii')
 
 
 def _iterate_sagittal_slices(array, limits=None):
@@ -404,7 +406,7 @@ slider_template = HTMLTemplate(u"""
 def _build_html_slider(slices_range, slides_klass, slider_id):
     """Build an html slider for a given slices range and a slices klass.
     """
-    startvalue = (slices_range[0] + slices_range[-1]) / 2 + 1
+    startvalue = (slices_range[0] + slices_range[-1]) // 2 + 1
     return slider_template.substitute(slider_id=slider_id,
                                       klass=slides_klass,
                                       minvalue=slices_range[0],
@@ -831,8 +833,8 @@ class Report(object):
 
         if overwrite or not op.isfile(fname):
             logger.info('Saving report to location %s' % fname)
-            fobj = open(fname, 'w')
-            fobj.write(_fix_global_ids(''.join(self.html)))
+            fobj = codecs.open(fname, 'w', 'utf-8')
+            fobj.write(_fix_global_ids(u''.join(self.html)))
             fobj.close()
 
             # remove header, TOC and footer to allow more saves

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