def stimuli_blinking_nonstop(frame_on1, frame_off1, frame_on2, frame_off2, frame_on3, frame_off3, shapes, arrow): looptime = math.gcd(frame_on1, math.gcd(frame_on2, frame_on3)) global flipCount while True: # if flipCount == 59: # flipCount = 0 if (flipCount == 0 or (flipCount % frame_on1 == 0 and flipCount % (frame_on1 * 2) != 0)): shapes[0].setAutoDraw(True) shapes[1].setAutoDraw(False) if (flipCount % (frame_off1 * 2) == 0): shapes[1].setAutoDraw(True) shapes[0].setAutoDraw(False) if (flipCount == 0 or (flipCount % frame_on2 == 0 and flipCount % (frame_on2 * 2) != 0)): shapes[2].setAutoDraw(True) shapes[3].setAutoDraw(False) if (flipCount % (frame_off2 * 2) == 0): shapes[3].setAutoDraw(True) shapes[2].setAutoDraw(False) if (flipCount == 0 or (flipCount % frame_on3 == 0 and flipCount % (frame_on3 * 2) != 0)): shapes[4].setAutoDraw(True) shapes[5].setAutoDraw(False) if (flipCount % (frame_off3 * 2) == 0): shapes[5].setAutoDraw(True) shapes[4].setAutoDraw(False) # time = trialclock.getTime() # for frameN in range(looptime): mywin.flip() flipCount += 1 result = marker_result() if (result): print("Marker received: ", result[0][0]) arrow.setAutoDraw(False) arrow = ShapeStim(mywin, vertices=arrowVert, fillColor='darkred', size=.2, lineColor='red', pos=arrowSequence[result[0][0]]) arrow.setAutoDraw(True) mywin.flip() core.wait(2.0) if 'escape' in event.getKeys(): core.quit()
message.draw() mywin.flip() fixation.draw() mywin.flip() #refresh core.wait(iti) mywin.flip() # create arrow shape for the first sequence arrow = ShapeStim(mywin, vertices=arrowVert, fillColor='darkred', size=.5, lineColor='red', pos=arrowSequence[0]) arrow.setAutoDraw(True) mywin.flip() core.wait(iti) mywin.flip() while count < len(stimuli_seq): print("Count: ", count) #draw the stimuli and update the window print("freq: ", test_freq[count % freq_len]) #print("frameon-off: ", frame_on, frame_off) print("markername: ", markernames[count % freq_len]) print("======") outlet.push_sample([markernames[count % freq_len] ]) #(x, timestamp)