|
|
@ -32,8 +32,6 @@ monitor_px = [1440,900] |
|
|
|
window_screen = 1 |
|
|
|
window_screen = 1 |
|
|
|
|
|
|
|
|
|
|
|
disableTracker = True # For Debugging |
|
|
|
disableTracker = True # For Debugging |
|
|
|
conditions = ['Fixation', 'Pursuit', 'Saccade', 'AntiSaccade', 'Necker'] #, 'Rivalry'] |
|
|
|
|
|
|
|
#conditions = ['Necker'] |
|
|
|
|
|
|
|
isi_time = 2 # Interstimulus Interval |
|
|
|
isi_time = 2 # Interstimulus Interval |
|
|
|
data_directory = os.path.join( |
|
|
|
data_directory = os.path.join( |
|
|
|
os.path.expanduser('~'), 'Desktop', 'ExperimentalData', 'SaccadePursuitEyeTracking') |
|
|
|
os.path.expanduser('~'), 'Desktop', 'ExperimentalData', 'SaccadePursuitEyeTracking') |
|
|
@ -47,7 +45,10 @@ saccade_distance = 15 # Degrees per direction |
|
|
|
saccade_time = 3 # Maximum Time |
|
|
|
saccade_time = 3 # Maximum Time |
|
|
|
stimulus_size = 0.3 |
|
|
|
stimulus_size = 0.3 |
|
|
|
stim_color = [1,-1,-1] |
|
|
|
stim_color = [1,-1,-1] |
|
|
|
saccade_fixation_color = [100,100,100] |
|
|
|
saccade_fixation_color = [255,255,255] |
|
|
|
|
|
|
|
saccade_dot_color = [100,100,100] |
|
|
|
|
|
|
|
antisaccade_instruct_file = os.path.join(image_directory,'AntiSaccadeInstruct2.tif') |
|
|
|
|
|
|
|
antisaccade_file_scale = 2.5 |
|
|
|
|
|
|
|
|
|
|
|
# Pursuit Parameters |
|
|
|
# Pursuit Parameters |
|
|
|
number_of_pursuit_trials = 1 |
|
|
|
number_of_pursuit_trials = 1 |
|
|
@ -98,8 +99,31 @@ data_fields = [ |
|
|
|
'Locations', |
|
|
|
'Locations', |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Add additional questions here |
|
|
|
|
|
|
|
questionaire_dict = { |
|
|
|
|
|
|
|
'Run Fixation': True, |
|
|
|
|
|
|
|
'Run Smooth Pursuit': True, |
|
|
|
|
|
|
|
'Run Saccade': True, |
|
|
|
|
|
|
|
'Run Anti-Saccade': True, |
|
|
|
|
|
|
|
'Run Necker Cube': True, |
|
|
|
|
|
|
|
'Run Binocular Rivalry': False, |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
questionaire_order=[ |
|
|
|
|
|
|
|
'Subject Identifier', |
|
|
|
|
|
|
|
'Age', |
|
|
|
|
|
|
|
'Experimenter Initials', |
|
|
|
|
|
|
|
'Gender', |
|
|
|
|
|
|
|
'Run Fixation', |
|
|
|
|
|
|
|
'Run Smooth Pursuit', |
|
|
|
|
|
|
|
'Run Saccade', |
|
|
|
|
|
|
|
'Run Anti-Saccade', |
|
|
|
|
|
|
|
'Run Necker Cube', |
|
|
|
|
|
|
|
'Run Binocular Rivalry', |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
instruct_text = [ |
|
|
|
instruct_text = [ |
|
|
|
('Welcome to the experiment. Press space to continue.'), |
|
|
|
('Welcome to the experiment. Press any key to continue.'), |
|
|
|
('In this experiment you will be following targets.\n\n' |
|
|
|
('In this experiment you will be following targets.\n\n' |
|
|
|
'Each trial will start with a fixation cross. ' |
|
|
|
'Each trial will start with a fixation cross. ' |
|
|
|
'Focus on the fixation cross until a stimulus appears.\n\n' |
|
|
|
'Focus on the fixation cross until a stimulus appears.\n\n' |
|
|
@ -112,61 +136,80 @@ instruct_text = [ |
|
|
|
'\n\n' |
|
|
|
'\n\n' |
|
|
|
'Do not move your head during the trials of this ' |
|
|
|
'Do not move your head during the trials of this ' |
|
|
|
'experiment. Move only your eyes to follow the targets.' |
|
|
|
'experiment. Move only your eyes to follow the targets.' |
|
|
|
'You will get breaks in between blocks.\n\n' |
|
|
|
'You will be offered breaks in between sections.\n\n' |
|
|
|
'Press any key to continue.'), |
|
|
|
'Press any key to continue.'), |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
saccade_instruct_text = ( |
|
|
|
saccade_instruct_text = ( |
|
|
|
'For these trials, focus on the fixation cross. When the target ' |
|
|
|
'For this experiment, we want to know how accurately your ' |
|
|
|
'appears, move your gaze to the target. Move your gaze back to ' |
|
|
|
'eyes can move from one position to another. You will see ' |
|
|
|
'the fixation point after the target disappears.\n\n' |
|
|
|
'many gray dots and a cross on the screen. Please focus on ' |
|
|
|
'Try not to blink after the target appears.\n\n' |
|
|
|
'the fixation cross in the beginning. When the red dot ' |
|
|
|
|
|
|
|
'appears, move your eyes to the red dot as quickly as ' |
|
|
|
|
|
|
|
'possible and fixate on the red dot. When you hear a sound, ' |
|
|
|
|
|
|
|
'move your eyes back to the fixation cross.\n\n' |
|
|
|
|
|
|
|
'Try not to blink while a red dot is displayed.\n\n' |
|
|
|
|
|
|
|
'You can then blink or close your eyes to rest for a few seconds.\n\n' |
|
|
|
'Press any key to continue.' |
|
|
|
'Press any key to continue.' |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
antisaccade_instruct_text = ( |
|
|
|
antisaccade_instruct_text = ( |
|
|
|
'For these trials, focus on the fixation cross. When the target ' |
|
|
|
'For this experiment, we also want to know how accurately your ' |
|
|
|
'appears, move your gaze to the OPPOSITE direction of the target ' |
|
|
|
'eyes can move from one point to another. Please focus on the ' |
|
|
|
'at approximately the same distance from the fixation cross as ' |
|
|
|
'fixation cross. When the red dot appears, move your eyes to ' |
|
|
|
'the target. Move your gaze back to the fixation point after ' |
|
|
|
'the OPPOSITE direction of the target at approximately the ' |
|
|
|
'the target disappears.\n\n' |
|
|
|
'same distance from the fixation cross as the target as shown ' |
|
|
|
'Try not to blink after the target appears.\n\n' |
|
|
|
'by the arrow in the image below this text. The arrow will ' |
|
|
|
|
|
|
|
'not be present during the experiment. Move your eyes back ' |
|
|
|
|
|
|
|
'to the fixation point after each target disappears.\n\n' |
|
|
|
|
|
|
|
'Try not to blink while a red dot is displayed.\n\n' |
|
|
|
|
|
|
|
'You can then blink or close your eyes to rest for a few seconds.\n\n' |
|
|
|
'Press any key to continue.' |
|
|
|
'Press any key to continue.' |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
pursuit_instruct_text = ( |
|
|
|
pursuit_instruct_text = ( |
|
|
|
'For these trials, when the circle target appears, follow the ' |
|
|
|
'For this experiment, we want to know how well your eyes can ' |
|
|
|
'target with your eyes.\n\n' |
|
|
|
'follow a target at different speeds. Please fixate the cross. ' |
|
|
|
'Try not to blink while the circle is moving.\n\n' |
|
|
|
'When the dot appears, follow the target with your eyes. You ' |
|
|
|
|
|
|
|
'will hear a sound when the trial is done. You may blink ' |
|
|
|
|
|
|
|
'until the next trial begins. A new trial will begin after ' |
|
|
|
|
|
|
|
'two seconds.\n\n' |
|
|
|
|
|
|
|
'Try not to blink while the dot is moving.\n\n' |
|
|
|
|
|
|
|
'You can then blink or close your eyes to rest for a few seconds.\n\n' |
|
|
|
'Press any key to continue.' |
|
|
|
'Press any key to continue.' |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
fixation_instruct_text = ( |
|
|
|
fixation_instruct_text = ( |
|
|
|
'For these trials, when the cross appears, fixate on it.\n\n' |
|
|
|
'For this experiment, we want to know how well you can keep ' |
|
|
|
'Try not to move your eyes from the cross while it ' |
|
|
|
'your eyes fixed on a target without moving. When the cross ' |
|
|
|
'remains visible.\n\n' |
|
|
|
'appears, please fixate on it.\n\n' |
|
|
|
|
|
|
|
'Try not to move your eyes from the cross or blink until it ' |
|
|
|
|
|
|
|
'disappears.\n\n' |
|
|
|
|
|
|
|
'You can then blink or close your eyes to rest for a few seconds.\n\n' |
|
|
|
'Press any key to continue.' |
|
|
|
'Press any key to continue.' |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
necker_instruct_text = ( |
|
|
|
necker_instruct_text = ( |
|
|
|
'For these trials, focus on the square. When your ' |
|
|
|
'For this experiment, focus on the square. When you see the ' |
|
|
|
'perception is that the square is pointing down and ' |
|
|
|
'square is pointing down and to the left, press the left ' |
|
|
|
'to the left, press the left button. As soon as it ' |
|
|
|
'button. As soon as it switches to up and to the right, ' |
|
|
|
'switches to up and to the right, press the right ' |
|
|
|
'press the right button. Refer to the image below this ' |
|
|
|
'button.\n\n' |
|
|
|
'text. The center button is not used during this experiment.\n\n' |
|
|
|
'Respond at any time during the stimulus.\n\n' |
|
|
|
'Respond at any time during the stimulus.\n\n' |
|
|
|
|
|
|
|
'Try not to blink after the cube appears.\n\n' |
|
|
|
|
|
|
|
'You can blink or close your eyes to rest after the cube ' |
|
|
|
|
|
|
|
'disappears.\n\n' |
|
|
|
'Press any key to continue.' |
|
|
|
'Press any key to continue.' |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
rivalry_instruct_text = ( |
|
|
|
rivalry_instruct_text = ( |
|
|
|
'For these trials, the experimenter will move a ' |
|
|
|
'For this experiment, you will see different images in your ' |
|
|
|
'system in front of your field of view. Look through ' |
|
|
|
'left and right eyes through the mirrors.\n\n' |
|
|
|
'the mirrors to see a different image in each eye.\n\n' |
|
|
|
'If you see a face, press the right button. If you see a ' |
|
|
|
'If you perceive a face, press the right button. If ' |
|
|
|
'house, press the left button. If you perceive a mixture of ' |
|
|
|
'you perceive a house, press the left button. If ' |
|
|
|
'the face and house, press the center button.\n\n' |
|
|
|
'you perceive a combination of the face and house, ' |
|
|
|
'You can blink or close your eyes to rest for a few seconds ' |
|
|
|
'press the middle button.\n\n' |
|
|
|
'after the pictures disappear.\n\n' |
|
|
|
'Respond at any time during the stimuli.\n\n' |
|
|
|
|
|
|
|
'Press any key to continue.' |
|
|
|
'Press any key to continue.' |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -201,6 +244,8 @@ class EyeTrackingSaccadePursuit(SaccadePursuit.SPtask): |
|
|
|
self.necker_response_box_file = necker_response_box_file |
|
|
|
self.necker_response_box_file = necker_response_box_file |
|
|
|
self.necker_response_box_scale = necker_response_box_scale |
|
|
|
self.necker_response_box_scale = necker_response_box_scale |
|
|
|
self.response_box_scale = response_box_scale |
|
|
|
self.response_box_scale = response_box_scale |
|
|
|
|
|
|
|
self.antisaccade_instruct_file = antisaccade_instruct_file |
|
|
|
|
|
|
|
self.antisaccade_file_scale = antisaccade_file_scale |
|
|
|
|
|
|
|
|
|
|
|
super(EyeTrackingSaccadePursuit, self).__init__(**kwargs) |
|
|
|
super(EyeTrackingSaccadePursuit, self).__init__(**kwargs) |
|
|
|
|
|
|
|
|
|
|
@ -222,12 +267,28 @@ class EyeTrackingSaccadePursuit(SaccadePursuit.SPtask): |
|
|
|
self.chdir() |
|
|
|
self.chdir() |
|
|
|
|
|
|
|
|
|
|
|
print('Note: EDF file will be overwritten if identical subject identifiers are used!') |
|
|
|
print('Note: EDF file will be overwritten if identical subject identifiers are used!') |
|
|
|
ok = self.get_experiment_info_from_dialog(self.questionaire_dict) |
|
|
|
ok = self.get_experiment_info_from_dialog( |
|
|
|
|
|
|
|
additional_fields_dict=questionaire_dict, |
|
|
|
|
|
|
|
field_order=questionaire_order) |
|
|
|
|
|
|
|
|
|
|
|
if not ok: |
|
|
|
if not ok: |
|
|
|
print('Experiment has been terminated.') |
|
|
|
print('Experiment has been terminated.') |
|
|
|
sys.exit(1) |
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
conditions = [] |
|
|
|
|
|
|
|
if self.experiment_info['Run Fixation']: |
|
|
|
|
|
|
|
conditions.append('Fixation') |
|
|
|
|
|
|
|
if self.experiment_info['Run Smooth Pursuit']: |
|
|
|
|
|
|
|
conditions.append('Pursuit') |
|
|
|
|
|
|
|
if self.experiment_info['Run Saccade']: |
|
|
|
|
|
|
|
conditions.append('Saccade') |
|
|
|
|
|
|
|
if self.experiment_info['Run Anti-Saccade']: |
|
|
|
|
|
|
|
conditions.append('AntiSaccade') |
|
|
|
|
|
|
|
if self.experiment_info['Run Necker Cube']: |
|
|
|
|
|
|
|
conditions.append('Necker') |
|
|
|
|
|
|
|
if self.experiment_info['Run Binocular Rivalry']: |
|
|
|
|
|
|
|
conditions.append('Rivalry') |
|
|
|
|
|
|
|
|
|
|
|
self.save_experiment_info() |
|
|
|
self.save_experiment_info() |
|
|
|
self.open_csv_data_file() |
|
|
|
self.open_csv_data_file() |
|
|
|
self.open_window(screen=self.window_screen) |
|
|
|
self.open_window(screen=self.window_screen) |
|
|
@ -252,10 +313,10 @@ class EyeTrackingSaccadePursuit(SaccadePursuit.SPtask): |
|
|
|
self.tracker.display_eyetracking_instructions() |
|
|
|
self.tracker.display_eyetracking_instructions() |
|
|
|
self.tracker.setup_tracker() |
|
|
|
self.tracker.setup_tracker() |
|
|
|
|
|
|
|
|
|
|
|
#random.shuffle(self.conditions) |
|
|
|
#random.shuffle(conditions) |
|
|
|
|
|
|
|
|
|
|
|
condition_counter = 0 |
|
|
|
condition_counter = 0 |
|
|
|
for condition in self.conditions: |
|
|
|
for condition in conditions: |
|
|
|
condition_counter += 1 |
|
|
|
condition_counter += 1 |
|
|
|
numBlocks = 1 |
|
|
|
numBlocks = 1 |
|
|
|
numTrials = 1 |
|
|
|
numTrials = 1 |
|
|
@ -264,7 +325,9 @@ class EyeTrackingSaccadePursuit(SaccadePursuit.SPtask): |
|
|
|
numBlocks = self.number_of_saccade_blocks |
|
|
|
numBlocks = self.number_of_saccade_blocks |
|
|
|
numTrials = self.number_of_saccade_trials |
|
|
|
numTrials = self.number_of_saccade_trials |
|
|
|
elif condition=='AntiSaccade': |
|
|
|
elif condition=='AntiSaccade': |
|
|
|
self.display_text_screen(text=antisaccade_instruct_text) |
|
|
|
self.display_text_screen(text=antisaccade_instruct_text, |
|
|
|
|
|
|
|
image_file = antisaccade_instruct_file, |
|
|
|
|
|
|
|
image_scale = self.antisaccade_file_scale) |
|
|
|
numBlocks = self.number_of_saccade_blocks |
|
|
|
numBlocks = self.number_of_saccade_blocks |
|
|
|
numTrials = self.number_of_saccade_trials |
|
|
|
numTrials = self.number_of_saccade_trials |
|
|
|
elif condition=='Fixation': |
|
|
|
elif condition=='Fixation': |
|
|
@ -301,7 +364,7 @@ class EyeTrackingSaccadePursuit(SaccadePursuit.SPtask): |
|
|
|
|
|
|
|
|
|
|
|
for trial_num, trial in enumerate(block): |
|
|
|
for trial_num, trial in enumerate(block): |
|
|
|
print( |
|
|
|
print( |
|
|
|
"Condition: ",condition,"(",condition_counter,"/",len(self.conditions),")", |
|
|
|
"Condition: ",condition,"(",condition_counter,"/",len(conditions),")", |
|
|
|
"Block ",block_num+1,"/",numBlocks, |
|
|
|
"Block ",block_num+1,"/",numBlocks, |
|
|
|
" Trial ",trial_num+1,"/",len(block) |
|
|
|
" Trial ",trial_num+1,"/",len(block) |
|
|
|
) |
|
|
|
) |
|
|
@ -335,7 +398,9 @@ class EyeTrackingSaccadePursuit(SaccadePursuit.SPtask): |
|
|
|
if condition == 'Saccade': |
|
|
|
if condition == 'Saccade': |
|
|
|
self.display_text_screen(text='Remember:\n\n' + saccade_instruct_text) |
|
|
|
self.display_text_screen(text='Remember:\n\n' + saccade_instruct_text) |
|
|
|
elif condition=='AntiSaccade': |
|
|
|
elif condition=='AntiSaccade': |
|
|
|
self.display_text_screen(text='Remember:\n\n' + antisaccade_instruct_text) |
|
|
|
self.display_text_screen(text='Remember:\n\n' + antisaccade_instruct_text, |
|
|
|
|
|
|
|
image_file = antisaccade_instruct_file, |
|
|
|
|
|
|
|
image_scale = self.antisaccade_file_scale) |
|
|
|
elif condition=='Fixation': |
|
|
|
elif condition=='Fixation': |
|
|
|
self.display_text_screen(text='Remember:\n\n' + fixation_instruct_text) |
|
|
|
self.display_text_screen(text='Remember:\n\n' + fixation_instruct_text) |
|
|
|
elif condition=='Pursuit': |
|
|
|
elif condition=='Pursuit': |
|
|
@ -368,12 +433,12 @@ experiment = EyeTrackingSaccadePursuit( |
|
|
|
monitor_width=monitor_width, |
|
|
|
monitor_width=monitor_width, |
|
|
|
monitor_px=monitor_px, |
|
|
|
monitor_px=monitor_px, |
|
|
|
monitor_distance=distance_to_monitor, |
|
|
|
monitor_distance=distance_to_monitor, |
|
|
|
conditions=conditions, |
|
|
|
|
|
|
|
pursuit_time=pursuit_time, stim_color=stim_color, |
|
|
|
pursuit_time=pursuit_time, stim_color=stim_color, |
|
|
|
pursuit_frequencies=pursuit_frequencies, |
|
|
|
pursuit_frequencies=pursuit_frequencies, |
|
|
|
saccade_distance=saccade_distance, |
|
|
|
saccade_distance=saccade_distance, |
|
|
|
saccade_time=saccade_time, |
|
|
|
saccade_time=saccade_time, |
|
|
|
saccade_fixation_color=convert_color_value(saccade_fixation_color), |
|
|
|
saccade_fixation_color=convert_color_value(saccade_fixation_color), |
|
|
|
|
|
|
|
saccade_dot_color = convert_color_value(saccade_dot_color), |
|
|
|
isi_time=isi_time, stimulus_size=stimulus_size, |
|
|
|
isi_time=isi_time, stimulus_size=stimulus_size, |
|
|
|
fixation_size=fixation_size, |
|
|
|
fixation_size=fixation_size, |
|
|
|
pursuit_distance=pursuit_distance, |
|
|
|
pursuit_distance=pursuit_distance, |
|
|
|