Modifying v_init

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
bschneiders
Posts: 34
Joined: Thu Feb 02, 2017 11:30 am

Modifying v_init

Post by bschneiders »

Hi all, I am having trouble setting v_init to something other than the default value before running a simulation. In Python, I tried the following:

h.finitialize(-61)
h.run()

but somehow the voltage still starts at -65. I then tried using the init() function (with "neuron." and with "h." prefixes, with and without finitialize()):

h.finitialize(-61)
neuron.init()
h.run()

which also didn't work. I also manually set the voltage of each section to -61 (i.e. "dend.v = -61), and every permutation of the above steps, but the voltage always starts from -65. Does anyone know how to truly change v_init? Any suggestions are appreciated!
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Modifying v_init

Post by ted »

Code: Select all

h.finitialize(-61)
h.run()
That's not going to do what you want, because h.run() << trigger warning . . . naked hoc syntax starts here >> calls stdinit() before it enters the main computational loop that executes a simulation.* stdinit() in turn calls init() (among other things), which calls finitialize(v_init). If you want to launch simulations in which the model is first initialized to something other than the default value of v_init (which is -65 mV), you must first change v_init. << you are now re-entering the world of Python >> (good, I thought we were going to get stuck).
Does anyone know how to truly change v_init?
Direct assignment works.
h.v_init = whatever you like

Then call h.run() and all will be well.

*--Why does run() call stdinit() before it calls continuerun(tstop)? Because it is often useful to run a series of simulations interactively, so it's convenient for run() to take care of initialization before the task of generating a solution begins. NEURON's initialization and standard run system is discussed in chapters 7 and 8 of The NEURON Book, but you can also learn a lot just by examining the contents of stdrun.hoc in nrn/share/nrn/lib/hoc
bschneiders
Posts: 34
Joined: Thu Feb 02, 2017 11:30 am

Re: Modifying v_init

Post by bschneiders »

Setting h.v_init = -61 worked, thank you!
Post Reply