目前,我尝试创建一个嵌入了楼梯程序的视觉古怪任务(使用 Psychopy v1.81.03,构建器版本)。赔率应该遵循楼梯(改变方向的gabor补丁)。标准应该是垂直方向的gabor补丁。我从创建一个简单的随机试验循环开始。在那个循环中,我插入了如下代码组件:
对于“实验开始”,我定义了一个方向变量(也在界面中引用它,其中定义了 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 循环在某种程度上是错误的。但是由于我从来没有收到错误消息,而且我对精神病学也比较陌生,所以我很难找出问题所在。
有人可以帮助我解决这个问题吗?那将是非常棒的。
非常感谢你,
汉内斯