Help with NetCon

The basics of how to develop, test, and use models.
Post Reply
Priti Gupta
Posts: 5
Joined: Mon Jul 02, 2012 5:15 am

Help with NetCon

Post by Priti Gupta »

hello ,

I am trying to connect 3 neurons with synapses. My code looks like

Code: Select all

create neuron[3]
// create standard hh neurons
proc NeuronGeometry(){ local i,dlamda,n
	if(numarg()!=2){
		print "Create neurons with cell length(um),cell diameter(um)"
		return
	}
	// create standard hh neurons
	for(i=0; i<3; i+=1){
		access neuron[i]
		cm = 1
		Ra = 35.4	
		L = $1
		diam = $2
		insert hh	
		ena 		= 50
		ek  		= -77
		gnabar_hh 	= 0.12
		gkbar_hh 	= 0.036
		gl_hh 		= 0.0003
		el_hh  		= -54.3
		dlamda = lambda(Ra,1.0/gl_hh,diam)/50		
		n= L/dlamda	
		n = int(n/2)*2+1
		nseg=n
	}
}
// adding synapses in each neuron

maxsyn = 3
objectvar syn[maxsyn], nclist, netcon
nclist = new List()

//adding synapse to the postsynaptic neuron
neuron[1] syn[0] = new ExpSyn(0)

section netcon = new NetCon(&v(1), syn[0], -20, 1, 0.5)

//defining the presynaptic cell as neuron 0 and adding it to the list of post-synaptic neuron 1
[color=#FF0000]neuron[0] neuron[1].nclist.append(netcon))[/color]

NeuronGeometry(5000,25)
I'm constantly getting syntax error at the line marked in red..I tried many combinations but nothing seems to be working. Could someone suggest if there might be something important that I'm missing out on?

Regards,
Priti
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Help with NetCon

Post by ted »

First a few suggestions:

You will find it much easier to develop and debug network models if you organize your model setup code in this sequence:

1. Create cells. This step encompasses all statements that define the properties of the cells used in the network. It may or may not include attaching synaptic mechanisms to each cell; of course, if that is not done in this step, it must be done in the second step.

2. Connect cells. This step involves creating the NetCons that attach each target (artificial spiking cell or synaptic mechanism) to its spike source(s).

Unless you are just doing a quick throwaway hack, it is better for each cell to be an instance of a class, so its sections belong to an object instance, than for each cell to consist of sections that are created outside of an object. This is essential for any code that is to be scalable and avoid name collisions.

Now specific comments about your code--

Rather than this

Code: Select all

   for(i=0; i<3; i+=1){
      access neuron[i]
        . . . other statements . . .
   }
it is better to do

Code: Select all

   for(i=0; i<3; i+=1) neuron[i] {
        . . . other statements . . .
      }
In the Programmer's Reference documentation of the NetCon class the pseudocode examples include a couple of statements that begin with the word "section". This is meant to be read as a "placeholder" or "metasyntactic variable" that indicates the nature of the variable that will actually be used in this position in any real application of the keyword whose usage is being illustrated. In this particular case, the word "section" is supposed to be substituted with the name of a presynaptic section, specifically the name of the section that owns the presynaptic variable that the NetCon will monitor in order to detect that a spike has occurred.

If you are looking for examples of working code to guide your model network development, you might find this paper helpful:
Hines, M.L. and Carnevale, N.T.
Translating network models to parallel hardware in NEURON.
J. Neurosci. Methods 169:425-455, 2008
PDF is available from a link at http://www.neuron.yale.edu/neuron/nrnpubs
Post Reply