neurotools.signal.conv module
Helper routines for convolutions, mostly related to padding.
- neurotools.signal.conv.reflect2D(data)[source]
Reflects 2D data for use with the discrete cosine transform.
- Parameters:
data (np.array) – data may have dimensions (H,W) or (H,W,N)
- Returns:
result – shape (2H,2W) array if data is 2D. shaoe (2H,2W,N) array if data is 3D.
- Return type:
np.array
- neurotools.signal.conv.reflect2D_1(data)[source]
Reflects 2D data, without doubling the data on the edge.
- Parameters:
data (np.array) – data may have dimensions (H,W) or (H,W,N)
- Returns:
result – shape (2H-2,2W-2) array if data is 2D. shaoe (2H-2,2W-2,N) array if data is 3D.
- Return type:
np.array
- neurotools.signal.conv.mirror2d(x)[source]
Mirror-pad a 2D signal to implement reflected boundary conditions for 2D convolution.
This function is obsolete and superseded by reflect2D().
- Parameters:
X (2D np.array) – Signal to pad
- neurotools.signal.conv.separable2d(X, k, k2=None)[source]
Convolve 2D signal X with two one-dimensional convolutions with kernel k.
This uses reflected boundary padding
- Parameters:
X (2D np.array) – Signal to convolve
k (1D np.array) – Convolution kernel
k2 (1D np.array) – Convolution kernel for the section array dimension, if X is not square or if different horizontal and vertical kernels are desired.
- Returns:
result – Convolved result
- Return type:
2D np.array