EtienneCmb / visbrain

A multi-purpose GPU-accelerated open-source suite for brain data visualization
http://visbrain.org
Other
241 stars 65 forks source link

Bugfix: circumvent MemoryError that occurs when the number of samples… #37

Closed paulbrodersen closed 5 years ago

paulbrodersen commented 5 years ago

… (npts) is very large.

When trying to import hypnograms in the stage-duration format, I am running out of memory on a 16 GB RAM machine as the (transiently) created array index in hypno_time_to_sample becomes extremely large. As index is collapsed in one dimension right in the next line, I just substituted the relevant lines with a for loop that computes the collapsed array in one go. This is probably even faster than the version with (the arguably more elegant) broadcasting as the allocation for the broadcasted array will eat a lot of time; however, I haven't timed it (just noticed a faster startup of Sleep.show() even for small files).

EtienneCmb commented 5 years ago

Interesting. Do you think we should keep the broadcasting version?

paulbrodersen commented 5 years ago

Personally, I wouldn't keep the broadcasting version. I left it in there to make the minimum number of changes to the code base possible.

codecov[bot] commented 5 years ago

Codecov Report

Merging #37 into master will decrease coverage by 0.01%. The diff coverage is 42.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #37      +/-   ##
==========================================
- Coverage   86.07%   86.06%   -0.02%     
==========================================
  Files         133      133              
  Lines       19430    19435       +5     
  Branches     1502     1503       +1     
==========================================
+ Hits        16725    16726       +1     
- Misses       2137     2141       +4     
  Partials      568      568
Impacted Files Coverage Δ
visbrain/io/rw_hypno.py 65.5% <42.85%> (-1.17%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 94664d7...6414038. Read the comment docs.