-
Notifications
You must be signed in to change notification settings - Fork 266
Closed
Description
It seems that in particular ChannelIndex objects are not saved very efficiently by the IO.
To illustrate this I create minimal neo structures with an increasing number of channels in a ChannelIndex.
import neo
import quantities as pq
import numpy as np
for N in [10, 100, 1000, 10000, 100000]:
chidx = neo.ChannelIndex(name='chidx',
index=np.arange(N),
coordinates=np.zeros((N,2))*pq.mm)
blk = neo.Block()
blk.channel_indexes = [chidx]
with neo.NixIO('temp_N{}.nix'.format(N)) as io:
io.write(blk)
Here, the time it took to create the files and the corresponding file sizes compared to other formats/IOs (Matlab, python pickle):
NIX
N: 10 000.16s 677 kB
N: 100 000.88s 5 MB
N: 1000 008.44s 48 MB
N: 10000 084.09s 480 MB
N: 100000 923.70s 2.4 GB
MAT
N: 10 0.0016s 272 B
N: 100 0.0014s 272 B
N: 1000 0.0010s 272 B
N: 10000 0.0010s 272 B
N: 100000 0.0029s 272 B
Pickle
N: 10 0.0010s 1.5 KB
N: 100 0.0005s 3.7 KB
N: 1000 0.0006s 25 KB
N: 10000 0.0011s 240 KB
N: 100000 0.0042s 2.4 MB
neo: 0.9.0.dev
nixio: v1.5.0b4
I know that it is unusual to have this many channels, but as for example with the new functionalities for imaging data, this issue would become more relevant when interpreting each pixel as a channel, which then easily adds up to 10k.