cddm.fft

FFT tools.

This module defines several functions for fft processing of multi-frame data.

Module Contents

cddm.fft.rfft2_crop(x, kimax=None, kjmax=None)

Crops rfft2 data.

Parameters
  • x (ndarray) – FFT2 data (as returned by np.rfft2 for instance). FFT2 must be over the last two axes.

  • kimax (int, optional) – Max k value over the first (-2) axis of the FFT.

  • kjmax (int, optional) – Max k value over the second (-1) axis of the FFT.

Returns

out – Cropped fft array.

Return type

ndarray

cddm.fft.rfft2(video, kimax=None, kjmax=None, overwrite_x=False, extra={})

A generator that performs rfft2 on a sequence of multi-frame data.

Shape of the output depends on kimax and kjmax. It is (2*kimax+1, kjmax +1), or same as the result of rfft2 if kimax and kjmax are not defined.

Parameters
  • video (iterable) – An iterable of multi-frame data

  • kimax (int, optional) – Max value of the wavenumber in vertical axis (i)

  • kjmax (int, optional) – Max value of the wavenumber in horizontal axis (j)

  • overwrite_x (bool, optional) – If input type is complex and fft library used is not numpy, fft can be performed inplace to speed up computation.

  • extra (dict) – Extra arguments passed to the underlying rfft2 cfunction. These arguments are library dependent. For pyffyw see the documentation on additional arguments for finer FFT control.

Returns

video – An iterator over FFT of the video.

Return type

iterator

cddm.fft.normalize_fft(video, inplace=False, dtype=None)

Normalizes each frame in fft video to the mean value (intensity) of the [0,0] component of fft.

Parameters
  • video (iterable) – Input multi-frame iterable object. Each element of the iterable is a tuple of ndarrays (frames)

  • inplace (bool, optional) – Whether tranformation is performed inplace or not.

  • dtype (numpy dtype) – If specifed, determines output dtype. Only valid if inplace == False.

Returns

video – A multi-frame iterator

Return type

iterator