synapse eith single source , multiple targets

The basics of how to develop, test, and use models.
Post Reply
menica
Posts: 71
Joined: Wed Sep 02, 2015 11:02 am

synapse eith single source , multiple targets

Post by menica »

Dear all,
I would like to insert a synapse in each of the 3 dendrites in my post-neuron
The source would be the same for all (the V of the pre-neuron (soma) )
I attempted this code

Code: Select all

nmaxsynE=3
ndend=3
objref ncl, ntc, synE[nmaxE]
ncl=new List()
for k=0,ndend{
for i=0, nmaxE {
L5PC.apic[0] synE[i] = new Exp2Syn(0.5)
soma ntc = new NetCon(&v(1), synE[i],  -25, 0, 0.05)
soma ncl.append(ntc)
synE[i].tau1 = 0.5    //AMPA
synE[i].tau2 = 5 
}
}
but it si not doing what I want.
How to modify it?
thanks
ted
Site Admin
Posts: 5810
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: synapse eith single source , multiple targets

Post by ted »

Code: Select all

for k=0,ndend{
for i=0, nmaxE {
L5PC.apic[0] synE[i] = new Exp2Syn(0.5)
 . . .
attaches all Exp2Syns to apic[0].

Your code will be more readable if nested statements are indented.
menica
Posts: 71
Joined: Wed Sep 02, 2015 11:02 am

Re: synapse eith single source , multiple targets

Post by menica »

Dear Ted,
sorry my mistake in reporting the code.
It is:

Code: Select all

L5PC.dend[k] synE[i] = new Exp2Syn(0.5)
ted
Site Admin
Posts: 5810
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: synapse eith single source , multiple targets

Post by ted »

Suggest using copy and paste in the future. It's quick and easy and avoids introducing typos.

Even after the typo is corrected, the code you provided still contains at least 3 other errors, each of which is capable of generating an error message during parsing. You never said exactly what you meant by
it is not doing what I want
nor did you say what error message appeared. However, this is a great opportunity to debug your own code, because error messages generated during parsing are usually good clues to the cause of the problem, and are usually very close to the actual location of what caused the problem. Suggest you do this:

Code: Select all

REPEAT
  run your program
  if it stops with an error message {
    examine the error message
    then read the code to find out what caused the error message
    fix that problem
  }
UNTIL the program runs without generating an error message
menica
Posts: 71
Joined: Wed Sep 02, 2015 11:02 am

Re: synapse eith single source , multiple targets

Post by menica »

Dear Ted,
I don't have any error message.
The problem is that with my code I am able to insert 3 synapses at the same dend[2], but I would like insert in each of the dend[0], dend[1], dend[2] one synapse.

I cannot find the way

best
Menica
ted
Site Admin
Posts: 5810
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: synapse eith single source , multiple targets

Post by ted »

menica wrote:I don't have any error message.
The code you provided, reformatted slightly to improve readability, taking into account the correction you provided, and leaving out any statements that are not immediately related to creating new synaptic mechanisms, is

Code: Select all

nmaxsynE=3
ndend=3
objref ncl, ntc, synE[nmaxE]
ncl=new List()
for k=0,ndend{
  for i=0, nmaxE {
    L5PC.dend[k] synE[i] = new Exp2Syn(0.5)
    . . . statements that assign synaptic parameters and set up a NetCon . . .
  }
}
The third line
objref ncl, ntc, synE[nmaxE]
should produce the following error message:
undefined variable nmaxE

If you're not getting that error message, it's because you aren't showing me the actual code you're using. That is the second time for such a problem in this particular discussion thread. This is not a useful way to proceed. You really need to be getting advice from somebody who can sit down with you and review your code with you. Your ACTUAL code that you are ACTUALLY using. That would be somebody at your own institution, not me.
The problem is that with my code I am able to insert 3 synapses at the same dend[2], but I would like insert in each of the dend[0], dend[1], dend[2] one synapse.
As I just pointed out, this should not happen because there is a mistake that will stop program execution 4 lines before the statement that creates synaptic mechanisms.

But let's suppose that the code you provided is not the actual code that you're using, and that the code that you're using actually manages to execute these nested "for loops"

Code: Select all

for k=0,ndend{
  for i=0, nmaxE {
    L5PC.dend[k] synE[i] = new Exp2Syn(0.5)
    . . . statements that assign synaptic parameters and set up a NetCon . . .
  }
}
and let's also suppose that the nested "for loops" you are using are exactly like what you posted into this thread.

The outer loop will be executed four times--once for k=0,1,2, and 3. The inner loop will be executed nmaxE+1 times, assuming that nmaxE has nonnegative value. In the first pass through the outer loop, nmaxE+1 new ExpSyns will be created and attached to dend[0]. In the second pass through the outer loop, each of those ExpSyns will be discarded and nmaxE+1 new ExpSyns will be attached to dend[1] (who knows how many that is? presumably you, because only you have the actual code you're using). And after the last pass through the outer loop, the only section that has any ExpSyns will be dend[3]. To understand why, you need to read about Object Oriented Programming
http://www.neuron.yale.edu/neuron/stati ... n/obj.html
and documentation about the keywords
new
https://www.neuron.yale.edu/neuron/stat ... 0count#new
and
objref
https://www.neuron.yale.edu/neuron/stat ... unt#objref
in the Programmer's Reference.

If you only want to attach one ExpSyn to each of 3 sections called dend, there's no need to use a pair of nested loops. Use one loop that iterates over dend[0]..[2] and attaches one ExpSyn to each of them.

And find someone else to help you with your future questions, who can examine the ACTUAL code that you are ACTUALLY using.
Post Reply