【Coder】PsychoPyでガウシアンブロッブを徐々に出現させる(Python)

10フレームかけてボワッと出てくるだけ。

#!/usr/bin/env python
# -*- coding: utf-8 -*-

### This is a demonstration for gradual color change of gaussian blob.
###		A gaussian blob gradually appears.
###		
### 2021.01.15

from __future__ import division
from psychopy import visual, core, event

win = visual.Window(monitor='testMonitor',units='deg',allowGUI=False,fullscr=True) # 'monitor' must be changed depending on your psychopy setting.

fps=win.monitorFramePeriod
print(['fps: '+str(fps*1)])	# Just for checking refresh rate.

stimdur = 10	# 10 frames for stimulus duration.

stim = visual.GratingStim(win, sf=0, color=[0,0,0], pos=(0.0,0.0),maskParams={'sd':10})
stim.mask = 'gauss'	# Set 'circle' if you want to show rectangular stimulus.
stim.size = 10	# 5 for alternative.

blobcol = 0
for frameNum in range(stimdur):
	blobcol = blobcol + (1/stimdur)
	stim.color = blobcol
	stim.draw()
	win.flip()

win.close()
core.quit()

2021.01.17 初版

↑ PAGE TOP