Class example

There are two classes in this module for performing convolution in the frequency domain with a fixed filter.

pydevtips.fftconvolve.RFFTConvolve(filt, length)

Real FFT convolve.

pydevtips.fftconvolve.FFTConvolve(filter, length)

General FFT convolve.

Both inherit from the base class pydevtips.fftconvolve.FFTConvolveBase, overwriting the abstract methods: pydevtips.fftconvolve.FFTConvolveBase._compute_filter_frequency_response() and pydevtips.fftconvolve.FFTConvolveBase.__call__().

RFFTConvolve

class pydevtips.fftconvolve.RFFTConvolve(filt, length)

Bases: FFTConvolveBase

Real FFT convolve.

__init__(filt, length)

Create convolver that uses a real-valued filter.

Parameters
  • filt (ndarray) – Filter to convolve with. Must be real.

  • length (int) – Length of the signal to convolve with.

__call__(signal)

Apply the real-valued filter to the signal, in the frequency domain.

Parameters

signal (ndarray) – Signal to convolve with. Must be real.

Returns

result – Convolved signal.

Return type

ndarray

FFTConvolve

class pydevtips.fftconvolve.FFTConvolve(filter, length)

Bases: FFTConvolveBase

General FFT convolve.

__init__(filter, length)

Create convolver that uses a fixed filter.

Parameters
  • filter (ndarray) – Filter to convolve with. Must be real.

  • length (int) – Length of the signal to convolve with.

__call__(signal)

Apply the filter to the signal, in the frequency domain.

Parameters

signal (ndarray) – Signal to convolve with.

Returns

result – Convolved signal.

Return type

ndarray

FFTConvolveBase

class pydevtips.fftconvolve.FFTConvolveBase(filt, length)

Bases: object

Abstract class for FFT convolve.

__init__(filt, length)

Base class for creating a convolver that uses the same filter.

Parameters
  • filt (ndarray) – Filter to convolve with. Must be real.

  • length (int) – Length of the signal to convolve with.

abstract _compute_filter_frequency_response()

Compute the filter frequency response.

Parameters

filter (ndarray) – Filter to compute the frequency response for.

Returns

filter_frequency_response – Filter frequency response.

Return type

ndarray

abstract __call__(signal)

Apply the filter to the signal, in the frequency domain.