This is not really a support mailing list, it is intended for ideas about modifying the python language or its libraries.

However after a quick look, the line tt = arr2 is not creating a copy of array2. It creates a new name bound to the same underlying object, an alias if you will. You will need to use some sort of copy function (such as np.copy) if you want an independent array.

If you are interested in learning more, I suggest you look into how python implements variables. The FAQ (https://docs.python.org/3/faq/programming.html#why-did-changing-list-y-also-change-list-x) has some info on this. There are other sources (Fluent Python book comes to mind) that go into this in more detail.


--
Nate Lust, PhD.
Astrophysics Dept.
Princeton University