Repository: mne-tools/mne-python

Issue:
RuntimeWarning for channels with different filter settings on import
Recently (as of #12441), MNE started to raise warnings when importing EDF/BDF files containing channels with different filter settings (see [here](https://github.com/mne-tools/mne-python/blob/main/mne/io/edf/edf.py#L780-L784)):

```
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](https://github.com/mne-tools/mne-python/blob/main/mne/io/brainvision/brainvision.py#L796-L800) and [here](https://github.com/mne-tools/mne-python/blob/main/mne/io/brainvision/brainvision.py#L866-L870)). Interestingly, `read_raw_nsx()` also seems to do the wrong thing (see [here](https://github.com/mne-tools/mne-python/blob/main/mne/io/nsx/nsx.py#L473-L489)).
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.

Discussion:

Patch:
diff --git a/doc/changes/devel/12661.bugfix.rst b/doc/changes/devel/12661.bugfix.rst
new file mode 100644
index 000000000..5dae12d05
--- /dev/null
+++ b/doc/changes/devel/12661.bugfix.rst
@@ -0,0 +1,1 @@
+Fix incorrect RuntimeWarning (different channel filter settings) in EDF/BDF import, by `Clemens Brunner`_.
\ No newline at end of file
diff --git a/doc/changes/devel/12664.other.rst b/doc/changes/devel/12664.other.rst
new file mode 100644
index 000000000..1647e12cd
--- /dev/null
+++ b/doc/changes/devel/12664.other.rst
@@ -0,0 +1,1 @@
+Improved clarity of parameter documentation for `mne.decoding.SSD.fit`, by `Thomas Binns`_.
\ No newline at end of file
diff --git a/mne/decoding/ssd.py b/mne/decoding/ssd.py
index 64e84cdbd..4b05cb7a4 100644
--- a/mne/decoding/ssd.py
+++ b/mne/decoding/ssd.py
@@ -177,8 +177,8 @@ class SSD(BaseEstimator, TransformerMixin):
             The input data from which to estimate the SSD. Either 2D array
             obtained from continuous data or 3D array obtained from epoched
             data.
-        y : None | array, shape (n_samples,)
-            Used for scikit-learn compatibility.
+        y : None
+            Ignored; exists for compatibility with scikit-learn pipelines.
 
         Returns
         -------
diff --git a/mne/io/edf/edf.py b/mne/io/edf/edf.py
index 5c41a56f3..114938bbd 100644
--- a/mne/io/edf/edf.py
+++ b/mne/io/edf/edf.py
@@ -706,7 +706,7 @@ def _get_info(
         info["subject_info"]["weight"] = float(edf_info["subject_info"]["weight"])
 
     # Filter settings
-    if filt_ch_idxs := [x for x in sel if x not in stim_channel_idxs]:
+    if filt_ch_idxs := [x for x in range(len(sel)) if x not in stim_channel_idxs]:
         _set_prefilter(info, edf_info, filt_ch_idxs, "highpass")
         _set_prefilter(info, edf_info, filt_ch_idxs, "lowpass")
 
@@ -951,6 +951,7 @@ def _read_edf_header(
         edf_info["units"] = np.array(edf_info["units"], float)
 
         ch_names = [ch_names[idx] for idx in sel]
+        ch_types = [ch_types[idx] for idx in sel]
         units = [units[idx] for idx in sel]
 
         if not exclude_after_unique:


Test patch:
diff --git a/mne/io/edf/tests/test_edf.py b/mne/io/edf/tests/test_edf.py
index de9667dc3..1bfe198a3 100644
--- a/mne/io/edf/tests/test_edf.py
+++ b/mne/io/edf/tests/test_edf.py
@@ -173,26 +173,24 @@ def test_bdf_data():
     # XXX BDF data for these is around 0.01 when it should be in the uV range,
     # probably some bug
     test_scaling = False
-    with pytest.warns(RuntimeWarning, match="Channels contain different"):
-        raw_py = _test_raw_reader(
-            read_raw_bdf,
-            input_fname=bdf_path,
-            eog=eog,
-            misc=misc,
-            exclude=["M2", "IEOG"],
-            test_scaling=test_scaling,
-        )
+    raw_py = _test_raw_reader(
+        read_raw_bdf,
+        input_fname=bdf_path,
+        eog=eog,
+        misc=misc,
+        exclude=["M2", "IEOG"],
+        test_scaling=test_scaling,
+    )
     assert len(raw_py.ch_names) == 71
-    with pytest.warns(RuntimeWarning, match="Channels contain different"):
-        raw_py = _test_raw_reader(
-            read_raw_bdf,
-            input_fname=bdf_path,
-            montage="biosemi64",
-            eog=eog,
-            misc=misc,
-            exclude=["M2", "IEOG"],
-            test_scaling=test_scaling,
-        )
+    raw_py = _test_raw_reader(
+        read_raw_bdf,
+        input_fname=bdf_path,
+        montage="biosemi64",
+        eog=eog,
+        misc=misc,
+        exclude=["M2", "IEOG"],
+        test_scaling=test_scaling,
+    )
     assert len(raw_py.ch_names) == 71
     assert "RawEDF" in repr(raw_py)
     picks = pick_types(raw_py.info, meg=False, eeg=True, exclude="bads")