Deepcopy of trajectory fails
Summary
When trying to use the python builtin deepcopy on a trajectory, a TypeError is thrown.
Steps to reproduce
from copy import deepcopy
from timor.utilities.trajectory import Trajectory
import numpy as np
q = np.random.rand(100)
t = np.arange(100)
traj = Trajectory(t, q)
deepcopy(traj)
Leads to:
Traceback (most recent call last):
File "/home/jonathan/miniconda3/envs/timor/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 3378, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-4-5a69bcbb121b>", line 1, in <module>
deepcopy(traj)
File "/home/jonathan/miniconda3/envs/timor/lib/python3.9/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/home/jonathan/miniconda3/envs/timor/lib/python3.9/copy.py", line 270, in _reconstruct
state = deepcopy(state, memo)
File "/home/jonathan/miniconda3/envs/timor/lib/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/home/jonathan/miniconda3/envs/timor/lib/python3.9/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/home/jonathan/miniconda3/envs/timor/lib/python3.9/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/home/jonathan/miniconda3/envs/timor/lib/python3.9/copy.py", line 279, in _reconstruct
y.__dict__.update(state)
TypeError: cannot convert dictionary update sequence element #0 to a sequence
What is the current bug behavior?
Deepcopy exits with error
What is the expected correct behavior?
Have a new trajectory object
Possible fixes
I don't know any at the moment
/cc @ga59peh