pulse2percept.utils.convolution¶
Functions
center_vector (vec, newlen) |
Returns the center newlen portion of a vector. |
conv (data, kernel[, mode, method]) |
Convoles data with a kernel using either FFT or sparse convolution |
-
pulse2percept.utils.convolution.
center_vector
(vec, newlen)[source]¶ Returns the center
newlen
portion of a vector.Adapted from
scipy.signal.signaltools._centered
: github.com/scipy/scipy/blob/v0.18.0/scipy/signal/signaltools.py#L236-L243
-
pulse2percept.utils.convolution.
conv
(data, kernel, mode='full', method='fft')[source]¶ Convoles data with a kernel using either FFT or sparse convolution
This function convolves data with a kernel, relying either on the fast Fourier transform (FFT) or a sparse convolution function.
Parameters: - data (array_like) – First input, typically the data array
- kernel (array_like) – Second input, typically the kernel
- mode (str {'full', 'valid', 'same'}, optional, default: 'full') –
A string indicating the size of the output:
full
:- The output is the full discrete linear convolution of the inputs.
valid
:- The output consists only of those elements that do not rely on zero-padding.
same
:- The output is the same size as
data
, centered with respect to the ‘full’ output.
- method (str {'fft', 'sparse'}, optional, default: 'fft') –
A string indicating the convolution method:
fft
:- Use the fast Fourier transform (FFT).
sparse
:- Use the sparse convolution.