Page 1 of 1

Accessing pointprocesses present in a section

Posted: Fri Jun 13, 2008 4:08 pm
by Sherif
Hi,

I would appreciate your advice on how to access/modify the settings of a pointprocess object such as an Exp2Syn present in a section. In simple terms, I have a neuron model with many sections. Some of these sections have synapses (Exp2Syn), while others do not. I am iterating over the sections (using the forall statement) and want to do the following:
1- Check if this section has an Exp2Syn object present
2- If yes, get the name of this Exp2Syn object
3- Get access to the NetCon linked to this synapse so that I can change its settings (e.g., its weight)

I have read the documentation sections on Pointprocesses and NetCon and tried some code with no success so far. The documentation of some functions was not clear to me at some points.

Thanks
-Sherif

Re: Accessing pointprocesses present in a section

Posted: Fri Jun 13, 2008 8:21 pm
by ted
The documentation of some functions was not clear to me at some points.
That means the documentation is improving.

The MechanismType class has some nice methods for discovering what mechanisms are present in a section. Particularly useful for your purpose are its pp_begin() and pp_next() methods. Check them out here
http://www.neuron.yale.edu/neuron/stati ... l#pp_begin

It is also possible to discover what density mechanisms have been inserted into a section--see this helpful post by Jose Ambros-Ingerson: viewtopic.php?f=16&t=1292

Re: Accessing pointprocesses present in a section

Posted: Mon Jun 16, 2008 11:33 am
by Sherif
Hi Ted,

Wow. This is exactly what I wanted. Thanks Ted very much. It was not clear, at least for me, from the description of MechanismType Class that the created list will have the mechanisms available at the currently accessed section. I thought it will have the mechanisms available in all sections of the model; thus, this class didn't attract my attention. I used "pp_begin()" and "pp_next()" functions, in conjunction with the "netconlist" function and I was able to access the NetCon connections linked to the pointprocess available at the accessed section.

Speaking of the NetCon class, can you give me a clearer definition, or an example, on "precell" and "postcell" terms? It says in the documentation:
Postcell

SYNTAX
cellobj = netcon.postcell()

DESCRIPTION
If the synaptic point process is located in a section which was declared in an object (defined in a cell template), a reference to the postsynaptic cell (object) is returned.
Can you show me an example on "a section declared in an object "?

Again, thanks.

Re: Accessing pointprocesses present in a section

Posted: Mon Jun 16, 2008 12:54 pm
by ted
Can you show me an example on "a section declared in an object "?
Better than that--you can make one yourself with a CellBuilder. On the Management page, click on Cell Type. Then click on "Save hoc code in file" (you may have to drag the bottom edge of the CellBuilder down to see that button). The resulting hoc file will contain a template that defines a new object class. That object class will contain sections that are public and can be accessed from hoc via dot notation, e.g.

Code: Select all

objref foo
foo = new MyCellClass()
foo.soma print secname() // assuming MyCellClass has a section called soma
After you have read this, I should really split it off into a new thread in the
Modeling networks
area of the Forum.

Re: Accessing pointprocesses present in a section

Posted: Tue Jun 24, 2008 1:06 pm
by delarue
Continuing the theme - is there an easy way (in ~ one line of code) to know how many point processes of particular type are present in particular section ?? I know it's possible just to go over all the point processes with MechanismType and count them, but a one built-in function would be much more elegant and less time-consuming.
Thanks.

Re: Accessing pointprocesses present in a section

Posted: Fri Oct 03, 2014 11:46 am
by ted
delarue wrote:is there an easy way (in ~ one line of code) to know how many point processes of particular type are present in particular section ??
Reviewing loose ends in the Forum, I came across this question which deserves an answer. There is no built-in function for this, but it's not hard to create one.

Code: Select all

// Usage: numpp(classname) where classname is a string
// Returns number of instances of point processes attached to the currently accessed section
// that belong to the class called classname
func numpp() { local i  localobj mt,pp
  mt = new MechanismType(1)
  mt.select($s1)
  i = 0
  for (pp = mt.pp_begin(); object_id(pp) != 0; pp = mt.pp_next()) i+=1
  return i
}
For example, consider a model in which three ExpSyns and one Exp2Syn are attached to the soma. Executing this code

Code: Select all

soma {
  print "number of instances of a given class attached to ", secname(), ":"
  print "IClamp ", numpp("IClamp")
  print "ExpSyn ", numpp("ExpSyn")
  print "Exp2Syn ", numpp("Exp2Syn")
}
will produce this output

Code: Select all

number of instances of a given class attached to soma:
IClamp 0 
ExpSyn 3 
Exp2Syn 1 
a built-in function would be much more elegant and less time-consuming.
Elegance aside, in the interval since the question was first posted, there have been no reports that counting the number of point processes attached to sections has been a significant computational bottleneck.