The object is a Python built Agent, which is a population of neurons with several cells of different types, synapses, and outputs, with some current states, several described with mod files.
It seemed to me very natural to use a
Code: Select all
new_agent = copy.deepcopy(agent)
Code: Select all
copy
UNFORTUNATELY, this all ends up with (only last lines copied here)
Deas it mean that it is not possible to copy whole nrn objects??? I DO NOT want to pickle and serialize the object here for saving it, but only to have a full copy in memory, that would be working, if selected later.File "/Users/igor/anaconda3/envs/pytorch/lib/python3.7/copy.py", line 280, in _reconstruct
state = deepcopy(state, memo)
File "/Users/igor/anaconda3/envs/pytorch/lib/python3.7/copy.py", line 150, in deepcopy
y = copier(x, memo)
File "/Users/igor/anaconda3/envs/pytorch/lib/python3.7/copy.py", line 240, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/Users/igor/anaconda3/envs/pytorch/lib/python3.7/copy.py", line 169, in deepcopy
rv = reductor(4)
TypeError: can't pickle nrn.Segment objects
Does any of you know the answer? I would be most grateful in these times of the virus plague... Hope you are well.
/igor
BTW, is there any other thread on the NEURON blog that this post should be put into?