Skip to content

Commit

Permalink
Backport #10638 (#10643)
Browse files Browse the repository at this point in the history
* Use less memory when loading EDF file (#10638)

* Use less memory when loading EDF file

* Add changelog entry

* Formatting

Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org>

* Restart CI

Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org>

* Add changelog entry

* Fix version

* Change version to "unreleased"

Co-authored-by: Alexandre Gramfort <alexandre.gramfort@m4x.org>
  • Loading branch information
cbrnr and agramfort authored May 17, 2022
1 parent 5be1af6 commit 6a8dd14
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions doc/changes/1.0.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@

Also add a corresponding entry for yourself in doc/changes/names.inc

.. _changes_1_0_4:

Version 1.0.4 (unreleased)
--------------------------
- Reduce memory usage when loading an EDF file with ``preload=False`` (:gh:`10638` by `Clemens Brunner`_)

.. _changes_1_0_3:

Version 1.0.3 (2022-05-12)
Expand Down
3 changes: 2 additions & 1 deletion mne/io/edf/edf.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ def _read_segment_file(data, idx, fi, start, stop, raw_extras, filenames,
one = np.zeros((len(orig_sel), d_eidx - d_sidx), dtype=data.dtype)
for ii, ci in enumerate(read_sel):
# This now has size (n_chunks_read, n_samp[ci])
ch_data = many_chunk[:, ch_offsets[ci]:ch_offsets[ci + 1]]
ch_data = many_chunk[:,
ch_offsets[ci]:ch_offsets[ci + 1]].copy()

if ci in tal_idx:
tal_data.append(ch_data)
Expand Down

0 comments on commit 6a8dd14

Please sign in to comment.