diff --git a/doc/changes/devel/xxxxx.bugfix.rst b/doc/changes/devel/xxxxx.bugfix.rst new file mode 100644 index 00000000000..cd6c9623cc3 --- /dev/null +++ b/doc/changes/devel/xxxxx.bugfix.rst @@ -0,0 +1 @@ +Fix ``mne.io.edf.edf._parse_prefilter_string`` to add prefilter information as ``np.nan`` when the prefilter information does not exist, by `Michiru Kaneda`_ diff --git a/mne/io/edf/edf.py b/mne/io/edf/edf.py index a8daf37c2cd..68a661242dc 100644 --- a/mne/io/edf/edf.py +++ b/mne/io/edf/edf.py @@ -763,7 +763,7 @@ def _extract_filter_value(s, prefix, suffix): start = s.find(prefix) + len(prefix) end = s.find(suffix, start) return s[start:end].strip() - return None + return np.nan def _parse_prefilter_string(prefiltering): diff --git a/mne/io/edf/tests/test_edf.py b/mne/io/edf/tests/test_edf.py index a324436a049..9ce0902b9ff 100644 --- a/mne/io/edf/tests/test_edf.py +++ b/mne/io/edf/tests/test_edf.py @@ -644,8 +644,8 @@ def test_edf_prefilter_parse(): prefilter_unfiltered_ch = prefilter_normal_multi_ch + [""] highpass, lowpass = _parse_prefilter_string(prefilter_unfiltered_ch) - assert_array_equal(highpass, ["1"] * 10) - assert_array_equal(lowpass, ["30"] * 10) + assert_array_equal(highpass, ["1"] * 10 + [np.nan]) + assert_array_equal(lowpass, ["30"] * 10 + [np.nan]) prefilter_edf_specs_doc = ["HP:0.1Hz LP:75Hz N:50Hz"] highpass, lowpass = _parse_prefilter_string(prefilter_edf_specs_doc) @@ -654,8 +654,8 @@ def test_edf_prefilter_parse(): prefilter_edf_specs_doc = ["", "HP:0.1Hz LP:75Hz N:50Hz", ""] highpass, lowpass = _parse_prefilter_string(prefilter_edf_specs_doc) - assert_array_equal(highpass, [None, "0.1", None]) - assert_array_equal(lowpass, [None, "75", None]) + assert_array_equal(highpass, [np.nan, "0.1", np.nan]) + assert_array_equal(lowpass, [np.nan, "75", np.nan]) @testing.requires_testing_data