FixationZoom class¶
A fixation stimulus that starts as 4 dots, organized on the corners of a rectangle, and then moves them in to the rectangle’s center.
Using this class¶
Without the events mechanism¶
- Create the FixationZoom
- Add
stimulusto yourStimulusContainer - When the trial is initialized, call
reset() - To show the fixation, call
show() - To start zooming in the dots, call
start_zoom() - To refresh the position of the dots as they zoom in, call
update()orupdate_xyt()on each frame. - When timed out, the dots will auto-hide. Alternatively, you can explicitly call
hide()to hide them and terminate the zoom-in process.
With the events mechanism¶
- Create the FixationZoom
- Add
stimulusto yourStimulusContainer - Define
start_zoom_event, and (optionally)show_event - Register the FixationZoom to an
EventManager - When the trial is initialized, call
reset() - To refresh the position of the dots as they zoom in, call
update()orupdate_xyt()on each frame. - When timed out, the dots will auto-hide. Alternatively, you can explicitly call
hide()to hide them and terminate the zoom-in process.
Methods and properties:¶
-
class
trajtracker.stimuli.FixationZoom(position=(0, 0), box_size=(20, 20), dot_radius=2, dot_colour=(0, 0, 255), dot_generator=None, zoom_duration=0.2, stay_duration=0.1, show_event=None, start_zoom_event=None)¶ -
__init__(position=(0, 0), box_size=(20, 20), dot_radius=2, dot_colour=(0, 0, 255), dot_generator=None, zoom_duration=0.2, stay_duration=0.1, show_event=None, start_zoom_event=None)¶
-
box_size¶ The size of the virtual box occupied by the four dots before zooming in (width, height). Dots will appear at the corners of this box.
-
dot_colour¶ The colour of each of the 4 dots.
Ignored if
dot_generatoris overriden.Type: (red,green,blue) tuple
-
dot_generator¶ A function that generates a stimulus to be used as one of the four dots.
The function receives one argument (the FixationZoom object) and returns a stimulus.
Default: generate circles.
-
dot_radius¶ The size of each of the 4 dots (in pixels)
Ignored if
dot_generatoris overriden.Type: int
-
hide()¶ Hide the dots; if zoom-in is still occurring, terminate it
-
log_level¶ Logging level of this object: trajtracker.log_none, log_error (default), log_warn, log_info, log_debug, log_trace
-
position¶ Coordinates of the fixation center (x,y)
-
reset(time0=None)¶ Reset the fixation stimulus. Call this when the trial is initialized.
-
show()¶ Show the dots in the virtual rectangle’s corners
-
show_event¶ When working with the the events mechanism: the event on which the fixation will be presented.
If None,
start_zoom_eventwill also trigger the onset of the fixation.Note: This cannot be TRIAL_INITIALIZED or TRIAL_STARTED - it must be a later event.
-
start_zoom(time_in_session)¶ Start the zoom process
-
start_zoom_event¶ When working with the the events mechanism: the event on which the fixation will start zooming.
Note: This cannot be TRIAL_INITIALIZED or TRIAL_STARTED - it must be a later event.
-
stay_duration¶ Duration (in seconds) the stimulus remains on screen, after zoom in is finished, before it disappears.
If set to None, the stimulus will not disappear but remain on screen.
-
stimulus¶ A
StimulusContainercontaining all the fixation’s dots
-
update(time)¶ Call this method periodically (preferably on each frame) to refresh the position of the dots.
start_zoom()must be called first.This method is equivalent to
update_xyt()
-
update_xyt(position=None, time_in_trial=None, time_in_session=None)¶ Call this method periodically (preferably on each frame) to refresh the position of the dots.
start_zoom()must be called first.This method is equivalent to
update(). You may find this one more convenient because it has the same API as the update_xyt() methods of other classes.
-
visible¶ Set the fixation visible/invisible. This is equivalent to calling
show()orhide()Type: bool
-
zoom_duration¶ Duration (in seconds) it takes to “zoom in” the dots (move them to the center)
-