Platform for trajectory tracking experiments & data analysis
TrajTracker Paradigms: Sample scripts
Basic discrete-choice task
Creating a basic two-choice task requires almost no coding: You only need to initialize the environment, set few configuration parameters, define a stimulus file, and call 4 functions to initialize and run the experiment.
​
The following script is such a basic experiment: on each trial, the word "left" or "right" appears, and you need to drag your finger to the corresponding response button.
​
To try out this script, you would also need to download the CSV trials file.
import expyriment as xpy
import trajtracker as ttrk
import trajtrackerp as ttrkp
from trajtrackerp import dchoice
if not xpy.misc.is_android_running():
xpy.control.defaults.window_mode = True
ttrk.log_to_console = True
config = dchoice.Config("ChooseDir", max_movement_time=2, data_source="choice_1.csv",
use_text_targets=True,
feedback_stim_type='rectangle', feedback_select_by='response',
feedback_place='button',
speed_guide_enabled=True)
#-- Initialize Expyriment
exp = ttrk.initialize()
xpy.control.start(exp)
if not xpy.misc.is_android_running():
exp.mouse.show_cursor()
#-- Get subject info
(subj_id, subj_name) = ttrkp.common.get_subject_name_id()
#-- Run the experiment
exp_info = dchoice.initialize_experiment(config, exp, subj_id, subj_name)
dchoice.run_trials(exp_info)
#-- Shutdown Expyriment
xpy.control.end()