def shiftZ(af): """ af: 3D array in fourier space return Z shifted array """ nz = af.shape[0] cz = nz // 2 bf = N.empty_like(af) bf[cz:] = af[:(nz - cz)] bf[:(nz - cz)] = af[cz:] return bf
def arr_invert(arr): canvas = N.empty_like(arr) canvas[:] = U.max(arr) return canvas - arr