psychopy.org | Reference | Downloads | Github

Create grating stim with diverse shapes other than circle/square

Hi all,
I’ve been trying to create grating stims like the one below. I know you can create these kind of stimuli using gratingStim and that you are able to create circles and squares by changing the “mask” argument ( eg mask=‘circle’)
However, I want to create other stimuli, with this same grating, I just want to change the shape of the stimulus. Instead of a circle I want to create a cross, a triangle and an hexagon.
I’m having trouble finding a appropriate way to this. Anyone has experience with this and can point me in the right direction?

gaborcirc = visual.GratingStim(myWin, tex=“sin”,mask=“circle”,texRes=256,
size=[0.5,0.5], sf=[8,0], ori =0, name=‘gaborcirc’, pos=[0.5,0.0]) # grating stim with a circle shape

Thank you!

consuelo

circleGrating

Sorry for the delay replying to this query (I didn’t see it).

Yes, you can supply any arbitrary image filename as the ‘mask’. White pixels in your mask image will be visible areas of the grating, black pixels will be invisible and intermediate greyscales will be semi-transparent

ah , thank you Jon. I hadn’t consider that option.
But I did find a helpful discussion that - that helped me achieve the same thing:

https://groups.google.com/forum/#!topic/psychopy-users/d0FPJaXIw_k