AllenInstitute / bmtk

Brain Modeling Toolkit
https://alleninstitute.github.io/bmtk/
BSD 3-Clause "New" or "Revised" License
272 stars 88 forks source link

PR for resolving some inefficiencies #247

Closed shixnya closed 1 year ago

shixnya commented 2 years ago

Changes in edge_adaptor.py caches the loaded dynamics files, and avoid reading them multiple times. This is helpful if you run networks with many edge types.

Changes in spike_train_readers.py is to avoid looping over HDF5 array. For the sorted case, I also implemented a vectorized way of setting the slices. For the non-sorted case, just copied the HDF array into np array first.

This may cause an issue for a very large spike file that's larger than memory size. In that becomes the problem, I suggest reading chunk by chunk from the HDF5 file (~1GB or so) instead of looping over it.