stimupy.components.edges#

Demos#

Functions#

step

Draw a central step edge

gaussian

Draw a central step edge with a Gaussian envelop

cornsweet

Draw rectangular Cornsweet edge stimulus.

step(visual_size=None, ppd=None, shape=None, rotation=0.0, intensity_edges=(0.0, 1.0))[source]#

Draw a central step edge

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

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

  • intensity_edges ((float, float)) – intensity values of edges (default: (0., 1.))

Returns:

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

Return type:

dict[str, Any]

gaussian(visual_size=None, ppd=None, shape=None, sigma=None, rotation=0.0, intensity_edges=(0.0, 1.0), intensity_background=0.5)[source]#

Draw a central step edge with a Gaussian envelop

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

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

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

  • intensity_edges ((float, float)) – intensity values of edges (default: (0., 1.))

  • intensity_background (float) – intensity value of background, by default 0.5

Returns:

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

Return type:

dict[str, Any]

cornsweet(visual_size=None, ppd=None, shape=None, ramp_width=None, rotation=0.0, intensity_edges=(0.0, 1.0), intensity_plateau=0.5, exponent=2.75)[source]#

Draw rectangular Cornsweet edge stimulus. The 2D luminance profile of the stimulus is defined as Left side: v = vtarget + (1 - X / w) ** a * (intensity_max-vtarget) for the ramp and v = vtarget beyond. Right side: v = vtarget - (1 - X / w) ** a * (intensity_min-vtarget) for the ramp and v = vtarget beyond. X is the distance to the edge, w is the width of the ramp, a is a variable determining the steepness of the ramp, vtarget is the luminance of the targets and intensity_max/intensity_min are the max/min luminances.

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

  • ramp_width (float) – width of luminance ramp in degrees of visual angle

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

  • intensity_edges ((float, float)) – intensity of edges

  • intensity_plateau (float) – intensity value of plateau

  • exponent (float) – determines steepness of ramp (default is 2.75. 1 would be linear)

Returns:

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

Return type:

dict[str, Any]

References

Boyaci, H., Fang, F., Murray, S.O., Kersten, D. (2007).

Responses to lightness variations in early human visual cortex. Current Biology 17, 989-993. https://doi.org/10.1016/j.cub.2007.05.005

Cornsweet, T. (1970).

Visual perception. Academic press. https://doi.org/10.1016/B978-0-12-189750-5.X5001-5