Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed casting rule in np.clip to allow reading of raw GDF files #12168

Merged
merged 3 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/devel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Enhancements

Bugs
~~~~
- Fix bug where :func:`mne.io.read_raw_gdf` would fail due to improper usage of ``np.clip`` (:gh:`12168` by :newcontrib:`Rasmus Aagaard`)
- Fix bugs with :func:`mne.preprocessing.realign_raw` where the start of ``other`` was incorrectly cropped; and onsets and durations in ``other.annotations`` were left unsynced with the resampled data (:gh:`11950` by :newcontrib:`Qian Chu`)
- Fix bug where ``encoding`` argument was ignored when reading annotations from an EDF file (:gh:`11958` by :newcontrib:`Andrew Gilbert`)
- Mark tests ``test_adjacency_matches_ft`` and ``test_fetch_uncompressed_file`` as network tests (:gh:`12041` by :newcontrib:`Maksym Balatsko`)
Expand Down
2 changes: 2 additions & 0 deletions doc/changes/names.inc
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@

.. _ramonapariciog: https://github.com/ramonapariciog

.. _Rasmus Aagaard: https://github.com/rasgaard

.. _Rasmus Zetter: https://people.aalto.fi/rasmus.zetter

.. _Reza Nasri: https://github.com/rznas
Expand Down
4 changes: 2 additions & 2 deletions mne/io/edf/edf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ def _read_gdf_header(fname, exclude, include=None):
else:
chn = np.zeros(n_events, dtype=np.uint32)
dur = np.ones(n_events, dtype=np.uint32)
np.clip(dur, 1, np.inf, out=dur)
np.maximum(dur, 1, out=dur)
events = [n_events, pos, typ, chn, dur]
edf_info["event_sfreq"] = event_sr

Expand Down Expand Up @@ -1878,7 +1878,7 @@ def read_raw_gdf(
input_fname = os.path.abspath(input_fname)
ext = os.path.splitext(input_fname)[1][1:].lower()
if ext != "gdf":
raise NotImplementedError(f"Only BDF files are supported, got {ext}.")
raise NotImplementedError(f"Only GDF files are supported, got {ext}.")
return RawGDF(
input_fname=input_fname,
eog=eog,
Expand Down
Loading