mne-tools / mne-tools/mne-python

RuntimeWarning for channels with different filter settings on import

Open
#12,643 12 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

BUG
Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

Recently (as of #12441), MNE started to raise warnings when importing EDF/BDF files containing channels with different filter settings (see here):

RuntimeWarning: Channels contain different highpass filters. Highest filter setting will be stored.
RuntimeWarning: Channels contain different lowpass filters. Lowest filter setting will be stored.

There are three issues with this behavior:

  1. All channels are used to check for identical filter settings. This is not a good idea, since different channel types are likely to have different filter settings. In particular, STIM channels are also considered in this comparison, so BDF files always trigger the warning (STIM channels contain empty filter strings).
  2. I think the warning message (and possibly also the resulting behavior) is incorrect. IMO, if channels (of the same type) contain different highpass filters, the lowest filter setting should be stored. Similarly, for different lowpass filters, the highest setting should be stored. These correspond to the weakest thresholds, and this is how it's done in read_raw_brainvision() (see here and here). Interestingly, read_raw_nsx() also seems to do the wrong thing (see here).
  3. In my opinion, raising a RuntimeWarning is too much. Even if the check is only performed within (certain) channel types, I would only log to info.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the EDF/BDF logic in mne/io/edf/edf.py around lines 780-784, then compare the filter handling in mne/io/brainvision/brainvision.py around lines 796-800 and 866-870. Review the related NSX logic in mne/io/nsx/nsx.py around lines 473-489 and align the channel-type filtering, stored thresholds, and warning level with the issue’s requested behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.