program control. This can be done with loc() and get_loc(), which are methods that can
be used with any point process.
pointproc.loc(rangeval)
where pointproc is an objref that points to a point process, tries to place the point
process on the currently accessed section at the location specified by rangeval. If
rangeval < 0 or > 1, an "Arg out of range in user function" error message is generated.
If there is no node at the specified location, the point process will be placed at the
closest internal node.
pointproc.get_loc()
returns a numerical value equal to the location (range) at which the point process is
attached to its section. It also pushes that section onto the section stack. The section
will remain on the section stack until the interpreter returns to the top level. For more
information about this, see the next message in this discussion thread.
The following proc, which is derived from one that is used in an exercise in the NEURON
Summer Course, tries to place an AlphaSynapse at a specific location on the currently
accessed section. "Tries" because there may not be a node at the location specified by
putsyn's argument, yet the synapse will be placed somewhere as long as the
location lies in the range 0..1. As a side-effect, this procedure sets the global variable
synloc to a value that tells where the synapse was actually placed.
Code: Select all
synloc=0
objref asyn
soma asyn = new AlphaSynapse(0.5)
proc putsyn() {
if ($1 < 0 || $1 > 1) {
printf("%c",7) // ring bell
print "ERROR--location must be in the range [0, 1]"
synloc = -1
} else {
// say what we want
asyn.loc($1) // loc() tries to place asyn at $1 on the current section
// find out what we got
synloc = asyn.get_loc()
/* Note: get_loc() pushes the section of the target point process onto the
section stack, so that, within this proc, it becomes the currently accessed
section. If we include any more statements inside this proc after calling get_loc(),
we should first restore the accessed section to what it was before get_loc() was
called. This can be done by calling
pop_section()
*/
}
}
Assuming that there is a section called dend,
dend putsyn(1/PI)
will move the AlphaSynapse to the internal node of dend that is closest to 1/PI.