Closed JonathanHammer2 closed 9 months ago
Both
sim_copy = copy.copy(sim)
and
sim_copy = sim.copy()
works for me. To look into it, I'd need to know which version of python and rebound you're using. I'd also need to have some code that I can run to reproduces the issue..
Well, sim.copy() seems to work. I will just use that until I hit the next obstacle!
Thanks, happy new year.
Jonathan Hammer Research Scientist [page1image55562928]
From: Hanno Rein @.> Date: Wednesday, December 27, 2023 at 12:37 PM To: hannorein/rebound @.> Cc: Jonathan Hammer @.>, Author @.> Subject: Re: [hannorein/rebound] Can't copy simulation in Python, wonder how to fix (Issue #736)
Both
sim_copy = copy.copy(sim)
and
sim_copy = sim.copy()
works for me. To look into it, I'd need to know which version of python and rebound you're using. I'd also need to have some code that I can run to reproduces the issue..
— Reply to this email directly, view it on GitHubhttps://github.com/hannorein/rebound/issues/736#issuecomment-1870502122, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AZYVNWIPRC7JEG5HOOCMW5LYLRMHDAVCNFSM6AAAAABBESYUK6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZQGUYDEMJSGI. You are receiving this because you authored the thread.Message ID: @.***>
Hello again,
I am trying to copy a "master" simulation in Python into a new, independent, "copy" simulation so that I can make changes to the states independent of the "master" without affecting it.
I tried copy and also "deepcopy" per the following:
and I get an error about "pickling," per below. I'm wondering if you have a straightforward solution to this.
Update: I see the self copy as in : sim_copy = sim.copy()
Will this allow me to manipulate sim_copy without affecting "sim?"
Thanks
Thanks!
Traceback (most recent call last): File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevd.py", line 1496, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/Users/cycloastro/PycharmProjects/Kalman Python Project/main.py", line 268, in
main()
File "/Users/cycloastro/PycharmProjects/Kalman Python Project/main.py", line 128, in main
sim_copy = copy.copy(sim)
File "/Users/cycloastro/anaconda3/envs/pythonProject1/lib/python3.10/copy.py", line 92, in copy
rv = reductor(4)
ValueError: ctypes objects containing pointers cannot be pickled