NetCon.event not working for me

The basics of how to develop, test, and use models.
Post Reply
eacheon
Posts: 97
Joined: Wed Jan 18, 2006 2:20 pm

NetCon.event not working for me

Post by eacheon »

Hello, NetCon.event doesn't work for me, could you run the following little script and tell me what's wrong with it? When I hit the "init and run" button, there's no synaptic events at 2.5 ms as I expected ...

Code: Select all

loaderr = load_file("nrngui.hoc")

proc morpho_passive_init () {
    nseg = 1
    diam = 20
    L = 20

    insert pas
    e_pas = -50 
    g_pas = 10 * 1e-3 / cm
}//}}}



objref biexcit, nc

create soma 
soma morpho_passive_init()
soma {   
    biexcit = new ExpSyn(0.5)
    biexcit.tau = 1
}


objref nil
nc = new NetCon(nil, biexcit)
nc.weight = .5
nc.delay = 0

v_init = -60 
nc.event(2.5)

nrncontrolmenu()
newPlotV()
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

Good question.

Your code executes nc.event when the file is first parsed. However, when you initialize, the
event is discarded. To quote from
8.2 Basic initialization in NEURON: finitialize()
on page 185 of The NEURON Book:
Basic initialization in NEURON . . . carries out several actions:
1. t is set to 0 and the event queue is cleared (undelivered events from the previous run are
thrown away).
So what is needed is a means to load the event queue during the process of initialization
in such a way that the loaded event(s) will not be discarded.

This would do the job: comment out
nc.event(2.5)
and insert this bit of code in its place:

Code: Select all

objref fih
fih = new FInitializeHandler("nc.event(2.5)")
The most general way to do this is to write a proc that contains all special initializations
that are required, e.g. any NetCon event() calls, and use an FInitializeHandler to ensure
that your special proc will be called as part of initialization.

For another example of the use of the FInitializeHandler class, see
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=162

For more info about the FInitializeHandler class, see
http://www.neuron.yale.edu/neuron/stati ... ithnd.html
eacheon
Posts: 97
Joined: Wed Jan 18, 2006 2:20 pm

Post by eacheon »

ted wrote:Good question.

Your code executes nc.event when the file is first parsed. However, when you initialize, the
event is discarded. To quote from
8.2 Basic initialization in NEURON: finitialize()
on page 185 of The NEURON Book:
Basic initialization in NEURON . . . carries out several actions:
1. t is set to 0 and the event queue is cleared (undelivered events from the previous run are
thrown away).
So what is needed is a means to load the event queue during the process of initialization
in such a way that the loaded event(s) will not be discarded.

This would do the job: comment out
nc.event(2.5)
and insert this bit of code in its place:

Code: Select all

objref fih
fih = new FInitializeHandler("nc.event(2.5)")
The most general way to do this is to write a proc that contains all special initializations
that are required, e.g. any NetCon event() calls, and use an FInitializeHandler to ensure
that your special proc will be called as part of initialization.
Thanks, Ted. This works. I did read this paragraph in NEURON book, but without understanding and connecting it to my case.
ted wrote: For another example of the use of the FInitializeHandler class, see
https://www.neuron.yale.edu/phpBB2/viewtopic.php?t=162

For more info about the FInitializeHandler class, see
http://www.neuron.yale.edu/neuron/stati ... ithnd.html
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

I did read this paragraph in NEURON book, but without understanding and connecting it to my case.
Where complex technical issues are involved, it's basically impossible to grasp all
implications of every statement on the first reading, or even the nth reading. And authors of
such material repeatedly have to decide how far to go in spelling out all implications. The
question is whether it is possible to explain/understand any particular thing, without having
to explain/understand everything. Chapters 7 and 8, which deal with the standard run system
and initialization, are particularly dense--chapter 8 may be the worse of the two--so it's no
discredit to miss some subtle but important point.

A further comment:
In replying to questions, I often add specific references to documentation for the benefit
of potential readers who may be just getting started.
Post Reply