You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that the copy argument of the Quantity is set to True by default. This argument is inherited from numpy. But this does not resolve the case where you have several nested dictionaries containing quantities and you need to copy it.
I think this happens, because quantities.Quantity does not define its own deepcopy method, but the one from numpy.ndarray is used (Quantity inherits from ndarray).
Monkey Patching Quantitiy like this:
Activity
lumbric commentedon Aug 27, 2013
This issue seems to be caused by numpy:
http://numpy-discussion.10968.n7.nabble.com/array-flags-not-copied-deepcopied-td31860.html
Note that the copy argument of the Quantity is set to True by default. This argument is inherited from numpy. But this does not resolve the case where you have several nested dictionaries containing quantities and you need to copy it.
xubuntix commentedon Feb 20, 2014
I think this happens, because quantities.Quantity does not define its own deepcopy method, but the one from numpy.ndarray is used (Quantity inherits from ndarray).
Monkey Patching Quantitiy like this:
seems to help.
add __deepcopy__ method for Quantity, fixes python-quantities#27
lumbric commentedon Mar 23, 2014
You are right. Ignore my last comment.
I added a pull request in #78.