Skip to content

Commit

Permalink
[MRG] fix for annotations when plotting (#3517)
Browse files Browse the repository at this point in the history
* FIX for annot when meas_date has one element

* TST plt.close('all') to free memory
  • Loading branch information
jasmainak authored and agramfort committed Aug 19, 2016
1 parent 49a1c6a commit e09124e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mne/annotations.py
Expand Up @@ -119,7 +119,9 @@ def _onset_to_seconds(raw, onset):
if meas_date is None:
meas_date = 0
elif not np.isscalar(meas_date):
meas_date = meas_date[0] + meas_date[1] / 1000000.
if len(meas_date) > 1:
meas_date[1] /= 1e6
meas_date = meas_date.sum()
if raw.annotations.orig_time is None:
orig_time = meas_date
else:
Expand Down
8 changes: 8 additions & 0 deletions mne/viz/tests/test_raw.py
Expand Up @@ -2,6 +2,7 @@
#
# License: Simplified BSD

import numpy as np
import os.path as op
import warnings

Expand Down Expand Up @@ -121,6 +122,13 @@ def test_plot_raw():
kind='release')

plt.close('all')
# test if meas_date has only one element
raw.info['meas_date'] = np.array([raw.info['meas_date'][0]],
dtype=np.int32)
raw.annotations = Annotations([1 + raw.first_samp / raw.info['sfreq']],
[5], ['bad'])
raw.plot()
plt.close('all')


@requires_version('scipy', '0.10')
Expand Down

0 comments on commit e09124e

Please sign in to comment.