How to change aperture location in "Create Procedural Square Wave Grating"?

Dear friends,

How can I change the location of the aperture in CreateProceduralSquareWaveGrating? It is defaulted to be at the center the screen but I would like to manipulate this during an experiment. I saw only a setting on aperture radius in the function but not location. I tried destinationRect in Screen but that scaled (shrieked) the whole thing. Could anyone give some hints?

Thanks!

Please post minimal code showing what you’ve tried

Hello! I tried the ProceduralSquareWaveDemo.m in the PTB package. In brief, it includes

res = 600;
phase = 0;
freq = 0.04;
tilt = 225;
contrast = 0.5;

squarewavetex = CreateProceduralSquareWaveGrating(win, res, res, [.5 .5 .5 0], res/2);

Screen(‘DrawTexture’, win, squarewavetex, [], [], tilt, [], [], [], [], [], [phase, freq, contrast, 0]);

The grating is in an aperture of size res/2 in the middle of the screen.

My question is, how can I move this aperture to another location?

Thanks.

You specify a dstRect in ‘DrawTexture’, e.g.,
dstRect = CenterRectOnPoint(Screen(‘Rect’, squarewavetex), xc, yc);
Screen(‘DrawTexture’, win, squarewavetex, [], dstRect, tilt, [], [], [], [], [], [phase, freq, contrast, 0]);

To place the aperture centered on position xc, yc.

Hi Mario! Thanks so much!