Here is the python file that I used for the testing:
import matplotlib.pyplot as plt import nest
dt = 0.1 nest.resolution = dt
syn_delay = 0.3 syn_model = "stdp_synapse" syn_specs = {"synapse_model": syn_model, "weight": 1.0, "delay": syn_delay, "lambda": 1., "mu_plus": 0., "mu_minus": 0. }
# neurons pre_neuron = nest.Create("parrot_neuron") post_neuron = nest.Create("parrot_neuron")
# test also with "spike_times": [10.], this results to no STDP updates nest_spikes_pre = nest.Create("spike_generator", params={"spike_times": [10., 20.]}) nest.Connect(nest_spikes_pre, pre_neuron)
sr_post = nest.Create("spike_recorder") nest.Connect(post_neuron, sr_post)
sr_pre = nest.Create("spike_recorder") nest.Connect(pre_neuron, sr_pre)
nest.Connect(pre_neuron, post_neuron, syn_spec=syn_specs)
weight_before_sim = nest.GetConnections(target=post_neuron, synapse_model=syn_model).weight
nest.Simulate(100)
print("Weight before: ", weight_before_sim) print("Weight after: ", nest.GetConnections(target=post_neuron, synapse_model=syn_model).weight)
fig, axs = plt.subplots(1, 2) axs[1].title.set_text("Post neuron") axs[0].title.set_text("Pre neuron")
events = sr_post.get("events") senders = events["senders"] ts = events["times"] axs[1].plot(ts, senders, "r.") events = sr_pre.get("events") senders = events["senders"] ts = events["times"] axs[0].plot(ts, senders, "r.")
plt.show()