Dear Psychopy Community,
I have two questions for you that build on each other
(1) Description: I would like to present a series of six green circles in randomly placed locations, one after the other. Only one of these circles is filled with black. Each circle is presented for 0.5 seconds, but I want to give my subjects 1.5 seconds to react to the black filled circle. However, after 0.5 seconds the next circle should already appear.
Problem: With my code the attention_test_wait variable (1.5) is added to the presentation time of the black filled circle, so that it is presented for 2 seconds.
(2) Description: During the 1.5 second period, I want my subjects to confirm that they have seen the black circle using ‘y’.
Problem: With the getKeys() function I only get an empty list back. The waitKeys() function works, but it is not appropriate for my task.
Code:
def run_practice_trials(window_instance,
attention_key='y',
attention_test_wait=1.5,
fixation_dur=0.5,
sequence_length=6,
pass_threshold=50):
correct_answers = 0
if correct_answers <= pass_threshold:
attention_markers = create_attention_test(sequence_length)
for dot in attention_markers:
if dot == 1:
gaze_color = 'black'
else:
gaze_color = 'green'
gaze_dot = visual.Circle(
window_instance,
radius=0.2,
fillColor=gaze_color,
fillColorSpace='rgb',
lineColor='green',
lineColorSpace='rgb',
units='deg',
pos=[np.random.normal(0, 3), np.random.normal(0, 3)])
gaze_dot.draw()
window_instance.flip()
if dot == 1:
attention_timer = core.Clock()
while attention_timer.getTime() <= attention_test_wait:
attention_response= event.getKeys(keyList=attention_key)
if attention_response == attention_key:
print('Noice!')
attention_timer.reset()
else:
core.wait(fixation_dur)
return None
Note:
- attention_markers is a list of zeros and a one