I followed this post to push triggers from the keyboard responses using Psychopy with mBT Smarting Pro, but I think that the timing doesn’t correspond to a subject’s reaction time. A subject always responds to a stimulus within 1 second after seeing it, but the reaction time in the EEG structure is about 1.75 seconds, which is the trial length. Is there suggestion regarding where I should push the keyboard response. Here is the code that I use to push the triggers in the Each Frame.
if response.keys != None: # we had a response
# Send LSL Marker : Response as string
mystring = ''.join(map(str,response.keys))
resp = "ResponseKey: " + mystring
print("Response: [%s]" % resp)
outlet.push_sample([resp]) # Push event marker.
The issue has been resolved and it was due to different designs between the tasks.
A trial will end as soon as a subject click the key from the mBT post’s Stroop task. However, a trial of our task will not force end as soon as a subject click the key, so LSL response markers will be pushed from a different part.
if TrialResp.status == STARTED and not waitOnFlip:
theseKeys = TrialResp.getKeys(keyList=['space'], ignoreKeys=["escape"], waitRelease=False)
_TrialResp_allKeys.extend(theseKeys)
if len(_TrialResp_allKeys):
TrialResp.keys = _TrialResp_allKeys[-1].name # just the last key pressed
TrialResp.rt = _TrialResp_allKeys[-1].rt
TrialResp.duration = _TrialResp_allKeys[-1].duration
##### LSL push ######
for thisKey in theseKeys:
if thisKey == 'q': # it is equivalent to the string 'q'
core.quit()
else:
# Send LSL Marker : Response as string
mystr = ''.join(map(str,TrialResp.keys))
resp = "ResponseKey: " + mystr
outlet.push_sample([resp]) # Push event marker.
##### LSL push ######
# was this correct?
if (TrialResp.keys == str(CorrAns)) or (TrialResp.keys == CorrAns):
TrialResp.corr = 1
else:
TrialResp.corr = 0