Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid lowpass=0 in brainvision data #10517

Merged
merged 5 commits into from
Apr 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lychfindel I used the :newcontrib: above and realized we needed an entry in names.inc, feel free to push to change the URL if this is not the one you want!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thanks a lot, then I will remove it from my other PR!


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