Before I answer your question, here's a recommendation and a question for you:
It's good to see another NEURON user employing the FInitializeHandler class. I would suggest that instead of
Code: Select all
proc init(){ finitialize(-78)
fih = new FInitializeHandler(0, "set_e_ext(0)")
}
you just declare
Code: Select all
fih = new FInitializeHandler(0, "set_e_ext(0)")
at the "top level" of the hoc interpreter, i.e. outside of any proc or func, and certainly not inside an init() proc.
Here's why: as the documentation of the FInitializeHandler class mentions, one of the motivations for adding this class to NEURON was to reduce the need for users to create custom versions of the standard run system's proc init(), but the code in your post begins with a completely unnecessary custom proc init(). Reviewing the documentation of the FInitializeHandler class in the Programmer's Reference, I see why this might have happened: the documentation provides four different examples of how to use the FInitializeHandler class, and the last example embeds the class in the init procedure of a template (a class definition). This is guaranteed to be a source of confusion for users who are not familiar with the details of templates in NEURON. Without going into all the gory details, here are the key points:
1. The proc init() inside the Test template of that example has nothing whatever to do with the standard run system's proc init(). The fih created inside the Test template's proc init() has nothing whatever to do with the three objrefs called fih[0], fih[1], and fih[2] which were created by executing statements at the "top level" of the hoc interpreter (the hoc interpreter is a stack-based interpreter, and any statement that lies outside of a proc, func, or class is at the top level of the interpreter's stack).
2. The only time it might be useful to create an instance of the FInitializeHandler class inside a procedure called "init" is when that procedure is part of a template. And this will be a rare occurrence. Most templates have no need to create an instance of the FInitializeHandler class.
3. In almost all instances, when it is useful to create an instance of the FInitializeHandler class, this can be done at the top level of the hoc interpreter--as was done for fih[0]...fih[2] in the Programmer's Reference example.
Next, a couple of questions for you. First, it looks like you're trying to stimulate a myelinated axon, but the myelinated internodes are not exposed to the extracellular field. Are you sure this is a reasonable assumption? The specific conductance and capacitance of myelin may be small compared to the properties of nodal membrane, but internodal distances can be hundreds of times longer than the length of a node. Second, what are you going to do about nonmyelinated sections such as dendrites?
Finally, your question:
I wish to stimulate the fiber with a sinusoidal or better with a square wave of a given frequency, pulse width and amplitude.
There are several ways to do this, but determining which is best for your application depends on details of what you want to do. For example, it's easy to generate a sequence of rectangular pulses with the event delivery system, but that might not scale well as model complexity increases. How big a net are you thinking about implementing?