Skip to content

Commit

Permalink
Fix mne.io.edf.edf._parse_prefilter_string to add prefilter infor…
Browse files Browse the repository at this point in the history
…mation as ``np.nan`` when the prefilter information does not exist
  • Loading branch information
rcmdnk committed Dec 28, 2023
1 parent c224fdc commit 83b00c0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions doc/changes/devel/xxxxx.bugfix.rst
Original file line number Diff line number Diff line change
@@ -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`_
2 changes: 1 addition & 1 deletion mne/io/edf/edf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions mne/io/edf/tests/test_edf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 83b00c0

Please sign in to comment.