

Trigger(trig_list]]],0.01) # send sound triggerĮlif all_responses] = 1: Height=(dimentions), ori=0, pos=(0, position]]), lineWidth=1, Laying = visual.Rect(win=win, name='up_cross_hor', width=(dimentions), LineColorSpace='rgb', fillColor=colors]],įillColorSpace='rgb', opacity=1, depth=0.0, interpolate=True) Standing = visual.Rect(win=win, name='up_cross_hor', width=(dimentions), Show_target_crosses(pauses, t, trial_paradigm, hi_targets, low_targets) # show target Time - nan if not pressed or time of press if pressedįor t in range(n_trials): # n_trials is the total amount of trials Key - containing either a keypress and a time or nothing (list)
Psychopy code reaction time round trial#
The code seem to work when I comment out sd.play of the sound, but as soon as the sound is played, the reaction times seem off and it always stores it in the trial following the target trial (even though I know I pressed spacebar during target trial).ĭid anyone encounter this problem before?īelow is the code for the procedure: def response_check(key): I do that because my inter-trial interval is short and it can happen that participants will respond to the target during the following trial.

I store a global time to compare the time of the onset of the trial with the time when spacebar was pressed. So I store, using event.getKey, the global time when the spacebar was pressed. I want to know participants' reaction times to the target. Some of the visual stimuli are targets and participants should press spacebar when they detect the target. Simultaneously with the onset of the visual stimuli, there is a sound playing for 100 ms. I coded an experiment in which participants are presented with a series of visual stimuli (stim duration: 100ms, trial duration: 500ms).
