[visionegg] Re: help with Mask2D

Kevin J. MacKenzie wrote:

Hi Everyone,

I have attached some code that creates a white noise patch, and displays it drifting through a aperture on screen. I would like to add either a gaussian or circular mask to the pattern, and I'm wondering if there is a way to use the Mask2D class instead of calculating a gaussian window myself?

I am creating a texture of this white noise pattern for display, but I'm stuck in terms of how to add a mask to it - if it is even possible using the VisionEgg mask class.

Any help is greatly appreciated,

Kevin MacKenzie

Dear Kevin,

The TextureStimulus class (which you're using) supports a mask defined this way:

mask = Mask2D(function='gaussian', # also supports 'circle'
radius_parameter=25, # sigma for gaussian, radius for circle (units: num_samples)
num_samples=(256,256)) # this many texture elements in mask (covers whole size specified in TextureStimulus)


then, you need to modify your texture stimulus:

NoiseStim = TextureStimulus(texture = NoiseTexture,
                           mask=mask, ...

This works for me with your stimulus. You may want to double check the math in the Mask2D gaussian path to make sure it's doing what you think it's doing. (And let me know if you think it's doing something wrong.)

Cheers!
Andrew

--
Andrew D. Straw  Post-doctoral scholar
,-.              Dickinson Lab
\_/              California Institute of Technology
8||}             Mailcode 138-78
/ \              Pasadena CA 91125, USA
`-^
                email:  astraw@xxxxxxxxxxx
                 office: +1 626 395 4396


====================================== The Vision Egg mailing list Archives: http://www.freelists.org/archives/visionegg Website: http://www.visionegg.org/mailinglist.html

Other related posts: