This is an automated email from the git hooks/post-receive script. yoh pushed a commit to branch master in repository python-mne.
commit 1a4470ce35b272ed7db04cf2ff2260f63a80434e Author: Yaroslav Halchenko <[email protected]> Date: Wed Sep 24 07:59:05 2014 -0400 Imported Upstream version 0.8.4+dfsg --- doc/source/python_reference.rst | 2 ++ mne/__init__.py | 2 +- mne/gui/_file_traits.py | 38 ++++++++++++++++++++------------------ mne/io/base.py | 8 ++++---- mne/io/edf/edf.py | 4 ++-- mne/report.py | 14 ++++++++------ 6 files changed, 37 insertions(+), 31 deletions(-) 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/mne/__init__.py b/mne/__init__.py index a8c5268..0b90048 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.4' # 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/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 _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
