celsius · clamp_resist · dt · secondorder · stoprun · t
See also:
Initialize t, dt, clamp_resist, and celsius to the values they had when the program was first run.
Note that in this version Ra is no longer a global variable but a section variable like L and rallbranch. Thus Ra can be different for different sections. In order to set Ra to a constant value, use:
for sec in h.allsec(): sec.Ra=...
Warning
Not very useful. No way to completely restart neuron exect to quit() and re-load.
Integrate all section equations over the interval h.dt . The value of t is incremented by dt. The default method is first order implicit but may be changed to Crank-Nicholson by changing h.secondorder = 2.
fadvance integrates the equation over the dt step by calling all the BREAKPOINT blocks of models at t+dt/2 twice with v+.001 and v in order to compute the current and conductance to form the matrix conductance*voltage = current. This matrix is then solved for v(t+dt). (if secondorder == 2 the ionic currents are adjusted to be second order correct. If secondorder == 1 the ionic currents are not adjusted but the voltages are second order correct) Lastly the SOLVE statement within the BREAKPOINT block of models is executed with t+dt and the new values of v in order to integrate those states (from new t-.5dt to new t+.5dt).
h.finitialize()
h.finitialize(v)
Call the INITIAL block for all mechanisms and point processes inserted in the sections. If the optional argument is present then all voltages of all sections are initialized to v. h.t is set to 0.
The order of principal actions during an finitialize call is:
Type 3 FInitializeHandler statements executed.
with the current biophysical spec.
t = 0
Clear the event queue.
Random.play values assigned to variables.
Vector.play at t=0 values assigned to variables.
All v = arg if the arg is present.
Type 0 FInitializeHandler statements executed.
All mechanism BEFORE INITIAL blocks are called.
Mechanisms that WRITE concentrations are after ion mechanisms and before mechanisms that READ concentrations.
LinearMechanism states are initialized
INITIAL blocks inside NETRECEIVE blocks are called.
All mechanism AFTER INITIAL blocks are called.
Type 1 FInitializeHandler statements executed.
The INITIAL block net_send(0, flag) events are delivered.
Effectively a call to CVode.re_init or fcurrent(), whichever appropriate.
Various record functions at t=0. e.g. CVode.record, Vector.record
Type 2 FInitializeHandler statements executed.
See also
FInitializeHandler, Init, CVode.re_init(), fcurrent(), frecord_init()
See also
Example:
from neuron import h soma = h.Section() soma.insert('hh') print "default el_hh = ", soma.el_hh # set el_hh so that the steady state is exactly -70 mV h.finitialize(-70) # sets v to -70 and m,h,n to corresponding steady state values h.fcurrent() # set all assigned variables consistent with states # use current balance: 0 = ina + ik + gl_hh*(v - el_hh) soma.el_hh = (soma.ina + soma.ik + soma.gl_hh * soma.v) / soma.gl_hh print "-70 mV steady state el_hh = ", soma.el_hh h.fcurrent() # recalculate currents (il_hh)
h.fmatrix()
value = h.fmatrix(x, index, sec=section)
No args: print the jacobian matrix for the tree structure in a particularly confusing way. for debugging only.
With args, return the matrix element associated with the integer index in the row corresponding to the currently accessed section at position x. The index 1...4 is associated with: The coeeficient for the effect of this locations voltage on current balance at the parent location, The coeeficient for the effect of this locations voltage on current balance at this location, The coeeficient for the effect of the parent locations voltage on current balance at this location, The right hand side of the matrix equation for this location. These are the values of NODEA, NODED NODEB, and NODERHS respectively in nrn/src/nrnoc/section.h . The matrix elements are properly setup on return from a call to the fcurrent() function. For the fixed step method fadvance() modifies NODED and NODERHS but leaves NODEA and NODEB unchanged.
This is a global variable which specifies the time integration method.
The integration interval for fadvance().
When using the default implicit integration method (secondorder = 0) there is no upper limit on dt for numerical stability and in fact for passive models it is often convenient to use dt=1.9 to obtain the steady state in a single time step.
dt can be changed by the user at any time during a simulation. However, some inserted mechanisms may use tables which depend on the value of dt which will be automatically recomputed. In this situation, the tables are not useful and should be bypassed by setting the appropriate usetable_suffix global variables to 0.
Temperature in degrees centigrade.
Generally, rate function tables (eg. used by the hh mechanism) depend on temperature and will automatically be re-computed whenever celsius changes.
saves the current state of the system in a portable file to allow one to take up where you left off -- possibly on another machine. Returning to this state is accomplished by running the program with the checkpoint file as the first argument. If the checkpoint file is inconsistent with the executable the program prints an error message and exits.
At this time many portions of the computer state are left out of the checkpoint file, i.e. it is not as complete as a core dump. Some things that ARE included are: all interpreter symbols with definitions and values, all hoc instructions, all neuron state/parameters with mechanisms. Many aspects of the GUI are not included.
Warning
There is not enough implementation at this time to make this facility useful. Use the SaveState class instead.
fih = h.FInitializeHandler(py_callable)
fih = h.FInitializeHandler(type, py_callable)
Install an initialization handler statement to be called during a call to finitialize(). The default type is 1.
Type 0 handlers are called before the mechanism INITIAL blocks.
Type 1 handlers are called after the mechanism INITIAL blocks. This is the best place to change state values.
Type 2 handlers are called just before return from finitialize. This is the best place to record values at t=0.
Type 3 handlers are called at the beginning of finitialize. At this point it is allowed to change the structure of the model.
See finitialize() for more details about the order of initialization processes within that function.
This class helps alleviate the administrative problems of maintaining variations of the proc Init.
Example:
# specify an example model from neuron import h, gui a = h.Section() b = h.Section() for sec in h.allsec(): sec.insert('hh') def fi0(): print 'fi0 called after v set but before INITIAL blocks' print ' a.v=%g a.m_hh=%g' % (a.v, a.m_hh) a.v = 10 def fi1(): print 'fi1() called after INITIAL blocks but before BREAKPOINT blocks' print ' or variable step initialization.' print ' Good place to change any states.' print ' a.v=%g a.m_hh=%g' % (a.v, a.m_hh) print ' b.v=%g b.m_hh=%g' % (b.v, b.m_hh) b.v = 10 def fi2(): print 'fi2() called after everything initialized. Just before return' print ' from finitialize.' print ' Good place to record or plot initial values' print ' a.v=%g a.m_hh=%g' % (a.v, a.m_hh) print ' b.v=%g b.m_hh=%g' % (b.v, b.m_hh) fih = [h.FInitializeHandler(0, fi0), h.FInitializeHandler(1, fi1), h.FInitializeHandler(2, fi2)] class Test: def __init__(self): self.fih = h.FInitializeHandler(self.p) def p(self): print 'inside %r.p()' % self test = Test() h.stdinit() fih[0].allprint()