visigoth.stimuli.RandomDotColorMotion¶
- class visigoth.stimuli.RandomDotColorMotion(win, shape='square', size=0.05, density=16.7, speed=5, interval=3, lightness=60, chromacity=50, pos=(0, 0), aperture=5, elliptical=True)[source]¶
Bivalent random dot stimulus with color and motion dimensions.
To use this stimulus, you must alternate calls between
update
, which repositions and recolors the dots to achieved specified motion, anddraw
which shows the stimulus on the window. You must callupdate
on every screen refresh to get the expected motion characteristics.- __init__(win, shape='square', size=0.05, density=16.7, speed=5, interval=3, lightness=60, chromacity=50, pos=(0, 0), aperture=5, elliptical=True)[source]¶
Classical random dot motion stimulus with randomly colored dots.
Random color is generated similar to the random motion. On each frame, some proportion of the dots (the color coherence) are drawn in the same hue, while the hues for the others are chosen randomly from [0, 360]. All dots have the same lightness and chromacity. The colors are chosen using the CIECAM02 space. Note that colors are clipped to stay in the RGB gamut. This allows for relatively bright/saturated colors, but means that the circular distances colors as shown may not reflect the generating distribution.
- Parameters
- winPsychopy Window
Window object with additional attributes added by visigoth.
- shape“square” | “circle”
Shape of each dot.
- sizefloat
Size of each dot, in degrees.
- colorPsychopy color
Color of the dots, in [-1, 1] luminance or RGB.
- densityfloat
Dot density in dots per degrees per second.
- speedfloat
Speed of coherent motion, in degrees per second.
- intervalint
Coherently moving dots will be redrawn in a new position every
interval
frames.- lightnessfloat in [0, 100]
Lightness channel (J) shared by all dots.
- chromacityfloat in [0, 50]
Chromacity channel (C) shared by all dots.
- pospair of floats
The x, y coordinates of the center of the dot field, in degrees.
- aperturefloat or pair of floats
Size of the aperture. A single value can be given for a square / circular aperture. In the latter case, size is diameter.
- ellipticalbool
If true, aperture is elliptical (or circular). Dots can move coherently through the corners, but will not be shown.
Methods
__init__
(win[, shape, size, density, speed, …])Classical random dot motion stimulus with randomly colored dots.
draw
()Draw the Psychopy object to the window.
jch_to_psychopy_rgb
(jch)Convert JCh colors to RGB in [-1, 1].
reset
()Generate random starting positions for each set of dots.
update
(direction, motion_coherence, hue, …)Advance the dot animation one frame.