我已经与这个问题斗争了几个小时,我试图在网上找到解决办法的尝试却一无所获。希望这里有人能有所见识。在
在一个实验过程中,参与者看到一系列刺激,然后是没有用户输入的面具。然而,在一些试验中,我们希望进行“捕捉”试验,以确保参与者仍然参与其中。在
因此,理想情况下,流程应该是:
stim->;mask->;stim->;mask…->;catch trial->;mask(register keypress-“I saw it”)—>;stim->;mask。。。在
我的问题是当我打电话的时候事件.getKeys('space')它总是返回一个空列表。在
以下是相关代码片段:
if stimCount >= min(catchTrials)+mod[modCount] and stimCount <= max(catchTrials)+mod[modCount] and beenDisplayed == 0:
print 1
test = random.randint(0,1)
if test == 1 or stimCount % 20 == 0:
print 2
actualStim.setSF(0)
actualStim.setOri(0)
doCatch(catchTimeout) # this displays the "catch" stim
doMask(MaskTimeout,maskNum) # this is the mask
print stimCount+1, 'catch', catchResponse # debug line
beenDisplayed = 1
modCount += 1
inCatch = 1
keys = event.getKeys(["space"]) # should return *something* that was pressed?
print 'keys = ',keys
if len(keys) > 0: # logic given a keypress
print 'pressed'
catchResponse[0] = 1
else:
print 'not pressed'
catchResponse[0] = 0
else:
maskNum = str(1)
doFixate(FixateTimeout)
actualStim.setSF(Circle1[stimCount][1])
actualStim.setOri(Circle1[stimCount][2])
#doMask(MaskTimeout,maskNum)
print stimCount+1, inCatch
if inCatch == 1:
print str(keyMap[response["firstKey"]])
doStimulus(None, StimTimeout, None)
doMask(MaskTimeout,maskNum)
Output:
5 0
1
6 0
1
2
7 catch [0, 1]
keys = []
not pressed
8 0
据我所知,事件.getKeys()返回自上次调用getKeys或调用clearEvent后按下的所有键的列表。在
在这种情况下,我不明白为什么钥匙总是空的。我尝试过将getKeys事件移动到整个循环中,但是没有成功。在
我将非常感谢你的帮助, 本
目前没有回答
相关问题 更多 >
编程相关推荐