Updating Extra Global Parameters at runtime #606
Answered
by
neworderofjamie
why9928
asked this question in
GeNN questions
-
# flat_neuron_spike_times is input time
stim_ini = {"startSpike": np.append(0, num_spikes_per_neuron_cumulative[:-1]),
"endSpike": num_spikes_per_neuron_cumulative}
P = model.add_neuron_population("Stim", new_resolution[0] * new_resolution[1], "SpikeSourceArray", {}, stim_ini)
P.set_extra_global_param("spikeTimes", flat_neuron_spike_times)
model.add_synapse_population(
"p_bsynapse", "SPARSE_GLOBALG", NO_DELAY, P, B_pop,
"StaticPulse", {}, {"g": 1.0}, {}, {},
"DeltaCurr", {}, {},
init_connectivity("OneToOne", {}))
P.spike_recording_enabled = True
B_pop.spike_recording_enabled = True
model.build()
model.load(num_recording_timesteps=resent_timesteps)
while model.t < sim_time:
model.step_time()
# flat_neuron_spike_times2 is other input time data
P.set_extra_global_param("spikeTimes", flat_neuron_spike_times2)
P.push_extra_global_param_to_device("spikeTimes")
How does Genn update the data entered? I want to update P's data every sim_time, i.e. update the input |
Beta Was this translation helpful? Give feedback.
Answered by
neworderofjamie
Nov 22, 2023
Replies: 2 comments 1 reply
-
How to enter a batch of data into the model every 200ms, and then I do the data processing operations without stopping the model |
Beta Was this translation helpful? Give feedback.
0 replies
-
So what you need to do is:
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
why9928
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So what you need to do is:
P.set_extra_global_param("spikeTimes", flat_neuron_spike_times)
, you need to make it large enough for your largest spike array (I tend to usenp.empty(max_size)
for this.P.extra_global_params["spikeTimes"].view[:len(spikes)] = spikes
P.push_extra_global_param_to_device("spikeTimes")
are you are already doing