stimupy.utils.filters#

Functions#

convolve

Convolve two N-dimensional arrays using FFT

bandpass

Function to create a 2d bandpass filter in the frequency domain

convolve(arr1, arr2, mode='same', axes=None, padding=False)[source]#

Convolve two N-dimensional arrays using FFT

Parameters:
  • arr1 (numpy.ndarray) – Input array 1

  • arr2 (numpy.ndarray) – Input array 2

  • mode (str {"full", "valid", "same"}, optional) – String which indicates the size of the output. The default is “same”.

  • axes (int or None (default), optional) – Axes over which to convolve. The default is over all axes

  • padding (Bool) – if True, pad array before convolving

Returns:

out – Output array

Return type:

numpy.ndarray

bandpass(visual_size=None, ppd=None, shape=None, center_frequency=None, bandwidth=None)[source]#

Function to create a 2d bandpass filter in the frequency domain

Parameters:
  • visual_size (Sequence[Number, Number], Number, or None (default)) – visual size [height, width] of grating, in degrees

  • ppd (Sequence[Number, Number], Number, or None (default)) – pixels per degree [vertical, horizontal]

  • shape (Sequence[Number, Number], Number, or None (default)) – shape [height, width] of grating, in pixels

  • center_frequency (float) – center frequency of filter in cpd

  • bandwidth (float) – bandwidth of filter in octaves

Returns:

dict with the filter (key: “img”), and additional keys containing filter parameters

Return type:

dict[str, Any]