Manipulating copied numpy array without changing the original
<p>I am trying to manipulate a numpy array that contains data stored in an other array. So far, when I change a value in my array, both of the arrays get values changed:</p>

<pre><code> import numpy as np
 from astropy.io import fits

 image = fits.getdata("randomImage.fits")
 fft = np.fft.fft2(image)
 fftMod = np.copy(fft)
 fftMod = fftMod*2
 if fftMod.all()== fft.all():
    print "shit same same same "

 -- &gt; shit same same same
</code></pre>

<p>Why is?</p>

<p>You misunderstood the usage of the .all() method. 
It yields True if all elements of an array are not 0. This seems to be the case in both your arrays or in neither of them. </p>

<p>Since one is the double of the other, they definetly give the same result to the .all() method (both True or both False)</p>

<p><strong>edit as requested in the comments:</strong>
To compare the content of the both arrays use element wise comparison first and check that all elements are True with .all:</p>

<pre><code>(fftMod == fft).all()
</code></pre>

<p>Or maybe better for floats including a certain tolerance:</p>

<pre><code>np.allclose(fftMod, fft)
</code></pre>

python arrays numpy