在我的实验中,参与者必须以视觉评定量表进行一系列评分。
首先,我初始化屏幕并添加相应的可视组件。我的变量recall
创建了评分量表,提供了2种选择:"是"和"不"。
稍后,使用vasTitle
变量创建一个标题,询问“你还记得这幅画吗?'他们必须回答"是"或"否"在与问题相同的屏幕上显示的比例。
现在我想根据参与者是否回答"是"来调整我的recall
声明。或"否"但我不知道该怎么做。如果参与者回答"否"我想谈谈他们对之前答案的信心(在这种情况下,这就是问题所在。)
我这样做是通过创建另一个比例,他们必须回答"是"或"不"他们对自己以前的回答是否有信心,他们是否回忆起这幅画。当我运行我的代码时,它在我调整recall
变量时就会中断。您可以在代码的最后看到我尝试过的内容,但它似乎无法正常工作。
from psychopy import visual
# Intialize screen
win = visual.Window(size=(1440, 900), fullscr=True, screen=0, allowGUI=False, allowStencil=False, monitor='testMonitor', color=[0,0,0],
colorSpace='rgb', blendMode='avg', useFBO=True, units='deg')
# Initialize Visual Components
recall = visual.RatingScale(win, choices=("Yes", "No"), markerStart=0.5, singleClick=False,
disappear=False, respKeys=['left', 'right'], showAccept=False, acceptKeys='up')
vasTitle = visual.TextStim(win=win, ori=0, name='vasTitle', text=u'+', font=u'Arial',
pos=[0, 5], height=1.0, wrapWidth=None, color=u'white', colorSpace='rgb', opacity=1,
depth=0.0)
vasScore = visual.TextStim(win=win, ori=0, name='vasScore', text=u'+', font=u'Arial',
pos=[0, -3], height=1.0, wrapWidth=None, color=u'white', colorSpace='rgb', opacity=1,
depth=0.0)
confidence2 = visual.RatingScale(win, low=1, high=6, labels=("Sure I don't know", "Sure I know"),
marker='glow', markerColor='LightGrey', singleClick=False, noMouse=True,
showValue=False, markerStart = 3.5, showAccept=False,
leftKeys='left', rightKeys='right', acceptKeys = 'up',
disappear=False)
# Start trial of experiment
for tr in range(1):
# Recall
recall.reset()
vasTitle.setText('Do you remember this painting?')
while recall.noResponse:
vasTitle.draw()
recall.draw()
win.flip()
showText(text='+', time=0.5, FrameRate=Exp.FrameRate)
if recall.Response == "No": #PROBLEM HERE
confidence2.reset()
vasTitle.setText('How sure are you of your previous answer?')
while confidence2.noResponse:
vasTitle.draw()
confidence2.draw()
vasScore.setText('%i' %(confidence2.getRating()))
vasScore.draw()
win.flip()
showText(text='+', time=0.5, FrameRate=Exp.FrameRate)
答案 0 :(得分:3)
你应该对如何使用这个库做更多的研究。在您的代码recall
中是visual.RatingScale
的实例。当用户验证确定答案(向上键)时,似乎while recall.noResponse
循环结束。当此循环结束时,您可以访问不同的属性:
while recall.noResponse:
vasTitle.draw()
recall.draw()
win.flip()
# this loop is ended when the 'up' key is pressed to validate the answer
rating = recall.getRating() # Stores the final answer
decisionTime = recall.getRT() # Stores the decision time (sec)
choiceHistory = recall.getHistory() # Stores tulpes of (answer, time)
以下是一些可以帮助您的链接:
github项目https://github.com/psychopy/versions/blob/master/psychopy/visual/ratingscale.py RatingScale()http://www.psychopy.org/api/visual/ratingscale.html#psychopy.visual.RatingScale
的api doc