Marcel Stimberg
unread,Oct 24, 2019, 12:19:05 PM10/24/19Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to brian-de...@googlegroups.com
Hi Wilhelm,
your problem does not seem to call for a "simple if-statement", since
all neuron/synapse code is written from the point of view of a single
neuron/synapse, and you therefore cannot express conditions over several
neurons/synapses. I don't think a summed variable is what you need here
either, this is really only needed for synaptic effects where you need
to keep track of the individual contributions all the time due to
non-linearities.
I'm not sure whether I understood your problem 100% correctly, but the
following two approaches might give you some ideas:
1. You use an "effective input" that is a heaviside function of the
actual input:
inp_threshold = 2
inp_strength =3
neurons = NeuronGroup(1, model='''dv/dt = (effective_inp - v)/(10*ms) : 1
effective_inp = int(inp >
inp_threshold)*inp_strength : 1
dinp/dt = -inp/(5*ms) : 1''')
S= Synapses(input, neurons, model='w : 1', on_pre='inp += w')
The effective input will be 3 whenever the total input is over 2, and 0
otherwise. The total input will decay with a time constant of 5ms, so
the spreading out inputs over a long time will not trigger it, and the
effective input will only stay active for a while.
2. A similar approach, but instead of directly transforming the raw
input into an effective input, you use the raw input to trigger an event
that increase the membrane potential (could also trigger a current or a
conductance of course).
inp_threshold = 2
inp_strength =3
neurons = NeuronGroup(1, model='''dv/dt = - v/(10*ms) :
dinp/dt = -inp/(5*ms) : 1''',
events={'input_triggered': 'inp > inp_threshold'})
neurons.run_on_event('input_triggered', 'v += inp_strength')
S= Synapses(input, neurons, model='w : 1', on_pre='inp += w')
Best,
Marcel