Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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))
Ejemplo n.º 4
0
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))