Hello,
We are trying to plot an exponential synaptic trace in a custom made synapse model made with NESTML, and to do that we are trying to use the print function within the model. But when we try to print something or to change the value of a variable (initialized in the state block) inside the update block, nothing happens. We started with a simple string "Hello", and nothing was printed. We then tried to add 1 to a variable initialized to 0 and its value didn't change. If the print command is written in the onReceive block, it works without problems; as for the variable, its value can be changed in the onReceive block, but if we print its value in the onReceive block and change the value in the update block, we see that the value is not updated from 0. Since we would like to get the value of the synaptic trace to plot its change during simulation, we would need to get the value of the trace not just when a spike is received (there would be no point) but more often. Do you know what we could do? (And why the update block is not working properly?)
Best regards, Léa D.
Dear Léa,
Thanks for writing in. You've indeed pointed out a bit of an inconsistency in the NESTML synapse update block. We've already started work to rectify this (https://github.com/nest/nestml/pull/798), but it might also need some clarification that synaptic traces are not updated on a regular time grid, but only when a presynaptic spike is "received" by the synapse. The statements in the synapse update block are executed whenever a new spike is processed; also when a postsynaptic spike is processed, except that this update is deferred (queued) and only actually takes place when triggered by a presynaptic spike.
For a workaround that you might be able to use, you can run the simulation not in one go, but in several consecutive "chunks". Between each chunk, you would grab the trace value using a GetStatus() call. We are using this strategy for our dopamine-modulated STDP tutorial that we just gave yesterday at OCNS 2022; this is also under review to be merged and you can find it at https://github.com/nest/nestml/pull/787. Please have a look and let us know if this solution works for you.
With kind regards, Charl
On Fri, Jul 15, 2022, at 13:49, lea.driessens@ensea.fr wrote:
Hello,
We are trying to plot an exponential synaptic trace in a custom made synapse model made with NESTML, and to do that we are trying to use the print function within the model. But when we try to print something or to change the value of a variable (initialized in the state block) inside the update block, nothing happens. We started with a simple string "Hello", and nothing was printed. We then tried to add 1 to a variable initialized to 0 and its value didn't change. If the print command is written in the onReceive block, it works without problems; as for the variable, its value can be changed in the onReceive block, but if we print its value in the onReceive block and change the value in the update block, we see that the value is not updated from 0. Since we would like to get the value of the synaptic trace to plot its change during simulation, we would need to get the value of the trace not just when a spike is received (there would be no point) but more often. Do you know what we could do? (And why the update block is not working properly?)
Best regards, Léa D. _______________________________________________ NEST Users mailing list -- users@nest-simulator.org To unsubscribe send an email to users-leave@nest-simulator.org
Dear Charl, Thanks for your suggestions! We were able to get the log values of the synaptic trace we were interested in by running the simulation in chunks. However, we noticed that the instruction we wrote in the update block were never executed, not even when receiving a presynaptic spike! Thus, we were only able to have a "squared" exponential decay: the trace value was only determined by the equation ```syn_trace' = syn_trace / tau_syn ``` and was only updated in big steps when a spike travelled through the individual synapse (note that we are currently using a toy network with four neurons and very few spikes). Here reported a figure ( https://imgur.com/a/AJfbcu1 ) to explain the concept: the four lines are the exponentially-decaying synaptic traces for each connection in the network and the markers are the spikes travelling from the presynaptic neurons; if we look at the blue trace, for instance, we see that its value is updated only when the yellow-marked spikes are present, causing an irregular shape of the exponential decay.
We might highlight the fact that we are using NESTML 5.0.0rc2 since NESTML 5.0.0 has conflicts with the existing NEST installation on our workstation (version 3.1) that we cannot change due to shared usage of the machine.
With this being said, what would be the best way to have a smooth decay of an exponential function that depends the least on (or possibly is independent of) the actual spikes being processed by the synapse model? (i.e. how could we achieve curves similar to the dopamine traces shown in the tutorial you sent us?)
Best, Léa D.
Hello Léa,
As Charl mentioned in the previous email, there is a bug w.r.t statements in the update block in synapses and that is why you cannot see the statements in the update block being executed. The fix is currently under review and will be merged soon: https://github.com/nest/nestml/pull/798 https://github.com/nest/nestml/pull/798
Meanwhile, to get a smoother curve for the eligibility trace, you could run the simulation with large number of chunks and get the trace value directly from NEST’s get() function. A sample code is as below:
syn = nest.GetConnections(target=neurons, synapse_model="stdp_nestml_rec”) sim_time = 10000 sim_chunks = 100
# Rum simulation in chunks nest.Prepare() for i in range(sim_chunks): nest.Run(sim_time//sim_chunks) pre_trace = syn.get(“pre_trace”) nest.Cleanup()
Please replace the synapse_model_name and “pre_trace” with appropriate values from your model. Hope this helps and let us know if you can get smoother traces with this.
Thanks, Pooja
On 25. Jul 2022, at 17:18, lea.driessens@ensea.fr wrote:
Dear Charl, Thanks for your suggestions! We were able to get the log values of the synaptic trace we were interested in by running the simulation in chunks. However, we noticed that the instruction we wrote in the update block were never executed, not even when receiving a presynaptic spike! Thus, we were only able to have a "squared" exponential decay: the trace value was only determined by the equation ```syn_trace' = syn_trace / tau_syn ``` and was only updated in big steps when a spike travelled through the individual synapse (note that we are currently using a toy network with four neurons and very few spikes). Here reported a figure ( https://imgur.com/a/AJfbcu1 ) to explain the concept: the four lines are the exponentially-decaying synaptic traces for each connection in the network and the markers are the spikes travelling from the presynaptic neurons; if we look at the blue trace, for instance, we see that its value is updated only when the yellow-marked spikes are present, causing an irregular shape of the exponential decay.
We might highlight the fact that we are using NESTML 5.0.0rc2 since NESTML 5.0.0 has conflicts with the existing NEST installation on our workstation (version 3.1) that we cannot change due to shared usage of the machine.
With this being said, what would be the best way to have a smooth decay of an exponential function that depends the least on (or possibly is independent of) the actual spikes being processed by the synapse model? (i.e. how could we achieve curves similar to the dopamine traces shown in the tutorial you sent us?)
Best, Léa D. _______________________________________________ NEST Users mailing list -- users@nest-simulator.org To unsubscribe send an email to users-leave@nest-simulator.org
Hello Pooja,
Thanks for the further clarification! We understood that the bug concerned only the timing of the statement execution, not the execution itself.
I’m afraid that the solution you pointed out is already the one we have been exploring: we are indeed running the simulation in smaller chunks - following the same approach as the tutorial pointed out by Charl - but, since the eligibility trace value can only decay when spikes are arriving at the synapse and since the network has very few spikes, the trace only take big discrete leaps. The result is that we can retrieve as many trace values as we want, but they are mostly constant between chunks.
Our goal for now is to have an exponential trace that goes to 1 when a pre-synaptic spike arrives at the synapse and then smoothly decreases even in the absence of further spikes. Thus we were wondering if there was any way to execute statements in the NESTML code at each resolution tilmestep (other than the update block) that wouldn't require any network activity.
Best, Francesco
Hi Francesco,
Updating a synapse on a regular time grid is fundamentally not supported by the NEST kernel right now, although I should mention that there have been attempts in the past to add this feature (https://github.com/nest/nest-simulator/pull/1160).
However, a better approach might be the following: whenever you need to "read out" or perform computations with your trace value, could you set up this read-out function to, as a first step, update the dynamical state of the synapse to the current time? So in addition to arriving presynaptic spikes triggering a synapse state update, this readout function would be a second way to trigger an update.
With kind regards, Charl
On Fri, Jul 29, 2022, at 02:30, francescojamal.sheiban@polimi.it wrote:
Hello Pooja,
Thanks for the further clarification! We understood that the bug concerned only the timing of the statement execution, not the execution itself.
I’m afraid that the solution you pointed out is already the one we have been exploring: we are indeed running the simulation in smaller chunks
- following the same approach as the tutorial pointed out by Charl -
but, since the eligibility trace value can only decay when spikes are arriving at the synapse and since the network has very few spikes, the trace only take big discrete leaps. The result is that we can retrieve as many trace values as we want, but they are mostly constant between chunks.
Our goal for now is to have an exponential trace that goes to 1 when a pre-synaptic spike arrives at the synapse and then smoothly decreases even in the absence of further spikes. Thus we were wondering if there was any way to execute statements in the NESTML code at each resolution tilmestep (other than the update block) that wouldn't require any network activity.
Best, Francesco _______________________________________________ NEST Users mailing list -- users@nest-simulator.org To unsubscribe send an email to users-leave@nest-simulator.org