MAINT: vectorize _read_annotations_edf#8214
Merged
cbrnr merged 3 commits intomne-tools:masterfrom Sep 4, 2020
jvdd:vectorized_annotation_reading
Merged
MAINT: vectorize _read_annotations_edf#8214cbrnr merged 3 commits intomne-tools:masterfrom jvdd:vectorized_annotation_reading
cbrnr merged 3 commits intomne-tools:masterfrom
jvdd:vectorized_annotation_reading
Conversation
larsoner
approved these changes
Sep 4, 2020
mne/io/edf/edf.py
Outdated
| triggers = re.findall(pat, annot_file.read()) | ||
| else: | ||
| tals = bytearray() | ||
| annotations = np.array(annotations) # To make sure that annotations is a ndarray |
Member
There was a problem hiding this comment.
I would just do annotations = np.atleast_2d(annotations) (or below if annotations.ndim == 1: annotations = annotations[np.newaxis] rather than going through expand_dims)
Contributor
Author
There was a problem hiding this comment.
Great remark, glad I learned a new numpy method today 👍 ! ! I will insert this change.
Member
|
... oh and please add an entry to |
Member
|
Azure style complains: |
Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org>
agramfort
approved these changes
Sep 4, 2020
Contributor
|
Very nice improvement (although speedup with my test files ranges from 1x to 10x, but I guess this heavily depends on the length and other file properties). I'll merge as soon as CIs come back green! |
Contributor
|
Thanks @jvdd! |
larsoner
added a commit
to libertyh/mne-python
that referenced
this pull request
Sep 9, 2020
* upstream/master: (489 commits) MRG, DOC: Fix ICA docstring, add whitening (mne-tools#8227) MRG: Extract measurement date and age for NIRX files (mne-tools#7891) Nihon Kohden EEG file reader WIP (mne-tools#6017) BUG: Fix scaling for src_mri_t in coreg (mne-tools#8223) MRG: Set pyvista as default 3d backend (mne-tools#8220) MRG: Recreate our helmet graphic (mne-tools#8116) [MRG] Adding get_montage for montage to BaseRaw objects (mne-tools#7667) ENH: Allow setting tqdm backend (mne-tools#8177) [MRG, IO] Persyst reader into Raw object (mne-tools#8176) MRG, BUG: Fix errors in IO/loading/projectors (mne-tools#8210) MAINT: vectorize _read_annotations_edf (mne-tools#8214) FIX : events_from_annotation when annotations.orig_time is None and f… (mne-tools#8209) FIX: do not project to sphere; DOC - explain how to get EEGLAB-like topoplots (mne-tools#7455) [MRG, DOC] Added linear algebra of transform to doc (mne-tools#7087) FIX: Travis failure on python3.8.1 (mne-tools#8207) BF: String formatting in exception message (mne-tools#8206) BUG: Fix STC limit bug (mne-tools#8202) MRG, DOC: fix ica tutorial (mne-tools#8175) CSP component order selection (mne-tools#8151) MRG, ENH: Add on_missing to plot_events (mne-tools#8198) ...
marsipu
pushed a commit
to marsipu/mne-python
that referenced
this pull request
Oct 14, 2020
* MAINT: vectorize _read_annotations_edf * MAINT: fix style complaints to + use np.atleast_2d vectorized _read_annotations_edf * Update doc/changes/latest.inc Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org> Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Speedup the processing of the channel data in EDF+ TAL format through vectorizing the code.
This speedup tackles the time bottleneck when a RawEDF object is created.
Note: experimental results on private datasets yielded a speedup of 100-150x on EDF+C and EDF+D files of 20 - 360 MB when calling mne.io.read_raw_edf.
Author: Jeroen Van Der Donckt (IDLab Ghent University - imec)