def zoomFourier(arr, factor, use_abs=False): shape = N.array(arr.shape) target = [int(s) for s in shape * factor] #target[-1] //= 2 #target[-1] += 1 af = F.fft(arr) ap = paddingFourier(af, target) afp = F.ifft(ap) factor = target / shape if use_abs: return N.abs(afp) * N.product(factor) else: return N.real(afp) * N.product(factor)
def shiftFullFFT(arr, delta=None): """ returns new array: arr shifted by delta (tuple) it uses fft (not rfft), multiplying with "shift array", ifft delta defaults to half of arr.shape """ shape = arr.shape if delta is None: delta = N.array(shape) / 2. elif not hasattr(delta, '__len__'): delta = (delta,)*len(shape) elif len(shape) != len(delta): raise ValueError("shape and delta not same dimension") return F.ifft(F.fourierShiftArr(shape, delta) * F.fft(arr))
def shiftFullFFT(arr, delta=None): """ returns new array: arr shifted by delta (tuple) it uses fft (not rfft), multiplying with "shift array", ifft delta defaults to half of arr.shape """ shape = arr.shape if delta is None: delta = N.array(shape) / 2. elif not hasattr(delta, '__len__'): delta = (delta, ) * len(shape) elif len(shape) != len(delta): raise ValueError("shape and delta not same dimension") return F.ifft(F.fourierShiftArr(shape, delta) * F.fft(arr))