stimupy.stimuli.checkerboards#

Demos#

Functions#

checkerboard

Checkerboard assimilation effect

contrast_contrast

Contrast-contrast effect on checkerboard with square transparency layer

checkerboard(visual_size=None, ppd=None, shape=None, frequency=None, board_shape=None, check_visual_size=None, target_indices=(), extend_targets=False, period='ignore', rotation=0.0, intensity_checks=(0.0, 1.0), intensity_target=0.5, round_phase_width=True)[source]#

Checkerboard assimilation effect

High-contrast checkerboard, with intermediate targets embedded in it. Target brightness assimilates to direct surround, rather than contrast with it.

These kinds of checkerboard displays are described by De Valois & De Valois (1988), and the brightness effect of it by Blakeslee & McCourt (2004).

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

  • frequency (Sequence[Number, Number], Number, or None (default)) – frequency of checkerboard in [y, x] in cpd

  • board_shape (Sequence[Number, Number], Number, or None (default)) – number of checks in [height, width] of checkerboard

  • check_visual_size (Sequence[Number, Number], Number, or None (default)) – visual size of a single check [height, width] in degrees

  • target_indices (Sequence[(Number, Number),...], optional) – target indices (row, column of checkerboard), by default None

  • extend_targets (bool, optional) – if true, extends the targets by 1 check in all 4 directions, by default False

  • 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)

  • intensity_checks (Sequence[float, float]) – intensity values of checks, by default (0.0, 1.0)

  • round_phase_width (Bool) – if True, round width of bars given resolution (default: True)

Returns:

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

Return type:

dict[str, Any]

References

Blakeslee, B., & McCourt, M. E. (2004).

A unified theory of brightness contrast and assimilation incorporating oriented multiscale spatial filtering and contrast normalization. Vision Research, 44(21), 2483-2503. https://doi.org/10/fmcx5p

De Valois, R. L., & De Valois, K. K. (1988).

Spatial Vision. Oxford University Press.

contrast_contrast(visual_size=None, ppd=None, shape=None, frequency=None, board_shape=None, check_visual_size=None, target_shape=None, period='ignore', rotation=0.0, intensity_checks=(0.0, 1.0), tau=0.5, alpha=None, round_phase_width=True)[source]#

Contrast-contrast effect on checkerboard with square transparency layer

Checkerboard version of the contrast-contrast illusion (Chubb, Sperling, Solomon, 1989), as used by Domijan (2015).

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

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

  • visual_size (Sequence[Number, Number], Number, or None (default)) – visual size of the total board [height, width] in degrees

  • board_shape (Sequence[Number, Number], Number, or None (default)) – number of checks in [height, width] of checkerboard

  • check_visual_size (Sequence[Number, Number], Number, or None (default)) – visual size of a single check [height, width] in degrees

  • targets_shape (Sequence[Number, Number], Number, or None (default)) – number of checks with transparency in y, x direction

  • intensity_low (float, optional) – intensity value of the dark checks, by default 0.0

  • intensity_high (float, optional) – intensity value of the light checks, by default 1.0

  • tau (Number) – tau of transparency (i.e. value of transparent medium), default 0.5

  • alpha (Number or None (default)) – alpha of transparency (i.e. how transparent the medium is)

  • round_phase_width (Bool) – if True, round width of bars given resolution (default: True)

Returns:

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

Return type:

dict[str, Any]

References

Chubb, C., Sperling, G., & Solomon, J. A. (1989).

Texture interactions determine perceived contrast. Proc. Natl. Acad. Sci. USA, 5. https://doi.org/10.1073/pnas.86.23.9631

Domijan, D. (2015).

A Neurocomputational account of the role of contour facilitation in brightness perception. Frontiers in Human Neuroscience, 9(February), 1-16. https://doi.org/10/gh62x2