stimupy.stimuli.mondrians#

Demos#

Functions#

mondrian

Draw Mondrian of given size and intensity at given position

corrugated_mondrian

Corrugated Mondrian

mondrian(visual_size=None, ppd=None, shape=None, positions=None, sizes=None, intensities=None, intensity_background=0.5)[source]#

Draw Mondrian of given size and intensity at given position

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

  • positions (Sequence[tuple, ... ] or None (default)) – position (y, x) of each Mondrian in degrees visual angle

  • sizes (Sequence[tuple, ... ] or None (default)) – size (height, width, depth) of Mondrian parallelograms in degrees visual angle; if only one number is given, squares will be drawn

  • intensities (Sequence[Number, ... ] or None (default)) – intensity values of each Mondrian, if only one number is given all will have the same intensity

  • intensity_background (float) – intensity value of background

Returns:

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

Return type:

dict[str, Any]

corrugated_mondrian(visual_size=None, ppd=None, shape=None, nrows=None, ncols=None, depths=0, intensities=(0, 1), target_indices=(), intensity_background=0.5, intensity_target=None)[source]#

Corrugated Mondrian

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

  • depths (Sequence[Number, ... ], Number, or None (default)) – depth of Mondrian parallelograms per row

  • intensities (nested tuples) – intensities of mondrians; as many tuples as there are rows and as many numbers in each tuple as there are columns

  • target_indices (nested tuples) – indices of targets; as many tuples as there are targets with (y, x) indices

  • intensity_background (float) – intensity value for background

  • intensity_target (float) – target intensity. If None, use values defined in intensities

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

Adelson, E. H. (1993).

Perceptual organization and the judgment of brightness. Science, 262, 2042-2044. https://doi.org/10.1126/science.8266102