0

我们正在尝试在 PsychoPy 中重新创建一个 3x3 的同时窗口网格,每个窗口都显示径向光流模式,如 Cardin 和 Smith (2010) 所述。当我们运行代码时,刺激太慢了(需要一段时间才能加载)。如何加快速度?在绘制每个窗口后进行一次翻转会有所帮助吗?

卡丹和史密斯,2010;人类视觉和前庭皮质区域对自我运动兼容的视觉刺激的敏感性。大脑皮层

4

1 回答 1

2

论文中的细节非常稀疏,但只是为了确保:您可能不想在同一个(全屏)窗口中绘制 9 个不同的窗口,而是要绘制 9 个不同的刺激。所以我会做这样的事情:

import random
from psychopy import visual
win = visual.Window()

# Create 9 dotstims
stims = []
for xPos in range(-1, 2):
    for yPos in range(-1, 2):
        stims += [visual.DotStim(win, fieldPos=(xPos, yPos), fieldShape='circle', dotLife=30, speed=0.01, fieldSize = 0.2, nDots=50, dir=random.randint(0, 359))]

# Draw for 120 frames
for frame in range(120):
    for stim in stims:
        stim.draw()
    win.flip()

您可能希望将值更改为dir比上面示例中的随机值更系统的值fieldPos。性能方面,这在我的笔记本电脑上有点边界,因为draws 的最大持续时间为 11.5 毫秒。这接近 16.667 毫秒很危险,但您可以在刺激计算机上自行测试。就放

from psychopy import core
timerClock = core.Clock()

在脚本的开头,然后使用以下内容循环帧:

for frame in range(120):
    timerClock.reset()
    for stim in stims:
        stim.draw()
    print timerClock.getTime()  # should be consistently below 0.016 seconds on a 60 Hz monitor.
    win.flip()
于 2015-01-27T19:09:04.117 回答