Hi , excuseme , i tried to simulate a " Closed-Loop Gliotransmission " synapse with three neurons and two astrocytes and the connection synapse is like this :
ecs_syn_to_astro = Synapses(synapses , astrocytes, 'Y_S_post = Y_S_pre : mmolar (summed)')
ecs_syn_to_astro.connect (j='i if i < 500')
ecs_astro_to_syn = Synapses ( astrocytes , synapses , 'G_A_post = G_A_pre : mmolar (summed)')
ecs_astro_to_syn.connect (j='i if i < 500')
and i get a error for the last line .
Full traceback of error (if relevant)
IndexError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/brian2/codegen/runtime/cython_rt/cython_rt.py in run_block(self, block)
156 try:
--> 157 return compiled_code.main(self.namespace)
158 except Exception as exc:
_cython_magic_53851247f6b73d887ad8f87e1cc90925.pyx in _cython_magic_53851247f6b73d887ad8f87e1cc90925.main()
IndexError: index j=0 outside allowed range from 0 to -1
The above exception was the direct cause of the following exception:
BrianObjectException Traceback (most recent call last)
6 frames
/usr/local/lib/python3.7/dist-packages/brian2/codegen/runtime/cython_rt/cython_rt.py in run_block(self, block)
159 message = (f"An exception occured during the execution of the "
160 f"'{block}' block of code object '{self.name}'.\n")
--> 161 raise BrianObjectException(message, self.owner) from exc
162
163 def _insert_func_namespace(self, func):
BrianObjectException: Error encountered with object named 'synapses_5'.
Object was created here (most recent call only, full details in debug log):
File '<ipython-input-2-f832fdabe896>', line 211, in <module>
ecs_astro_to_syn = Synapses ( astrocytes , synapses , 'G_A_post = G_A_pre : mmolar (summed)' )
An exception occured during the execution of the 'run' block of code object 'synapses_5_synapses_create_generator_codeobject'.
Hi @Maryidea . Admittedly the error message is not great, but βindex j=0 outside allowed range from 0 to -1β means that no synapse can be created, because the target group is empty (in other words, even the index 0 is βtoo bigβ). From your code this means that the synapses
that ecs_astro_to_syn
is supposed to connect to, does not have any synapses. Thereβs a synapses.connect(...)
missing somewhere earlier.
All that said, if you actually have three neurons and two astrocytes, I do not quite see how the connect statement j='i if i < 500'
is supposed to work. This connect statement means to connect things in a one-to-one fashion (astrocyte 0 with synapse 0, astrocyte 1 with synapse 1, etc.), for the first 500 synapses/astrocytes β you do not seem to have that many.
1 Like
Thank you @mstimberg for your attention and your explanations. according to your explanation i wrote this :
astro_to_astro_eqs = βββ
delta_I = I_post - I_pre :mmolar
J_coupling_post = F * (I_post - I_pre) : mmolar/second (summed)βββ
synapses.connect()
astro_to_astro = Synapses(astrocytes , astrocytes , model=astro_to_astro_eqs)
astro_to_astro.connect(βj == (i + 1) % 1β)
ecs_syn_to_astro = Synapses(synapses , astrocytes, βY_S_post = Y_S_pre : mmolar (summed)β)
ecs_syn_to_astro.connect(j=βi if i < 6β)
ecs_astro_to_syn = Synapses ( astrocytes , synapses , βG_A_post = G_A_pre : mmolar (summed)β)
ecs_astro_to_syn.connect(j=βi if i < 6β)
and i donβt get any error . but i donβt know that is true or not !
I am not sure, this might be correct, but it depends on what you want to do. You said in your initial post that you want to use closed-loop gliotransmission with three neurons and two astrocytes, but I am not sure what this means. In our closed-loop transmission example in Example: example_4_synrel β Brian 2 2.5.0.3 documentation , each pair of neurons has a single synapse and a single astrocyte which is connected reciprocally with the synapse. What connectivity scheme do you have in mind for your simulation? Is it like this (Nβ¦ are neurons, Sβ¦ are synapses, and Aβ¦ are astrocytes):
ββββββ ββββββ ββββββ ββββββ ββββββ
β N0 ββββΊ S0 ββββΊ N1 ββββΊ S1 ββββΊ N2 β
ββββββ ββ¬βββ²β ββββββ ββ¬βββ²β ββββββ
β β β β
ββΌβββ΄β ββΌβββ΄β
β A0 ββββββββββββΊ A1 β
ββββββ ββββββ
If that is the connection scheme you have in mind (and if you donβt want to extend your simulation to much bigger networks later), the easiest solution would be to use explicit indices instead of the general string expressions.
Something along these lines:
neurons = NeuronGroup(3, ...)
astrocytes = NeuronGroup(2, ...)
synapses = Synapses(neurons, neurons, ...)
synapses.connect(i=[0, 1], j=[1, 2]) # connect neurons 0β1 and 1β2
astro_to_astro = Synapses(astrocytes, astrocytes, ...)
astro_to_astro.connect(i=[0, 1], j=[1, 0]) # connect astrocytes 0β1 and 1β0
ecs_syn_to_astro = Synapses(synapses, astrocytes, ...)
ecs_syn_to_astro.connect(i=[0, 1], j=[0, 1]) # connect syn to astro 0β0 and 1β1
ecs_astro_to_syn = Synapses(astrocytes, synapses, ...)
ecs_astro_to_syn.connect(i=[0, 1], j=[0, 1]) # connect astro to syn 0β0 and 1β1
1 Like
Thank you @mstimber for your explanations , actually i want to simulate two pre-synaptic neuron with one post synaptic neuron and two astrocytes that they connect with βJ_couplingβ . i think that i can write the synapses like what you write here , but if i want to extend my simulation i should find another way .
and sorry my simulation have problem with βexcβ and i replaced it with βecsβ and for run i get this error
UnsupportedEquationsException: Cannot integrate stochastic equations with this state updater.
The above exception was the direct cause of the following exception:
BrianObjectException Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/brian2/core/network.py in before_run(self, run_namespace)
892 obj.before_run(run_namespace)
893 except Exception as ex:
β 894 raise BrianObjectException(βAn error occurred when preparing an object.β, obj) from ex
895
896 # Check that no object has been run as part of another network before
BrianObjectException: Error encountered with object named βneurongroup_9_stateupdaterβ.
Object was created here (most recent call only, full details in debug log):
File ββ, line 204, in
astrocytes = NeuronGroup( 2 , astro_eqs , threshold= βC > C_Thetaβ , refractory='C> C_Theta β , reset = glio_release , method =βrk4β )
An error occurred when preparing an object. (See above for original error message and traceback.)
Hi @Maryidea . Sorry about theexc
/ecs
confusion, that was my mistake. Iβll edit my earlier comment to avoid other people being confused by it.
Regarding your error: you seem to have added a noise term with the variable \xi (i.e. xi
) to your equations. The rk4
integration method cannot deal with stochastic equations. You can either chose a method that can deal with this type of equation (euler
, heun
and milstein
should probably all work in your case), or reformulate the noise in a way that is mathematically slightly less correct in general (the noise is a value that only changes in between time steps), but is exactly equivalent to the way it gets evaluated with the euler
integration algorithm. For a noise code like this (your equation is obviously longer, but this focusses only on the noise part):
dv/dt = tau**-0.5*sigma*xi: volt
you replace it like this:
dv/dt = noise: volt
noise = sigma*randn()/(sqrt(tau)*sqrt(dt)) : volt/second (constant over dt)
You can then use an integration algorithm like rk4
, which will integrate the deterministic part of the equation with better accuracy than euler
.
1 Like
Thank you so much for your attention , what you said was so helpfull for me
thank you
1 Like