我对python语言和精神病相当陌生。我通过创建虚拟实验来练习。在这里,我试图创建一个关于贝叶斯大脑的实验。非垂直线将呈现给参与者,而参与者不需要响应,只是暴露。然后对于最后一次试验(它在监视器上停留较长时间等待响应),则期望参与者判断最后一次试验是否垂直?(在暴露于非垂直线之后,我希望看到垂直感的变化)。在
然而,有太多的事情我不能从网上学到。我很确定你们可以很容易地帮我。在
我的主要问题是:如何设置生产线的方向?我发现了刺激但不知道如何在“在线”刺激下使用它。下面我附上了我迄今为止所做的代码。另外,我用#添加了一些额外的问题。在
我尽量弄清楚。对不起,我的英语不好。 谢谢您!在
from psychopy import visual, core, event #import some libraries from PsychoPy
import random
#create a window
mywin = visual.Window([800,600],monitor="testMonitor", units="deg")
#stimuli
lineo = visual.Line(mywin, start=(-5, -1), end=(-5, 1))
fixation = visual.GratingStim(mywin, size=0.2, pos=[0,0], color = 'black')
#draw the stimuli and update the window
n = 5 # trial number
i = 0
while i < n:
#fixation
fixation.draw()
mywin.flip()
presses = event.waitKeys(1)
# stimulus
orientationlist = [20,30,40,50,60] # I want to draw the orientation info from this list
x = random.choice(orientationlist)
lineo.ori((x)) #
lineo.draw()
mywin.flip()
presses= event.waitKeys(2)
i +=1
if i == 5: # how do I change the number into the length of the trial; len(int(n) didnt work.
lineo.draw()
mywin.flip()
presses = event.waitKeys(4)
#quiting
# I dont know how to command psychopy for quiting the
# experiment when 'escape' is pressed.
#cleanup
mywin.close()
core.quit()
有几件事你想做的不同。我已经更新了您的代码,并用注释“CHANGE”标记了更改。在精神病患者中,改变刺激的方向是相当一致的,因此
Line
与其他视觉刺激类型没有什么不同。在相关问题 更多 >
编程相关推荐