如何在奇怪的任务中嵌入楼梯

时间:2014-12-15 17:32:21

标签: python psychopy

目前我尝试使用嵌入其中的楼梯程序创建视觉奇怪任务(使用Psychopy v1.81.03,构建器版本)。赔率应该跟随楼梯(改变方向的gabor补丁)。标准应该是垂直定向的gabor补丁。 我开始创建一个简单的随机trial_loop。在该循环中,我插入了如下代码组件:

对于“实验的开始”,我定义了一个方向变量(也在界面中引用它,其中定义了gabor补丁的属性)和楼梯:

 orient = 20
 staircase = data.StairHandler(startVal = 20.0,
                  stepType = 'lin', stepSizes=[8,4,4,2,2,1,1],
                  maxVal = 90, minVal = 0, nUp=1, nDown=3, nTrials = 50)

对于“常规开始”,我定义了刺激的表现 和if语句,应该根据它是标准还是奇数来选择方向。

# ratio of oddball and standard
oddORstand = [1, 1, 1, 1, 1, 1, 1, 1, 1, 2][randint(0,10)]
 # choosing orientation and correct answer depending if it's standard or odd 
if oddORstand == 1: #standard
    orient = 0
    corrAns = None
else: #odd
    for thisIncrement in staircase:
        orient = orient + thisIncrement
        corrAns = 'space'
        break

对于“结束例程”的部分,我定义了应该改变未来赔率方向的响应,这取决于它是否是正确答案(检测 - 空格键是否按下):

if oddORstand == 2: #it was an odd
    if key_resp_stand.keys == 'space': #space bar pressed, correct answer
        thisResp = 1
        staircase.addResponse(thisResp)
    elif key_resp_stand.keys != 'space': #space bar was not pressed, wrong answer
        thisResp = 0
        staircase.addResponse(thisResp)
    else:
        pass

一般来说,这种方式有所不同(标准和赔率是随机呈现的,而且赔率也会改变其方向,但不会以有意义或有意的方式改变)。 我可以想象没有正确检测到反应或将其添加到楼梯上。另一种可能性是,设置赔率方向的for循环在某种程度上是错误的。 但是因为我从来没有得到过错误消息,而且我对心理学也相对较新,所以找出问题对我来说有点棘手。

有人可以帮我解决这个问题吗?那将是非常好的。

提前非常感谢,

汉纳斯

0 个答案:

没有答案