Page 1 of 1

Hoc Object not pickable

Posted: Tue Jul 14, 2009 6:53 am
by mattions
Hi Forum,

I would like to know if there is any plan (or if it is possible) to make the hoc Object pickable, using cPickle.
This would give the possibilities to save a very complex model (vectors, sections and so on) and to reuse the model to reinvestigate the results or even continue the simulation.

consider this code:

Code: Select all

import cPickle
from neuron import h
sec = h.Section()
FILE = open("test", 'w')
cPickle.dump(sec, FILE,1)
If I try to execute this is the error that I get:

Code: Select all

/usr/lib/python2.6/copy_reg.pyc in _reduce_ex(self, proto)
     68     else:
     69         if base is self.__class__:
---> 70             raise TypeError, "can't pickle %s objects" % base.__name__
     71         state = base(self)
     72     args = (self.__class__, base, state)

TypeError: can't pickle Section objects
It's the same with the hoc object.

I'm using NEURON 7.0

Re: Hoc Object not pickable

Posted: Wed Jul 15, 2009 1:28 am
by hines
It should be doable. But to get all the details right would be a very tedious programming project
and would necessitate an understanding of the python pickle protocol. Due to SaveState, much
of the framework is possibly already in place. I don't have any present plans for implementing it.