Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spike input from real neurons #183

Open
mariakesa opened this issue Sep 18, 2021 · 1 comment
Open

Spike input from real neurons #183

mariakesa opened this issue Sep 18, 2021 · 1 comment

Comments

@mariakesa
Copy link

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

@kaeldai
Copy link
Collaborator

kaeldai commented Sep 22, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants