基于psychopy的ssvep刺激
作者:互联网
from psychopy import visual, core
import numpy as np
win = visual.Window(size=(1280, 130), pos=(0, 543), color=(0, 0, 0))
pic_path = 'somepic.JPG'
timer = core.Clock()
timer.reset()
block = visual.ImageStim(win, pos=(-0.82, 0), size=(0.3, 1.8))
block.image = pic_path
frq = 1
now_time = 0
block.autoDraw = True
while now_time<10 :
now_time = timer.getTime()
# block.opacity = abs(np.sin(2 * np.pi * now_time* frq/2))
block.opacity = np.sin(2 * np.pi * now_time * frq)
# opacity 的值 为0~1 大于1取1,小于0取0
# block.contrast = np.sin(2 * np.pi * now_time * frq)
# block.draw()
win.flip()
win.close()
此处使用了两种思路,一种是通过改变刺激的不透明度opacity,来实现“闪烁”的效果,另一种是使用改变对比度contrast,来实现闪烁的效果。
暂未发现使用psychopy直接画出色块的功能。
标签:基于,win,pic,ssvep,pos,visual,psychopy,block 来源: https://www.cnblogs.com/DWYCWWYHWYA/p/15509045.html