nest / nestml

A domain specific language for neuron and synapse models in spiking neural network simulation
GNU General Public License v2.0
46 stars 45 forks source link

implementation of synapse with 2 variables (Gradual Rise) #532

Closed Ziaeemehr closed 4 years ago

Ziaeemehr commented 4 years ago

I'm almost new to nestml, so be patient please!

In "An Introduction to modeling neural dynamics" by Borgers, section 20.2, the synaptic current is defined as:

I_syn = g_bar_syn * s(t) (V_rev - V_post)
dq/dt = (1+tanh(V/10)) / 2 * (1-q) / tau_rise - q / 0.1 - q / tau_decay_q
ds / dt = q (1 - s) / tau_rise - s / tau_decay

fig_20_4

The question is how to implement this synapse? I searched for a while in previous issues, nothing matched to this. Thank you in advance for any guide.

Ziaeemehr commented 4 years ago

Is it possible to define an ODE for synapse variable? I think the problem is sigmoid function (F(V_pre)) that depends on V_pre of the presynaptic neuron which we do not have access to it. for the simple case of one variable:

I_syn = g_bar_syn * s(t) (V_rev - V_post)
ds/dt = F(V_pre)(1-s) / tau_rise - s / tau_decay

is implemented as :

shape g_ex = exp(-1/tau_decay * t)
function I_syn_exc pA = convolve(g_ex, spikeExc) * ( V_m - E_ex )

am I right? and instead of sigmoid function we use the condition on voltage V_m passing the threshold.

for the case of 2 variable synapse, if we have a spike at t=0, then approximately s satisfy [Borgers eq. 20.11]

ds/dt = exp(-t / tau_decay_q) * (1 - s) / tau_rise - s / tau_decay

the term exp(-t / tau_decay_q) * (1 - s) / tau_rise initially drives s up. However, as exp(-t / tau_decay_q), decays, the term -s / tau_decay takes over. Still I don't know how to include the slow rise.

clinssen commented 4 years ago

Dear @Ziaeemehr: I'm afraid that in NEST Simulator, it is proving extremely difficult to obtain access to the presynaptic membrane potential. Aside from that, the synapse could be expressed in NESTML (beta version!) So, if you would like to simulate your model in NEST, we need to ask the core NEST Simulator developers for support. Could I ask you to open an issue on nest/nest-simulator, and explain your problem (accessing presynaptic membrane potential--at what times, etc.) and use case?

Ziaeemehr commented 4 years ago

Thank you @clinssen . I open the issue in nest simulator. Just for nlow I tried to implement AMPA receptor to my HH like model. I followed the hill_tononi.nestml, and it worked properly. to connect two neuron I used:

nest.Connect(neuron1, neuron2)

ampa_coupled

upper panel shows the voltage recorded from postsynaptic neuron. the middle panel is the synaptic current from AMPA receptor and the lower panel depicts the spikes of presynaptic neuron.

So far, so good. but I can not print the receptor types:

File "example_traub_ampa_single_neuron.py", line 28, in <module>
    receptors = nest.GetDefaults(model)["receptor_types"]
KeyError: 'receptor_types'

When I add the code for NMDA receptor to nestml file,

receptors = nest.GetDefaults(model)["receptor_types"]

command give me the receptors:

{'AMPA': 1, 'NMDA': 2}

but when I try to connect the two neurons,

nest.Connect(neuron1, neuron2, syn_spec={"receptor_types": "NMDA"})
Traceback (most recent call last):
  File "example_traub_ampa_coupled_neuron.py", line 43, in <module>
    nest.Connect(neuron1, neuron2, syn_spec={"receptor_type": "NMDA"})
  File "/home/abolfazl/prog/install-dir/nest-simulator-2.18.0_build/lib/python3.6/site-packages/nest/ll_api.py", line 246, in stack_checker_func
    return f(*args, **kwargs)
  File "/home/abolfazl/prog/install-dir/nest-simulator-2.18.0_build/lib/python3.6/site-packages/nest/lib/hl_api_connections.py", line 362, in Connect
    sr('Connect')
  File "/home/abolfazl/prog/install-dir/nest-simulator-2.18.0_build/lib/python3.6/site-packages/nest/ll_api.py", line 132, in catching_sli_run
    raise exceptionCls(commandname, message)
nest.ll_api.BadProperty: ('BadProperty in Connect_g_g_D_D: Cannot handle parameter type. Received stringtype', 'BadProperty', <SLILiteral: Connect_g_g_D_D>, ': Cannot handle parameter type. Received stringtype')

It also works with out error If I only have NMDA receptor in nestml file (comment the AMPA receptor codes). ampa_coupled

I don't know where is the problem. Am I doing some thing wrong? Could you please give me some help. @clinssen.

traub_ampa_nestml.nestml.txt example_traub_ampa_coupled_neuron.py.txt

clinssen commented 4 years ago

Could you try using numbers (1 and 2) instead of strings ("AMPA" and "NMDA") for the "receptor_type"?

Ziaeemehr commented 4 years ago

@clinssen Thank you very much, It worked!