【发布时间】:2018-04-04 23:07:43
【问题描述】:
我正在尝试通过使用psychopy 来构建决策任务。我以前没有使用 python 或psychopy 的经验,所以这就是为什么我有点卡住了。
我有 15 次试验,每次试验我都会展示一对图片。参与者需要通过按左或右箭头键选择其中一张图片。在他们做出选择后,我想向他们展示他们的选择,并询问他们为什么选择那张照片。
我在psychopy 中创建了一个循环,并分配了一个.xlsx 文件以按顺序显示我的图片。我的问题是,我没有为任何图片分配按键。我只有按键来结束例行程序。那么如何在某次试用中保存参与者按键后的图片并呈现给他\她。
由于我没有任何正确或错误的答案,我无法在我的 .xlsx 文件中添加一个额外的列,然后设置为正确的答案。
如何将按键与视觉刺激(我的图片,同时呈现)联系起来并存储此输入并在之后使用它来显示它们?
# -------Ending Routine "Deney"-------
for thisComponent in DeneyComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# check responses
if secimtuslar.keys in ['', [], None]: # No response was made
secimtuslar.keys=None
trials.addData('secimtuslar.keys',secimtuslar.keys)
if secimtuslar.keys != None: # we had a response
trials.addData('secimtuslar.rt', secimtuslar.rt)
# the Routine "Deney" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()
我可以使用这个trials.addData('secimtuslar.keys',secimtuslar.rt) 变量在循环中的另一个例程中保存和显示吗?
# -------Start Routine "bununedensectin"-------
while continueRoutine and routineTimer.getTime() > 0:
# get current time
t = bununedensectinClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *text_2* updates
if t >= 0.0 and text_2.status == NOT_STARTED:
# keep track of start time/frame for later
text_2.tStart = t
text_2.frameNStart = frameN # exact frame index
text_2.setAutoDraw(True)
frameRemains = 0.0 + 3- win.monitorFramePeriod * 0.75 # most of one frame period left
if text_2.status == STARTED and t >= frameRemains:
text_2.setAutoDraw(False)
我认为我需要在这些行之间嵌入一个有用的代码。
【问题讨论】:
标签: python-2.7 psychopy