Skip to content

Commit

Permalink
In find_bad_channels_maxwell(), do not filter data if existing lowpas…
Browse files Browse the repository at this point in the history
…s filter frequency is equal to the one requested (#10664)
  • Loading branch information
hoechenberger authored May 23, 2022
1 parent 2dbebc0 commit 5bddef8
Show file tree
Hide file tree
Showing 2 changed files with 6 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 @@ -114,6 +114,8 @@ Bugs

- Reduce memory usage when loading an EDF file with ``preload=False`` (:gh:`10638` by `Clemens Brunner`_)

- In :func:`mne.preprocessing.find_bad_channels_maxwell`, do not re-filter the data if a low-pass filter with the requested frequency has already been applied (:gh:`xxx` by `Richard Höchenberger`_)

API and behavior changes
~~~~~~~~~~~~~~~~~~~~~~~~
- When creating BEM surfaces via :func:`mne.bem.make_watershed_bem` and :func:`mne.bem.make_flash_bem`, the ``copy`` parameter now defaults to ``True``. This means that instead of creating symbolic links inside the FreeSurfer subject's ``bem`` folder, we now create "actual" files. This should avoid troubles when sharing files across different operating systems and file systems (:gh:`10531` by `Richard Höchenberger`_)
Expand Down
7 changes: 4 additions & 3 deletions mne/preprocessing/maxwell.py
Original file line number Diff line number Diff line change
Expand Up @@ -2215,11 +2215,12 @@ def find_bad_channels_maxwell(
.. versionadded:: 0.20
"""
if h_freq is not None:
if raw.info.get('lowpass') and raw.info['lowpass'] < h_freq:
if raw.info.get('lowpass') and raw.info['lowpass'] <= h_freq:
freq_loc = 'below' if raw.info['lowpass'] < h_freq else 'equal to'
msg = (f'The input data has already been low-pass filtered with a '
f'{raw.info["lowpass"]} Hz cutoff frequency, which is '
f'below the requested cutoff of {h_freq} Hz. Not applying '
f'low-pass filter.')
f'{freq_loc} the requested cutoff of {h_freq} Hz. Not '
f'applying low-pass filter.')
logger.info(msg)
else:
logger.info(f'Applying low-pass filter with {h_freq} Hz cutoff '
Expand Down

0 comments on commit 5bddef8

Please sign in to comment.