Skip to content

Commit

Permalink
Avoid lowpass=0 in brainvision data (#10517)
Browse files Browse the repository at this point in the history
* Avoid lowpass=0 in brainvision data

* Add changelog

* Update doc/changes/latest.inc

Co-authored-by: Stefan Appelhoff <stefan.appelhoff@mailbox.org>

Co-authored-by: Alessandro Tonin <alessandro.tonin@wysscenter.ch>
Co-authored-by: Stefan Appelhoff <stefan.appelhoff@mailbox.org>
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
  • Loading branch information
4 people authored Apr 14, 2022
1 parent a264cdb commit 394ee2c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions doc/changes/latest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Enhancements

Bugs
~~~~
- Fix bug in :func:`mne.io.read_raw_brainvision` when BrainVision data are acquired with the Brain Products "V-Amp" amplifier and disabled lowpass filter is marked with value ``0`` (:gh:`10517` by :newcontrib:`Alessandro Tonin`)

- Fix bug in :func:`mne.pick_types` and related methods where ``csd=True`` was not passed handled properly (:gh:`10470` by :newcontrib:`Matthias Dold`)

- Fix bug where plots produced using the ``'qt'`` / ``mne_qt_browser`` backend could not be added using :meth:`mne.Report.add_figure` (:gh:`10485` by `Eric Larson`_)
Expand Down
2 changes: 2 additions & 0 deletions doc/changes/names.inc
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@
.. _Senwen Deng: https://snwn.de
.. _Alessandro Tonin: https://wysscenter.ch/team/alessandro-tonin
.. _Michiru Kaneda: https://github.com/rcmdnk
.. _Scott Huberty: https://orcid.org/0000-0003-2637-031X
Expand Down
6 changes: 3 additions & 3 deletions mne/io/brainvision/brainvision.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ def _get_vhdr_info(vhdr_fname, eog, misc, scale):
if len(lowpass) == 0:
pass
elif len(set(lowpass)) == 1:
if lowpass[0] in ('NaN', 'Off'):
if lowpass[0] in ('NaN', 'Off', '0'):
pass # Placeholder for future use. Lowpass set in _empty_info
else:
info['lowpass'] = float(lowpass[0])
Expand All @@ -738,7 +738,7 @@ def _get_vhdr_info(vhdr_fname, eog, misc, scale):
if lp_s:
# We convert channels with disabled filters to having
# infinitely relaxed / no filters
lowpass = [float(filt) if filt not in ('NaN', 'Off')
lowpass = [float(filt) if filt not in ('NaN', 'Off', '0')
else 0.0 for filt in lowpass]
info['lowpass'] = np.min(np.array(lowpass, dtype=np.float64))
try:
Expand All @@ -760,7 +760,7 @@ def _get_vhdr_info(vhdr_fname, eog, misc, scale):
else:
# We convert channels with disabled filters to having
# infinitely relaxed / no filters
lowpass = [float(filt) if filt not in ('NaN', 'Off')
lowpass = [float(filt) if filt not in ('NaN', 'Off', '0')
else np.Inf for filt in lowpass]
info['lowpass'] = np.max(np.array(lowpass, dtype=np.float64))

Expand Down

0 comments on commit 394ee2c

Please sign in to comment.