AllenInstitute/bmtk

Spike input from real neurons

mariakesa opened this issue · 1 comments

Hello:-)

Thank you for a cool package!

I want to insert spikes from multiple neurons into a simulation via a CSV file. How should the file be formatted? I took a look at the code in utils and io and I didn't get it:-D It looks like there's just one column 'spike times'. Where are the neuron indices stored? Or is this io for the spikes of just one neuron?

Thank you so much!

All the very best,
Maria

Hi @mariakesa, spike-train csv files should contain at-least 2 columns "node_ids" (containing positive integer) and "timestamps" (floating point value in milliseconds from start of simulation), with each row corresponds to a different spike event.

Here is an example of a spikes input file in csv format. Note that this example has an extra "population" with values "thalamus" which would need to be changed or omitted. For example in the PointNet tutorial the external network is called LGN and has 500 individual cells. Here is an example of code to generate spike-train file for 500 cells all firing at 10Hz for 3 seconds - using a Poisson distribution:

from bmtk.utils.reports.spike_trains import PoissonSpikeGenerator

psg = PoissonSpikeGenerator(
    population='LGN',  # name of external population
    output_units='ms' 
)
psg.add(
    node_ids=range(500),  # list of node_ids to generate spikes for
    firing_rate=10.0,  # firing rate in Hz
    times=(0.0, 3.0)
)
psg.to_csv('lgn_spikes.csv')

The generated lgn_spikes.csv should look something like the following:

timestamps population node_ids
74.78958087228906 LGN 0
84.04695301823031 LGN 0
223.10294953361395 LGN 0
...
2748.5149952951238 LGN 499
2758.8719116446373 LGN 499
2869.469090140658 LGN 499