Page 1 of 1

How to use a fixed time-step in Python?

Posted: Thu Mar 14, 2019 5:59 pm
by Yaeger
How do you use a run method with a fixed time-step in python?

Re: How to use a fixed time-step in Python?

Posted: Fri Mar 15, 2019 11:06 am
by ted
I like to use NEURON's own standard run library, instead of trying to reinvent it in Python. Also, even though I may be using NEURON as a Python module, I still like to use NEURON's GUI tools for model development and debugging. Consequently, my scripts typically start with

Code: Select all

from neuron import h, gui
Importing NEURON's gui module loads the standard run library and automatically brings up the NEURON Main Menu toolbar. If I don't want to see the toolbar, I start with these two lines instead

Code: Select all

from neuron import h
h.load_file("stdgui.hoc") # doesn't bring up the NEURON Main Menu toolbar
Then, after my model specification, instrumentation, and simulation flow control code has been executed, I can

Code: Select all

h.dt = whatever_time_step_I_want
h.tstop = whatever_simulation_duration_I_want
h.run() # execute a simulation with my specified time step and simulation duration

Re: How to use a fixed time-step in Python?

Posted: Fri Mar 15, 2019 6:20 pm
by Yaeger
Thank you Ted!