How to read the results of my simulation after `bsb simulate`?

24 Views Asked by At

I succesfully ran a simulation using the BSB library with bsb simulate my_network.hdf5 test_sim, and I want to read the data of the soma device that I configured. The only new file that was produced is 55db4580-eb4b-4fab-91ef-db163484db9a.nio but I don't know how to read it.

1

There are 1 best solutions below

0
On

The .nio file you found is in the NIX (Neuroscience Information Exchange) format. The recommended Python library for reading those is Neo. In Neo's data model your device with name "soma" would record analog signals into block.segments.analogsignals, or spike trains into block.segmentm.spiketrains (depends on what type of data it records). You can see which device produced the recording by checking the "device" annotation of the recording:

from neo.io import NixIO

data = NixIO("55db4580-eb4b-4fab-91ef-db163484db9a.nio")
# There will be 1 block, with 1 segment
simulation = data.blocks[0].segments[0]

for analog in simulation.analogsignals:
  if analog.annotations["device"] == "soma":
    print("Your device recorded this:", analog)

for spiketrain in simulation.spiketrains:
  if spiketrain.annotations["device"] == "soma":
    print("Your device recorded this:", spiketrain)