|
|
@ -47,7 +47,7 @@ saccade_distance = 15 #15 |
|
|
|
saccade_time = 3 #3 |
|
|
|
saccade_time = 3 #3 |
|
|
|
stimulus_size = 0.3 |
|
|
|
stimulus_size = 0.3 |
|
|
|
stim_color = [1,-1,-1] |
|
|
|
stim_color = [1,-1,-1] |
|
|
|
saccade_fixation_color = [.5,.5,.5] |
|
|
|
saccade_fixation_color = [191,191,191] |
|
|
|
|
|
|
|
|
|
|
|
# Pursuit Parameters |
|
|
|
# Pursuit Parameters |
|
|
|
number_of_pursuit_trials = 1 |
|
|
|
number_of_pursuit_trials = 1 |
|
|
@ -59,12 +59,12 @@ pursuit_time = [5,5,5] #[40,20,15] |
|
|
|
# Necker Cube Parameters |
|
|
|
# Necker Cube Parameters |
|
|
|
number_of_necker_trials = 1 |
|
|
|
number_of_necker_trials = 1 |
|
|
|
number_of_necker_blocks = 4 |
|
|
|
number_of_necker_blocks = 4 |
|
|
|
necker_time = 60 |
|
|
|
necker_time = 6 |
|
|
|
necker_color = [191,191,191] |
|
|
|
necker_color = [191,191,191] |
|
|
|
necker_bg_color = [-0.5,-0.5,-0.5] |
|
|
|
necker_bg_color = [64,64,64] |
|
|
|
necker_scale = 0.5 |
|
|
|
necker_scale = 0.5 |
|
|
|
necker_file = os.path.join(image_directory,'Necker1.tif') |
|
|
|
necker_file = os.path.join(image_directory,'Necker1.tif') |
|
|
|
response_box_file = os.path.join(image_directory,'ResponseBox2.tif') |
|
|
|
response_box_file = os.path.join(image_directory,'ResponseBox3.tif') |
|
|
|
|
|
|
|
|
|
|
|
# Fixation Parameters |
|
|
|
# Fixation Parameters |
|
|
|
number_of_fixation_trials = 1 |
|
|
|
number_of_fixation_trials = 1 |
|
|
@ -79,7 +79,7 @@ rivalry_time = 90 |
|
|
|
rivalry_scale = 2.5 |
|
|
|
rivalry_scale = 2.5 |
|
|
|
rivalry_file1 = os.path.join(image_directory,'house4n_11-160.tif') |
|
|
|
rivalry_file1 = os.path.join(image_directory,'house4n_11-160.tif') |
|
|
|
rivalry_file2 = os.path.join(image_directory,'face2nS_11-160.tif') |
|
|
|
rivalry_file2 = os.path.join(image_directory,'face2nS_11-160.tif') |
|
|
|
rivalry_border_color = [0.5,0.5,0.5] |
|
|
|
rivalry_border_color = [191,191,191] |
|
|
|
rivalry_border_width = 5 |
|
|
|
rivalry_border_width = 5 |
|
|
|
rivalry_distance = 4 |
|
|
|
rivalry_distance = 4 |
|
|
|
|
|
|
|
|
|
|
@ -110,7 +110,7 @@ instruct_text = [ |
|
|
|
'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 get breaks in between blocks.\n\n' |
|
|
|
'Press space to continue.'), |
|
|
|
'Press any key to continue.'), |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
saccade_instruct_text = ( |
|
|
|
saccade_instruct_text = ( |
|
|
@ -118,7 +118,7 @@ saccade_instruct_text = ( |
|
|
|
'appears, move your gaze to the target. Move your gaze back to ' |
|
|
|
'appears, move your gaze to the target. Move your gaze back to ' |
|
|
|
'the fixation point after the target disappears.\n\n' |
|
|
|
'the fixation point after the target disappears.\n\n' |
|
|
|
'Try not to blink after the target appears.\n\n' |
|
|
|
'Try not to blink after the target appears.\n\n' |
|
|
|
'Press space to continue.' |
|
|
|
'Press any key to continue.' |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
antisaccade_instruct_text = ( |
|
|
|
antisaccade_instruct_text = ( |
|
|
@ -128,21 +128,21 @@ antisaccade_instruct_text = ( |
|
|
|
'the target. Move your gaze back to the fixation point after ' |
|
|
|
'the target. Move your gaze back to the fixation point after ' |
|
|
|
'the target disappears.\n\n' |
|
|
|
'the target disappears.\n\n' |
|
|
|
'Try not to blink after the target appears.\n\n' |
|
|
|
'Try not to blink after the target appears.\n\n' |
|
|
|
'Press space to continue.' |
|
|
|
'Press any key to continue.' |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
pursuit_instruct_text = ( |
|
|
|
pursuit_instruct_text = ( |
|
|
|
'For these trials, when the circle target appears, follow the ' |
|
|
|
'For these trials, when the circle target appears, follow the ' |
|
|
|
'target with your eyes.\n\n' |
|
|
|
'target with your eyes.\n\n' |
|
|
|
'Try not to blink while the circle is moving.\n\n' |
|
|
|
'Try not to blink while the circle is moving.\n\n' |
|
|
|
'Press space 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 these trials, when the cross appears, fixate on it.\n\n' |
|
|
|
'Try not to move your eyes from the cross while it ' |
|
|
|
'Try not to move your eyes from the cross while it ' |
|
|
|
'remains visible.\n\n' |
|
|
|
'remains visible.\n\n' |
|
|
|
'Press space to continue.' |
|
|
|
'Press any key to continue.' |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
necker_instruct_text = ( |
|
|
|
necker_instruct_text = ( |
|
|
@ -152,7 +152,7 @@ necker_instruct_text = ( |
|
|
|
'switches to up and to the right, press the right ' |
|
|
|
'switches to up and to the right, press the right ' |
|
|
|
'button.\n\n' |
|
|
|
'button.\n\n' |
|
|
|
'Respond at any time during the stimulus.\n\n' |
|
|
|
'Respond at any time during the stimulus.\n\n' |
|
|
|
'Press space to continue.' |
|
|
|
'Press any key to continue.' |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
rivalry_instruct_text = ( |
|
|
|
rivalry_instruct_text = ( |
|
|
@ -164,9 +164,17 @@ rivalry_instruct_text = ( |
|
|
|
'you perceive a combination of the face and house, ' |
|
|
|
'you perceive a combination of the face and house, ' |
|
|
|
'press the middle button.\n\n' |
|
|
|
'press the middle button.\n\n' |
|
|
|
'Respond at any time during the stimuli.\n\n' |
|
|
|
'Respond at any time during the stimuli.\n\n' |
|
|
|
'Press space to continue.' |
|
|
|
'Press any key to continue.' |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def convert_color_value(color): |
|
|
|
|
|
|
|
"""Converts a list of 3 values from 0 to 255 to -1 to 1. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Parameters: |
|
|
|
|
|
|
|
color -- A list of 3 ints between 0 and 255 to be converted. |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return [round(((n/127.5)-1), 2) for n in color] |
|
|
|
|
|
|
|
|
|
|
|
class EyeTrackingSaccadePursuit(SaccadePursuit.SPtask): |
|
|
|
class EyeTrackingSaccadePursuit(SaccadePursuit.SPtask): |
|
|
|
def __init__(self, **kwargs): |
|
|
|
def __init__(self, **kwargs): |
|
|
@ -204,27 +212,6 @@ class EyeTrackingSaccadePursuit(SaccadePursuit.SPtask): |
|
|
|
subprocess.call(['edf2asc',fName]) |
|
|
|
subprocess.call(['edf2asc',fName]) |
|
|
|
super(EyeTrackingSaccadePursuit, self).quit_experiment() |
|
|
|
super(EyeTrackingSaccadePursuit, self).quit_experiment() |
|
|
|
|
|
|
|
|
|
|
|
def display_necker_instructions(self, text): |
|
|
|
|
|
|
|
textObject = psychopy.visual.TextStim( |
|
|
|
|
|
|
|
self.experiment_window, text=text, color=[1,1,1], units='pix', |
|
|
|
|
|
|
|
height=36, alignHoriz='center', alignVert='center', |
|
|
|
|
|
|
|
wrapWidth=round(.8*self.experiment_window.size[0])) |
|
|
|
|
|
|
|
imageObject = psychopy.visual.ImageStim( |
|
|
|
|
|
|
|
self.experiment_window, units='pix', |
|
|
|
|
|
|
|
image=self.response_box_file) |
|
|
|
|
|
|
|
sizex = int(round(imageObject.size[0])*0.25) |
|
|
|
|
|
|
|
sizey = int(round(imageObject.size[1])*0.25) |
|
|
|
|
|
|
|
imageObject.size = [sizex,sizey] |
|
|
|
|
|
|
|
imageObject.pos = (0,-self.experiment_window.size[1]/2+sizey/2) |
|
|
|
|
|
|
|
print(imageObject.pos) |
|
|
|
|
|
|
|
textObject.draw() |
|
|
|
|
|
|
|
imageObject.draw() |
|
|
|
|
|
|
|
self.experiment_window.flip() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
psychopy.core.wait(.2) # Prevents accidental key presses |
|
|
|
|
|
|
|
keys = psychopy.event.waitKeys() |
|
|
|
|
|
|
|
self.experiment_window.flip() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run(self): |
|
|
|
def run(self): |
|
|
|
self.chdir() |
|
|
|
self.chdir() |
|
|
|
|
|
|
|
|
|
|
@ -282,12 +269,11 @@ class EyeTrackingSaccadePursuit(SaccadePursuit.SPtask): |
|
|
|
numBlocks = self.number_of_pursuit_blocks |
|
|
|
numBlocks = self.number_of_pursuit_blocks |
|
|
|
numTrials = self.number_of_pursuit_trials |
|
|
|
numTrials = self.number_of_pursuit_trials |
|
|
|
elif condition=='Necker': |
|
|
|
elif condition=='Necker': |
|
|
|
#self.display_text_screen(text=necker_instruct_text) |
|
|
|
self.display_text_screen(text=necker_instruct_text, image_file=self.response_box_file) |
|
|
|
self.display_necker_instructions(text=necker_instruct_text) |
|
|
|
|
|
|
|
numBlocks = self.number_of_necker_blocks |
|
|
|
numBlocks = self.number_of_necker_blocks |
|
|
|
numTrials = self.number_of_necker_trials |
|
|
|
numTrials = self.number_of_necker_trials |
|
|
|
elif condition=='Rivalry': |
|
|
|
elif condition=='Rivalry': |
|
|
|
self.display_text_screen(text=rivalry_instruct_text) |
|
|
|
self.display_text_screen(text=rivalry_instruct_text, image_file=self.response_box_file) |
|
|
|
numBlocks = self.number_of_rivalry_blocks |
|
|
|
numBlocks = self.number_of_rivalry_blocks |
|
|
|
numTrials = self.number_of_rivalry_trials |
|
|
|
numTrials = self.number_of_rivalry_trials |
|
|
|
else: |
|
|
|
else: |
|
|
@ -339,8 +325,16 @@ class EyeTrackingSaccadePursuit(SaccadePursuit.SPtask): |
|
|
|
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) |
|
|
|
else: |
|
|
|
elif condition=='Fixation': |
|
|
|
|
|
|
|
self.display_text_screen(text='Remember:\n\n' + fixation_instruct_text) |
|
|
|
|
|
|
|
elif condition=='Pursuit': |
|
|
|
self.display_text_screen(text='Remember:\n\n' + pursuit_instruct_text) |
|
|
|
self.display_text_screen(text='Remember:\n\n' + pursuit_instruct_text) |
|
|
|
|
|
|
|
elif condition=='Necker': |
|
|
|
|
|
|
|
self.display_text_screen(text='Remember:\n\n' + necker_instruct_text, |
|
|
|
|
|
|
|
image_file=self.response_box_file) |
|
|
|
|
|
|
|
elif condition=='Rivalry': |
|
|
|
|
|
|
|
self.display_text_screen(text='Remember:\n\n' + rivalry_instruct_text, |
|
|
|
|
|
|
|
image_file=self.response_box_file) |
|
|
|
|
|
|
|
|
|
|
|
self.display_text_screen( |
|
|
|
self.display_text_screen( |
|
|
|
'The experiment is now over.', |
|
|
|
'The experiment is now over.', |
|
|
@ -366,20 +360,20 @@ experiment = EyeTrackingSaccadePursuit( |
|
|
|
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=saccade_fixation_color, |
|
|
|
saccade_fixation_color=convert_color_value(saccade_fixation_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, |
|
|
|
necker_time=necker_time, necker_color=necker_color, |
|
|
|
necker_time=necker_time, necker_color=necker_color, |
|
|
|
necker_scale=necker_scale, |
|
|
|
necker_scale=necker_scale, |
|
|
|
necker_bg_color=necker_bg_color, |
|
|
|
necker_bg_color=convert_color_value(necker_bg_color), |
|
|
|
fixation_trial_time=fixation_trial_time, |
|
|
|
fixation_trial_time=fixation_trial_time, |
|
|
|
rivalry_time=rivalry_time, |
|
|
|
rivalry_time=rivalry_time, |
|
|
|
rivalry_scale=rivalry_scale, |
|
|
|
rivalry_scale=rivalry_scale, |
|
|
|
necker_file=necker_file, |
|
|
|
necker_file=necker_file, |
|
|
|
rivalry_file1=rivalry_file1, |
|
|
|
rivalry_file1=rivalry_file1, |
|
|
|
rivalry_file2=rivalry_file2, |
|
|
|
rivalry_file2=rivalry_file2, |
|
|
|
rivalry_border_color=rivalry_border_color, |
|
|
|
rivalry_border_color=convert_color_value(rivalry_border_color), |
|
|
|
disableTracker=disableTracker, |
|
|
|
disableTracker=disableTracker, |
|
|
|
rivalry_border_width=rivalry_border_width, |
|
|
|
rivalry_border_width=rivalry_border_width, |
|
|
|
rivalry_distance=rivalry_distance, |
|
|
|
rivalry_distance=rivalry_distance, |
|
|
|