Is it possible to save the status of the integration, or to get the integrator to go back in time and restart from a certain time?
What I would like to do is to advance neuron till a certain time (let's say t=4) and then have the possibility to go back to t=3 and restart again from there.
I'm trying to set up two different objects to do that, but no joy so far.
Consider this code:
Code: Select all
from neuron import h
h.load_file("stdrun.hoc")
h.finitialize()
h_status_at_time = {}
while h.t < h.tStop:
h.fadvance()
h_tmp_t = h.save_status(h.t) # Does this method exist?
h_status_at_time[h.t] = h_tmp_t
# Restart the simulation from my_time
h_from_my_time = h_status_at_time[my_time]
while h_from_my_time.t < h_from_my_time.tStop:
h.fadvance()
Code: Select all
from neuron import h
from copy import deepcopy
h2 = deepcopy(h)
h.load_file("stdrun.hoc")
h2.load_file("stdrun.hoc")
print h == h2 # print False
print h.tStop # print 5
print h2.tStop # print 5
h2.tStop = 6
print h2.tStop # print 6
#but
print h.tStop # print 6 as well!!
Thanks.