Sweeping Bar without using Aperture

I’m working on a task where a bar sweeps across flickering images in 8 different directions. So that all the sweep directions are equal, the flickering images are masked to a circle shape.

My initial approach was do define a GratingStim with a circular mask and the images as the texture and then a rectangular aperture to sweep over this GratingStim. This works well in general, except that since I am defining the bar as an aperture, I can’t add a fixation cross that is always visible in the center of the screen or a square in the corner of the screen for a photodiode.

I tried to fix this by also defining the bar as a GratingStim, but this approach doesn’t work because the texture moves with the position of the bar and I want the background images to remain in the same position while the bar sweeps over them.

I thought another fix might be to display the flickering background and then overlay two GratingStim masks – a bar and then a circle on top, but this isn’t working for me either.

Any ideas on how to best approach this? Thank you!

The problem here is that :aperture: Aperture is applied to the whole screen, so what you’ll probably want to do here is set both the :aperture: Aperture and the :image: Image to have a conditional start time set to False, so basically they never draw. Then you can draw them manually via a :code: Code component, with this in the Each Frame tab:


To have this active only during a specified period/condition, you can put these three lines in an if statement checking against t (time in seconds since the routine started) or whatever True/False variable you like.

Thanks for the response. I am actually only enabling these components when I need them. The problem is that during a trial I need at least 4 components on at a given time:

  1. A circle mask that shows rapidly flickering images within the circle and outside of that circle is grey. Currently using grating stim for this ( mask = raisedCos, tex = my images)

  2. Some type of component that masks out everything other than a transparent bar shape. That way the effect is that you see a bar with flickering images in the background and as the bar moves it appears to sweep over these. Have tried to use aperture and grating stim here with no luck. The problem with aperture is that is needs to be enabled at the same time that I am showing 3 & 4 below which isn’t possible. The problem with grating stim is that if I put the images directly in the texture of the bar the images move with the bar rather than the bar sliding over.

  3. a fixation cross

  4. a square in the corner of the screen for the photodiode

What other ways are there to create masks that aren’t using grating stim or aperture? Is it possible to create something with grating stim that is closer to what can be created with aperture (grey background, completely transparent bar)?

I’m still not clear on why the aperture can’t be enabled at the same time you’re showing 3 & 4 - surely you should be able to do:

for stim in stimuliToBeApertured:
for stim in allOtherStim: