gabor#

gabor stimulus example

You can find an interactive version of this example here

stimupy.stimuli.gabors.gabor(visual_size=None, ppd=None, shape=None, frequency=None, n_bars=None, bar_width=None, period='ignore', rotation=0.0, phase_shift=0, intensities=(0.0, 1.0), origin='center', round_phase_width=False, sigma=None)#

Draw a Gabor: a sinewave grating in a Gaussian envelope

Parameters:
  • visual_size (Sequence[Number, Number], Number, or None (default)) – visual size [height, width] of image, 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 image, in pixels

  • frequency (Number, or None (default)) – spatial frequency of grating, in cycles per degree visual angle

  • n_bars (Number, or None (default)) – number of bars in the grating

  • bar_width (Number, or None (default)) – width of a single bar, in degrees visual angle

  • sigma (float or (float, float)) – sigma of Gaussian in degree visual angle (y, x)

  • period ("even", "odd", "either" or "ignore" (default)) – ensure whether the grating has “even” number of phases, “odd” number of phases, either or whether not to round the number of phases (“ignore”)

  • rotation (float, optional) – rotation (in degrees), counterclockwise, by default 0.0 (horizontal)

  • phase_shift (float) – phase shift of grating in degrees

  • intensities (Sequence[float, ...]) – maximal intensity value for each bar, by default (0.0, 1.0).

  • origin ("corner", "mean" or "center") – if “corner”: set origin to upper left corner if “mean”: set origin to hypothetical image center (default) if “center”: set origin to real center (closest existing value to mean)

Returns:

dict with the stimulus (key: “img”), mask with integer index for each bar (key: “grating_mask”), and additional keys containing stimulus parameters

Return type:

dict[str, Any]