using visual.Aperture on visual.DotStim ?

131 views
Skip to first unread message

Magdalena Wutte

unread,
Aug 22, 2011, 11:57:41 AM8/22/11
to psychopy-users, magdale...@univ-provence.fr
Dear all,

I am using a random dot stimulus (circle), unfortunately, at the long
dot-lifetime that is necessary for my stimulus (>200ms), the
distribution of dots gets inhomogeneous.
As an easy hack I thought to just use the .Aperture function and show
only the homogeneous part of my stimulus; But while .Aperture works
fine for moving stimuli like the gabor-patch, I cannot get it to work
with DotStim. Below the code snippet how I tried to to use .Aperture
on DotStim (in parallel to what worked for the moving garbor).

It might be not the best way to approach this problem, but if you have
any suggestion how I could get it to work, or an alternative solution
how I could get a circle of homogeneous distributed random dots with a
lifetime of >200ms, I would be quite thankful.

Ta!


---------------------------------------------------------------------------------------------
Code:

from psychopy import visual, event, core

#create a window to draw in
myWin =visual.Window((600,600), allowGUI=False,
bitsMode=None, units='norm', winType='pyglet')

#initialize dot stimulus
dotPatch =visual.DotStim(myWin, color=(1.0,1.0,1.0), dir=270,
nDots=500, fieldShape='square', fieldPos=(0.0,0.0),fieldSize=1,
dotLife=5, #number of frames for each dot to be drawn
signalDots='same', #are the signal and noise dots 'different' or
'same' popns (see Scase et al)
noiseDots='direction', #do the noise dots follow random- 'walk',
'direction', or 'position'
speed=0.01, coherence=0.9)

#initialize aperture
aperture = visual.Aperture(myWin, size=0.5,pos=[0.0,
0.0],shape='circle')
aperture.enable()


trialClock =core.Clock()
while True:#forever
dotPatch.draw()
myWin.flip()#redraw the buffer

#handle key presses each frame
for key in event.getKeys():
if key in ['escape','q']:
print myWin.fps()
myWin.close()
core.quit()
event.clearEvents('mouse')#only really needed for pygame windows

Yuri Spitsyn

unread,
Aug 22, 2011, 8:02:23 PM8/22/11
to psychopy-users
Hi Magdalena,

To make Aperture work you need specify attribute allowStencil=True
when creating a window.
This is what lets aperture do its work and by default it is disabled.
So the window creation statement in your example should look like
this:

myWin =visual.Window((600,600), allowGUI=False, bitsMode=None,
units='norm', winType='pyglet', allowStencil=True)

I feel like this attribute should have been named more semantically
friendly, like allowAperture, because not everybody is an OpenGL guru
and is supposed to know what stencil stands for.

Best,
-Yuri Spitsyn

Jonathan Peirce

unread,
Aug 23, 2011, 4:13:54 AM8/23/11
to psychop...@googlegroups.com

On 23/08/2011 01:02, Yuri Spitsyn wrote:
> I feel like this attribute should have been named more semantically
> friendly, like allowAperture, because not everybody is an OpenGL guru
> and is supposed to know what stencil stands for.
yeah, fair enough. Or we simply enable it by default. I'd be very
surprised if it actually carries any performance hit.

Jon

--
Dr. Jonathan Peirce
Nottingham Visual Neuroscience

http://www.peirce.org.uk/


This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

Reply all
Reply to author
Forward
0 new messages