nabu.misc.fourier_filters module¶
Fourier filters.
- nabu.misc.fourier_filters.get_lowpass_filter(img_shape, cutoff_par=None, use_rfft=False, data_type=<class 'numpy.float64'>)[source]¶
Computes a low pass filter using the erfc function.
- Parameters:
img_shape (tuple) – Shape of the image
cutoff_par (float or sequence of two floats) – Position of the cut off in pixels, if a sequence is given the second float expresses the width of the transition region which is given as a fraction of the cutoff frequency. When only one float is given for this argument a gaussian is applied whose sigma is the parameter. When a sequence of two numbers is given then the filter is 1 ( no filtering) till the cutoff frequency while a smooth erfc transition to zero is done
use_rfft (boolean, optional) – Creates a filter to be used with the result of a rfft type of Fourier transform. Defaults to False.
data_type (numpy.dtype, optional) – Specifies the data type of the computed filter. It defaults to numpy.float64
- Raises:
ValueError – In case of malformed cutoff_par
- Returns:
The computed filter
- Return type:
numpy.array_like
- nabu.misc.fourier_filters.get_highpass_filter(img_shape, cutoff_par=None, use_rfft=False, data_type=<class 'numpy.float64'>)[source]¶
Computes a high pass filter using the erfc function.
- Parameters:
img_shape (tuple) – Shape of the image
cutoff_par (float or sequence of two floats) – Position of the cut off in pixels, if a sequence is given the second float expresses the width of the transition region which is given as a fraction of the cutoff frequency. When only one float is given for this argument a gaussian is applied whose sigma is the parameter, and the result is subtracted from 1 to obtain the high pass filter When a sequence of two numbers is given then the filter is 1 ( no filtering) above the cutoff frequency and then a smooth transition to zero is done for smaller frequency
use_rfft (boolean, optional) – Creates a filter to be used with the result of a rfft type of Fourier transform. Defaults to False.
data_type (numpy.dtype, optional) – Specifies the data type of the computed filter. It defaults to numpy.float64
- Raises:
ValueError – In case of malformed cutoff_par
- Returns:
The computed filter
- Return type:
numpy.array_like
- nabu.misc.fourier_filters.get_bandpass_filter(img_shape, cutoff_lowpass=None, cutoff_highpass=None, use_rfft=False, data_type=<class 'numpy.float64'>)[source]¶
Computes a band pass filter using the erfc function.
The cutoff structures should be formed as follows:
tuple of two floats: the first indicates the cutoff frequency, the second determines the width of the transition region, as fraction of the cutoff frequency.
one float -> it represents the sigma of a gaussian which acts as a filter or anti-filter (1 - filter).
- Parameters:
img_shape (tuple) – Shape of the image
cutoff_lowpass (float or sequence of two floats) – Cutoff parameters for the low-pass filter
cutoff_highpass (float or sequence of two floats) – Cutoff parameters for the high-pass filter
use_rfft (boolean, optional) – Creates a filter to be used with the result of a rfft type of Fourier transform. Defaults to False.
data_type (numpy.dtype, optional) – Specifies the data type of the computed filter. It defaults to numpy.float64
- Raises:
ValueError – In case of malformed cutoff_par
- Returns:
The computed filter
- Return type:
numpy.array_like