Fill shapes with gratings

Dear Psychopy experts,
I have a background made with little gratings with same orientation. I need to display on this background, two shapes (circle and ellipse) that are filled with same gratings as the background but with different orientation. This should lead to shapes perceivable using the texture (secondary to a different orientation of gratings).

I was able to perform this using squares, but I’d like to use circular shapes.
OR, is it possible to draw circular lines and select only gratings inside these lines and change their orientation?

Thank you all,
Marco

Hi Marco, I’m not sure I understand what you are after (maybe a diagram would help), but I wonder if the Aperture class is what you need (once enabled, it restricts drawing to occur within a certain shaped area):

https://www.psychopy.org/api/visual/aperture.html

There is an aperture.py demo available from the Demos -> stimuli menu.

1 Like

Thank you for your reply. I attached (hoping is visible) the idea of the stimuli I’d like to create. Here I created two squares but I would have circles.
I think your suggestion sounds appropriate. I’ll give a try, and in case I will accept your reply as solution.

So, I used aperture on my square stimuli with the shape of a circular aperture to display circle.
My questions are:

1- is it possible to have 2 aperture in the same time ( i.e.: aperture1 and aperture2 enabled)?
2- is it possible to “play” with the aperture so that it changes shape to more ellipse-like?

Only one aperture is active at a time, but you can use them in sequence. e.g. draw the background, then enable the first aperture, draw something thorough it, then disable it and enable the second, draw through that, and then finally do a win.flip() to display the final product. Or depending on the differences, you might just have one aperture, but change its attributes as required (position, shape, etc).

Yes, they can have arbitrary shapes.

2 Likes

That’s working!
Now I am going to play with shapes and try to have an ellipse.

Thank you a lot with this!