Modifying v_init

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

Moderator: hines

Modifying v_init

Postby bschneiders » Thu Mar 09, 2017 6:04 pm

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!
bschneiders
 
Posts: 5
Joined: Thu Feb 02, 2017 12:30 pm

Re: Modifying v_init

Postby ted » Thu Mar 09, 2017 11:52 pm

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
ted
Site Admin
 
Posts: 4968
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine

Re: Modifying v_init

Postby bschneiders » Fri Mar 10, 2017 12:02 pm

Setting h.v_init = -61 worked, thank you!
bschneiders
 
Posts: 5
Joined: Thu Feb 02, 2017 12:30 pm


Return to NEURON + Python

Who is online

Users browsing this forum: Google [Bot] and 2 guests