arrayfire.signal module

Signal processing functions (fft, convolve, etc).

arrayfire.signal.approx1(signal, x, method=<INTERP.LINEAR: 1>, off_grid=0.0, xp=None, output=None)[source]

Interpolate along a single dimension.Interpolation is performed along axis 0 of the input array.

Parameters
signal: af.Array

Input signal array (signal = f(x))

x: af.Array

The x-coordinates of the interpolation points. The interpolation function is queried at these set of points.

method: optional: af.INTERP. default: af.INTERP.LINEAR.

Interpolation method.

off_grid: optional: scalar. default: 0.0.

The value used for positions outside the range.

xpaf.Array

The x-coordinates of the input data points

output: None or af.Array

Optional preallocated output array. If it is a sub-array of an existing af_array, only the corresponding portion of the af_array will be overwritten

Returns
output: af.Array

Values calculated at interpolation points.

arrayfire.signal.approx1_uniform(signal, x, interp_dim, idx_start, idx_step, method=<INTERP.LINEAR: 1>, off_grid=0.0, output=None)[source]

Interpolation on one dimensional signals along specified dimension.

af_approx1_uniform() accepts the dimension to perform the interpolation along the input. It also accepts start and step values which define the uniform range of corresponding indices.

Parameters
signal: af.Array

Input signal array (signal = f(x))

x: af.Array

The x-coordinates of the interpolation points. The interpolation function is queried at these set of points.

interp_dim: scalar

is the dimension to perform interpolation across.

idx_start: scalar

is the first index value along interp_dim.

idx_step: scalar

is the uniform spacing value between subsequent indices along interp_dim.

method: optional: af.INTERP. default: af.INTERP.LINEAR.

Interpolation method.

off_grid: optional: scalar. default: 0.0.

The value used for positions outside the range.

output: None or af.Array

Optional preallocated output array. If it is a sub-array of an existing af_array, only the corresponding portion of the af_array will be overwritten

Returns
output: af.Array

Values calculated at interpolation points.

arrayfire.signal.approx2(signal, x, y, method=<INTERP.LINEAR: 1>, off_grid=0.0, xp=None, yp=None, output=None)[source]

Interpolate along a two dimension.Interpolation is performed along axes 0 and 1 of the input array.

Parameters
signal: af.Array

Input signal array (signal = f(x, y))

xaf.Array

The x-coordinates of the interpolation points. The interpolation function is queried at these set of points.

yaf.Array

The y-coordinates of the interpolation points. The interpolation function is queried at these set of points.

method: optional: af.INTERP. default: af.INTERP.LINEAR.

Interpolation method.

off_grid: optional: scalar. default: 0.0.

The value used for positions outside the range.

xpaf.Array

The x-coordinates of the input data points. The convention followed is that the x-coordinates vary along axis 0

ypaf.Array

The y-coordinates of the input data points. The convention followed is that the y-coordinates vary along axis 1

output: None or af.Array

Optional preallocated output array. If it is a sub-array of an existing af_array, only the corresponding portion of the af_array will be overwritten

Returns
output: af.Array

Values calculated at interpolation points.

arrayfire.signal.approx2_uniform(signal, pos0, interp_dim0, idx_start0, idx_step0, pos1, interp_dim1, idx_start1, idx_step1, method=<INTERP.LINEAR: 1>, off_grid=0.0, output=None)[source]

Interpolate along two uniformly spaced dimensions of the input array. af_approx2_uniform() accepts two dimensions to perform the interpolation along the input. It also accepts start and step values which define the uniform range of corresponding indices.

Parameters
signal: af.Array

Input signal array (signal = f(x, y))

pos0af.Array

positions of the interpolation points along interp_dim0.

interp_dim0: scalar

is the first dimension to perform interpolation across.

idx_start0: scalar

is the first index value along interp_dim0.

idx_step0: scalar

is the uniform spacing value between subsequent indices along interp_dim0.

pos1af.Array

positions of the interpolation points along interp_dim1.

interp_dim1: scalar

is the second dimension to perform interpolation across.

idx_start1: scalar

is the first index value along interp_dim1.

idx_step1: scalar

is the uniform spacing value between subsequent indices along interp_dim1.

method: optional: af.INTERP. default: af.INTERP.LINEAR.

Interpolation method.

off_grid: optional: scalar. default: 0.0.

The value used for positions outside the range.

output: None or af.Array

Optional preallocated output array. If it is a sub-array of an existing af_array, only the corresponding portion of the af_array will be overwritten

Returns
output: af.Array

Values calculated at interpolation points.

arrayfire.signal.convolve(signal, kernel, conv_mode=<CONV_MODE.DEFAULT: 0>, conv_domain=<CONV_DOMAIN.AUTO: 0>)[source]

Non batched Convolution.

This function performs n-dimensional convolution based on input dimensionality.

Parameters
signal: af.Array
  • An n-dimensional array.

kernel: af.Array
  • A n-dimensional kernel.

conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.
  • Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

conv_domain: optional: af.CONV_DOMAIN. default: af.CONV_DOMAIN.AUTO.
  • Specifies the domain in which convolution is performed.

  • af.CONV_DOMAIN.SPATIAL: Performs convolution in spatial domain.

  • af.CONV_DOMAIN.FREQ: Performs convolution in frequency domain.

  • af.CONV_DOMAIN.AUTO: Switches between spatial and frequency based on input size.

Returns
output: af.Array
  • Output of n-dimensional convolution.

arrayfire.signal.convolve1(signal, kernel, conv_mode=<CONV_MODE.DEFAULT: 0>, conv_domain=<CONV_DOMAIN.AUTO: 0>)[source]

Convolution: 1D

Parameters
signal: af.Array
  • A 1 dimensional signal or batch of 1 dimensional signals.

kernel: af.Array
  • A 1 dimensional kernel or batch of 1 dimensional kernels.

conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.
  • Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

conv_domain: optional: af.CONV_DOMAIN. default: af.CONV_DOMAIN.AUTO.
  • Specifies the domain in which convolution is performed.

  • af.CONV_DOMAIN.SPATIAL: Performs convolution in spatial domain.

  • af.CONV_DOMAIN.FREQ: Performs convolution in frequency domain.

  • af.CONV_DOMAIN.AUTO: Switches between spatial and frequency based on input size.

Returns
output: af.Array
  • Output of 1D convolution.

arrayfire.signal.convolve2(signal, kernel, conv_mode=<CONV_MODE.DEFAULT: 0>, conv_domain=<CONV_DOMAIN.AUTO: 0>)[source]

Convolution: 2D

Parameters
signal: af.Array
  • A 2 dimensional signal or batch of 2 dimensional signals.

kernel: af.Array
  • A 2 dimensional kernel or batch of 2 dimensional kernels.

conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.
  • Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

conv_domain: optional: af.CONV_DOMAIN. default: af.CONV_DOMAIN.AUTO.
  • Specifies the domain in which convolution is performed.

  • af.CONV_DOMAIN.SPATIAL: Performs convolution in spatial domain.

  • af.CONV_DOMAIN.FREQ: Performs convolution in frequency domain.

  • af.CONV_DOMAIN.AUTO: Switches between spatial and frequency based on input size.

Returns
output: af.Array
  • Output of 2D convolution.

arrayfire.signal.convolve2NN(signal, kernel, stride=(1, 1), padding=(0, 0), dilation=(1, 1))[source]

This version of convolution is consistent with the machine learning formulation that will spatially convolve a filter on 2-dimensions against a signal. Multiple signals and filters can be batched against each other. Furthermore, the signals and filters can be multi-dimensional however their dimensions must match.

Example:

Signals with dimensions: d0 x d1 x d2 x Ns Filters with dimensions: d0 x d1 x d2 x Nf

Resulting Convolution: d0 x d1 x Nf x Ns

Parameters
signal: af.Array
  • A 2 dimensional signal or batch of 2 dimensional signals.

kernel: af.Array
  • A 2 dimensional kernel or batch of 2 dimensional kernels.

stride: tuple of ints. default: (1, 1).
  • Specifies how much to stride along each dimension

padding: tuple of ints. default: (0, 0).
  • Specifies signal padding along each dimension

dilation: tuple of ints. default: (1, 1).
  • Specifies how much to dilate kernel along each dimension before convolution

Returns
output: af.Array
  • Convolved 2D array.

arrayfire.signal.convolve2_separable(col_kernel, row_kernel, signal, conv_mode=<CONV_MODE.DEFAULT: 0>)[source]

Convolution: 2D separable convolution

Parameters
col_kernel: af.Array
  • A column vector to be applied along each column of signal

row_kernel: af.Array
  • A row vector to be applied along each row of signal

signal: af.Array
  • A 2 dimensional signal or batch of 2 dimensional signals.

conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.
  • Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

Returns
——–
output: af.Array
  • Output of 2D sepearable convolution.

arrayfire.signal.convolve3(signal, kernel, conv_mode=<CONV_MODE.DEFAULT: 0>, conv_domain=<CONV_DOMAIN.AUTO: 0>)[source]

Convolution: 3D

Parameters
signal: af.Array
  • A 3 dimensional signal or batch of 3 dimensional signals.

kernel: af.Array
  • A 3 dimensional kernel or batch of 3 dimensional kernels.

conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.
  • Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

conv_domain: optional: af.CONV_DOMAIN. default: af.CONV_DOMAIN.AUTO.
  • Specifies the domain in which convolution is performed.

  • af.CONV_DOMAIN.SPATIAL: Performs convolution in spatial domain.

  • af.CONV_DOMAIN.FREQ: Performs convolution in frequency domain.

  • af.CONV_DOMAIN.AUTO: Switches between spatial and frequency based on input size.

Returns
output: af.Array
  • Output of 3D convolution.

arrayfire.signal.dft(signal, odims=(None, None, None, None), scale=None)[source]

Non batched Fourier transform.

This function performs n-dimensional fourier transform depending on the input dimensions.

Parameters
signal: af.Array
  • A multi dimensional arrayfire array.

odims: optional: tuple of ints. default: (None, None, None, None).
  • If None, calculated to be signal.dims()

scale: optional: scalar. default: None.
  • Scale factor for the fourier transform.

  • If none, calculated to be 1.0.

Returns
output: af.Array
  • A complex array that is the ouput of n-dimensional fourier transform.

arrayfire.signal.fft(signal, dim0=None, scale=None)[source]

Fast Fourier Transform: 1D

Parameters
signal: af.Array

A 1 dimensional signal or a batch of 1 dimensional signals.

dim0: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim0 is calculated to be the first dimension of signal.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.

Returns
output: af.Array

A complex af.Array containing the full output of the fft.

arrayfire.signal.fft2(signal, dim0=None, dim1=None, scale=None)[source]

Fast Fourier Transform: 2D

Parameters
signal: af.Array

A 2 dimensional signal or a batch of 2 dimensional signals.

dim0: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim0 is calculated to be the first dimension of signal.

dim1: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim1 is calculated to be the second dimension of signal.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.

Returns
output: af.Array

A complex af.Array containing the full output of the fft.

arrayfire.signal.fft2_c2r(signal, is_odd=False, scale=None)[source]

Real to Complex Fast Fourier Transform: 2D

Parameters
signal: af.Array

A 2 dimensional signal or a batch of 2 dimensional signals.

is_odd: optional: Boolean. default: False.
  • Specifies if the first dimension of output should be even or odd.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1 / (signal.dims()[0] * signal.dims()[1]).

Returns
output: af.Array

A real af.Array containing the full output of the fft.

arrayfire.signal.fft2_inplace(signal, scale=None)[source]

In-place Fast Fourier Transform: 2D

Parameters
signal: af.Array

A 2 dimensional signal or a batch of 2 dimensional signals.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.

arrayfire.signal.fft2_r2c(signal, dim0=None, dim1=None, scale=None)[source]

Real to Complex Fast Fourier Transform: 2D

Parameters
signal: af.Array

A 2 dimensional signal or a batch of 2 dimensional signals.

dim0: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim0 is calculated to be the first dimension of signal.

dim1: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim1 is calculated to be the second dimension of signal.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.

Returns
output: af.Array

A complex af.Array containing the non-redundant parts of the full FFT.

arrayfire.signal.fft3(signal, dim0=None, dim1=None, dim2=None, scale=None)[source]

Fast Fourier Transform: 3D

Parameters
signal: af.Array

A 3 dimensional signal or a batch of 3 dimensional signals.

dim0: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim0 is calculated to be the first dimension of signal.

dim1: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim1 is calculated to be the second dimension of signal.

dim2: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim2 is calculated to be the third dimension of signal.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.

Returns
output: af.Array

A complex af.Array containing the full output of the fft.

arrayfire.signal.fft3_c2r(signal, is_odd=False, scale=None)[source]

Real to Complex Fast Fourier Transform: 3D

Parameters
signal: af.Array

A 3 dimensional signal or a batch of 3 dimensional signals.

is_odd: optional: Boolean. default: False.
  • Specifies if the first dimension of output should be even or odd.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1 / (signal.dims()[0] * signal.dims()[1] * signal.dims()[2]).

Returns
output: af.Array

A real af.Array containing the full output of the fft.

arrayfire.signal.fft3_inplace(signal, scale=None)[source]

In-place Fast Fourier Transform: 3D

Parameters
signal: af.Array

A 3 dimensional signal or a batch of 3 dimensional signals.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.

arrayfire.signal.fft3_r2c(signal, dim0=None, dim1=None, dim2=None, scale=None)[source]

Real to Complex Fast Fourier Transform: 3D

Parameters
signal: af.Array

A 3 dimensional signal or a batch of 3 dimensional signals.

dim0: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim0 is calculated to be the first dimension of signal.

dim1: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim1 is calculated to be the second dimension of signal.

dim2: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim2 is calculated to be the third dimension of signal.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.

Returns
output: af.Array

A complex af.Array containing the non-redundant parts of the full FFT.

arrayfire.signal.fft_c2r(signal, is_odd=False, scale=None)[source]

Real to Complex Fast Fourier Transform: 1D

Parameters
signal: af.Array

A 1 dimensional signal or a batch of 1 dimensional signals.

is_odd: optional: Boolean. default: False.
  • Specifies if the first dimension of output should be even or odd.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1 / (signal.dims()[0]).

Returns
output: af.Array

A real af.Array containing the full output of the fft.

arrayfire.signal.fft_convolve(signal, kernel, conv_mode=<CONV_MODE.DEFAULT: 0>)[source]

Non batched FFT Convolution.

This function performs n-dimensional convolution based on input dimensionality.

Parameters
signal: af.Array
  • An n-dimensional array.

kernel: af.Array
  • A n-dimensional kernel.

conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.
  • Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

Returns
output: af.Array
  • Output of n-dimensional convolution.

arrayfire.signal.fft_convolve1(signal, kernel, conv_mode=<CONV_MODE.DEFAULT: 0>)[source]

FFT based Convolution: 1D

Parameters
signal: af.Array
  • A 1 dimensional signal or batch of 1 dimensional signals.

kernel: af.Array
  • A 1 dimensional kernel or batch of 1 dimensional kernels.

conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.
  • Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

Returns
output: af.Array
  • Output of 1D convolution.

arrayfire.signal.fft_convolve2(signal, kernel, conv_mode=<CONV_MODE.DEFAULT: 0>)[source]

FFT based Convolution: 2D

Parameters
signal: af.Array
  • A 2 dimensional signal or batch of 2 dimensional signals.

kernel: af.Array
  • A 2 dimensional kernel or batch of 2 dimensional kernels.

conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.
  • Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

Returns
output: af.Array
  • Output of 2D convolution.

arrayfire.signal.fft_convolve3(signal, kernel, conv_mode=<CONV_MODE.DEFAULT: 0>)[source]

FFT based Convolution: 3D

Parameters
signal: af.Array
  • A 3 dimensional signal or batch of 3 dimensional signals.

kernel: af.Array
  • A 3 dimensional kernel or batch of 3 dimensional kernels.

conv_mode: optional: af.CONV_MODE. default: af.CONV_MODE.DEFAULT.
  • Specifies if the output does full convolution (af.CONV_MODE.EXPAND) or maintains the same size as input (af.CONV_MODE.DEFAULT).

Returns
output: af.Array
  • Output of 3D convolution.

arrayfire.signal.fft_inplace(signal, scale=None)[source]

In-place Fast Fourier Transform: 1D

Parameters
signal: af.Array

A 1 dimensional signal or a batch of 1 dimensional signals.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.

arrayfire.signal.fft_r2c(signal, dim0=None, scale=None)[source]

Real to Complex Fast Fourier Transform: 1D

Parameters
signal: af.Array

A 1 dimensional signal or a batch of 1 dimensional signals.

dim0: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim0 is calculated to be the first dimension of signal.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.

Returns
output: af.Array

A complex af.Array containing the non-redundant parts of the full FFT.

arrayfire.signal.fir(B, X)[source]

Finite impulse response filter.

Parameters
Baf.Array

A 1 dimensional array containing the coefficients of the filter.

Xaf.Array

A 1 dimensional array containing the signal.

Returns
Yaf.Array

The output of the filter.

arrayfire.signal.idft(signal, scale=None, odims=(None, None, None, None))[source]

Non batched Inverse Fourier transform.

This function performs n-dimensional inverse fourier transform depending on the input dimensions.

Parameters
signal: af.Array
  • A multi dimensional arrayfire array.

odims: optional: tuple of ints. default: (None, None, None, None).
  • If None, calculated to be signal.dims()

scale: optional: scalar. default: None.
  • Scale factor for the fourier transform.

  • If none, calculated to be 1.0 / signal.elements()

Returns
output: af.Array
  • A complex array that is the ouput of n-dimensional inverse fourier transform.

arrayfire.signal.ifft(signal, dim0=None, scale=None)[source]

Inverse Fast Fourier Transform: 1D

Parameters
signal: af.Array

A 1 dimensional signal or a batch of 1 dimensional signals.

dim0: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim0 is calculated to be the first dimension of signal.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.0 / (dim0)

Returns
output: af.Array

A complex af.Array containing the full output of the inverse fft.

arrayfire.signal.ifft2(signal, dim0=None, dim1=None, scale=None)[source]

Inverse Fast Fourier Transform: 2D

Parameters
signal: af.Array

A 2 dimensional signal or a batch of 2 dimensional signals.

dim0: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim0 is calculated to be the first dimension of signal.

dim1: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim1 is calculated to be the second dimension of signal.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.0 / (dim0 * dim1)

Returns
output: af.Array

A complex af.Array containing the full output of the inverse fft.

arrayfire.signal.ifft2_inplace(signal, scale=None)[source]

Inverse In-place Fast Fourier Transform: 2D

Parameters
signal: af.Array

A 2 dimensional signal or a batch of 2 dimensional signals.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.0 / (signal.dims()[0] * signal.dims()[1])

arrayfire.signal.ifft3(signal, dim0=None, dim1=None, dim2=None, scale=None)[source]

Inverse Fast Fourier Transform: 3D

Parameters
signal: af.Array

A 3 dimensional signal or a batch of 3 dimensional signals.

dim0: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim0 is calculated to be the first dimension of signal.

dim1: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim1 is calculated to be the second dimension of signal.

dim2: optional: int. default: None.
  • Specifies the size of the output.

  • If None, dim2 is calculated to be the third dimension of signal.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.0 / (dim0 * dim1 * dim2).

Returns
output: af.Array

A complex af.Array containing the full output of the inverse fft.

arrayfire.signal.ifft3_inplace(signal, scale=None)[source]

Inverse In-place Fast Fourier Transform: 3D

Parameters
signal: af.Array

A 3 dimensional signal or a batch of 3 dimensional signals.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.0 / (signal.dims()[0] * signal.dims()[1] * signal.dims()[2]).

arrayfire.signal.ifft_inplace(signal, scale=None)[source]

Inverse In-place Fast Fourier Transform: 1D

Parameters
signal: af.Array

A 1 dimensional signal or a batch of 1 dimensional signals.

scale: optional: scalar. default: None.
  • Specifies the scaling factor.

  • If None, scale is set to 1.0 / (signal.dims()[0])

arrayfire.signal.iir(B, A, X)[source]

Infinite impulse response filter.

Parameters
Baf.Array

A 1 dimensional array containing the feed forward coefficients of the filter.

Aaf.Array

A 1 dimensional array containing the feed back coefficients of the filter.

Xaf.Array

A 1 dimensional array containing the signal.

Returns
Yaf.Array

The output of the filter.

arrayfire.signal.medfilt(signal, w0=3, w1=3, edge_pad=<PAD.ZERO: 0>)[source]

Apply median filter for the signal.

Parameters
signalaf.Array
  • A 2 D arrayfire array representing a signal, or

  • A multi dimensional array representing batch of signals.

w0optional: int. default: 3.
  • The length of the filter along the first dimension.

w1optional: int. default: 3.
  • The length of the filter along the second dimension.

edge_padoptional: af.PAD. default: af.PAD.ZERO
  • Flag specifying how the median at the edge should be treated.

Returns
outputaf.Array
  • The signal after median filter is applied.

arrayfire.signal.medfilt1(signal, length=3, edge_pad=<PAD.ZERO: 0>)[source]

Apply median filter for the signal.

Parameters
signalaf.Array
  • A 1 D arrayfire array representing a signal, or

  • A multi dimensional array representing batch of signals.

lengthoptional: int. default: 3.
  • The length of the filter.

edge_padoptional: af.PAD. default: af.PAD.ZERO
  • Flag specifying how the median at the edge should be treated.

Returns
outputaf.Array
  • The signal after median filter is applied.

arrayfire.signal.medfilt2(signal, w0=3, w1=3, edge_pad=<PAD.ZERO: 0>)[source]

Apply median filter for the signal.

Parameters
signalaf.Array
  • A 2 D arrayfire array representing a signal, or

  • A multi dimensional array representing batch of signals.

w0optional: int. default: 3.
  • The length of the filter along the first dimension.

w1optional: int. default: 3.
  • The length of the filter along the second dimension.

edge_padoptional: af.PAD. default: af.PAD.ZERO
  • Flag specifying how the median at the edge should be treated.

Returns
outputaf.Array
  • The signal after median filter is applied.

arrayfire.signal.set_fft_plan_cache_size(cache_size)[source]

Sets plan cache size.

Parameters
cache_sizescalar

the number of plans that shall be cached