0
다른 배열에 저장된 데이터가 포함 된 numpy 배열을 조작하려고합니다. 지금까지 배열에서 값을 변경하면 두 배열에서 모두 값이 변경됩니다.원본을 변경하지 않고 복사 된 numpy 배열 조작
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 "
-- > shit same same same
왜입니까?
그래서 .all()을'fftMod' 및'fft'에서 제외하면 설정됩니다. – benten
아닙니다. 괄호를 변경해야합니다 : '(fftMod == fft) .all()' – dnalow
@dnalow 그것은 답변에 포함되어야하는 필수 요소입니다. –