Skip to content

Commit

Permalink
FIX: detrend not bool
Browse files Browse the repository at this point in the history
  • Loading branch information
kingjr committed Aug 9, 2016
1 parent b8ccffe commit 5eff083
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions doc/whats_new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ BUG

- Fixed the import of EDF files with encoding characters in :func:`mne.io.read_raw_edf` by `Guillaume Dumas`_

- Fixed :class:`mne.Epochs` to ensure that detrend parameter is not a boolean by `Jean-Remi King`_

API
~~~

Expand Down
2 changes: 1 addition & 1 deletion mne/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def __init__(self, info, data, events, event_id=None, tmin=-0.2, tmax=0.5,
if (reject_tmin is not None) and (reject_tmax is not None):
if reject_tmin >= reject_tmax:
raise ValueError('reject_tmin needs to be < reject_tmax')
if detrend not in [None, 0, 1]:
if (detrend not in [None, 0, 1]) or isinstance(detrend, bool):
raise ValueError('detrend must be None, 0, or 1')

# check that baseline is in available data
Expand Down
5 changes: 3 additions & 2 deletions mne/tests/test_epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1235,8 +1235,9 @@ def test_detrend():
# There are non-M/EEG channels that should not be equal:
assert_true(not np.allclose(a, b))

assert_raises(ValueError, Epochs, raw, events[:4], event_id, tmin, tmax,
detrend=2)
for value in ['foo', 2, False, True]:
assert_raises(ValueError, Epochs, raw, events[:4], event_id,
tmin, tmax, detrend=value)


def test_bootstrap():
Expand Down

0 comments on commit 5eff083

Please sign in to comment.