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.fft2_crop(x, kimax=None, kjmax=None)¶
Crops fft2 data.
- Parameters
x (ndarray) – FFT2 data (as returned by np.fft2 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(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.fft2_video(video, kimax=None, kjmax=None, overwrite_x=False, extra={})¶
A generator that performs fft2 on a sequence of multi-frame data.
Shape of the output depends on kimax and kjmax. It is (2*kimax+1, 2*kjmax+1,), or same as the result of fft2 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 fft2 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.dls(frame, window, kvec, kimax=None, kjmax=None)¶
Performs DLS-like imaging. You define the desired k-vector and the desired illumination shape (the window function). This function computes the Fourier transform, performs phase/amplitude modulation in the Fourier space and recontructs the image in real space. The phase/amplitude modulation is such that it filters only the defined frequency components with a spatial resolution determined by the window function.
- cddm.fft.dls_video(video, window, kvec, kimax=None, kjmax=None)¶
Same as dls, but for video objects
- 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