PyGaze - documentation - libgazecon
The gaze contingent library is used for easy implementation of all sorts of cool paradigms that respond to the gaze position of the observer.
contents
FRLFRL.get_pos
FRL.update
Cursor
Cursor.update
AOI
AOI.contains
FRL
Gaze contingent Forced Retinal Location (FRL): a cutout in which the display is visible that moves along with the gaze position, while the rest of the display is obscured
arguments | |
---|---|
display | a libscreen.Display object |
keyword arguments | |
disptype | display type, either 'psychopy' or 'pygame' (default = DISPTYPE) |
pos | a string indicating the FRL position in relation to gaze position; allowed are 'center', 'top', 'topright', 'right', 'bottomright', 'bottom', 'bottomleft', 'left', 'topleft' (default = FRLPOS) |
dist | distance between gaze position and FRL center in pixels (default = FRLDIST) |
size | FRL diameter in pixels |
Returns a FRL position tuple, based on gaze position; for internal use
arguments | |
---|---|
gazepos | a (x,y) gaze position tuple |
keyword arguments | |
None | |
returns | |
frlpos | a (x,y) position tuple, indicating the FRL center coordinate |
Updates display with FRL, showing part of stimscreen (depending on gazepos) and backgroundcolour everywhere else
arguments | |
---|---|
display | a libscreen.Display object |
stimscreen | a libscreen.Screen object containing the stimuli that are to be presented |
gazepos | current gaze position (a (x,y) tuple) |
keyword arguments | |
None | |
returns | |
disptime | directly updates display and returns refresh time (PsychoPy) or an estimate (PyGame) |
Cursor
Gaze contingent cursor: a cursor that remains on the gaze position of an observer
arguments | |
---|---|
None | |
keyword arguments | |
disptype | string indicating which display type is used; should be either 'pygame' or 'psychopy' (default = DISPTYPE) |
ctype | string indicating the cursor type; should be one of the following: 'rectangle', 'ellipse', 'plus', 'cross' or 'arrow' (default = CURSORTYPE) |
size | cursor size in pixels (default = CURSORSIZE) |
colour | colour for the cursor (a colour name (e.g. 'red') or a RGB(A) tuple (e.g. (255,0,0) or (255,0,0,255))) (default = CURSORCOLOUR) |
pw | cursor line thickness in pixels (default = CURSORPENWIDTH) |
fill | Boolean indicating if cursor should be filled or not; only applies for cursortypes with a body, e.g. 'rectangle' (default = CURSORFILL) |
Adds the cursor to specified screen; does NOT directly update the display
arguments | |
---|---|
screen | a libscreen.Screen object |
gazepos | current gaze position (a (x,y) tuple) |
keyword arguments | |
None | |
returns | |
screen | the same libscreen.Screen as was used as an input, but with the addition of a cursor at the gaze position; to show the cursor, call disp.fill(screen); disp.show() (assuming you use a libscreen.Display object called 'disp') |
AOI
An Area Of Interest (AOI)
arguments | |
---|---|
aoitype | string specifying the type of AOI; should be 'rectangle', 'circle', or 'ellipse' |
pos | a (x,y) position tuple indicating the AOI centre |
size | either a single integer, or a [width,height] list |
keyword arguments | |
None |
Checks if a gaze position is within the AOI
arguments | |
---|---|
gazepos | current gaze position: a (x,y) tuple or list |
keyword arguments | |
None | |
returns | |
contains | Boolean indicating whether or not the gaze position is within the AOI (True) or not (False) |
full source
You can find the full source code for libgazecon.py on GitHub.