psychopy.org | Reference | Downloads | Github

Equation underlying GratingStim


#1

Dear all,

I’m using PsychoPy2 (v1.84.2) and created a grating stimulus from the builder according to:

visual.GratingStim(win=win, name=‘patch1’,units=‘cm’,
tex=‘sin’, mask=‘raisedCos’,
ori=0, pos=[0,0], size=10, sf=0.4, phase=0.0,
color=[1,1,1], colorSpace=‘rgb’, opacity=1.0,
texRes=512, interpolate=True, depth=-1.0)

I would like to know the underlying equation that generates the resulting stimulus. In a paper (link below), I found the following equation which is definitely not the exact equation for my stimulus:

G(x,y)=background * (1 + contrast * exp((-(x-x_s)^2)/sigma_xs^2 - ((y-y_s)^2)/sigma_ys^2) * sin(2*pi * sf * (x-x_s))+phase)

where G refers to the stimulus at coordinates x and y. x_s and y_s denote the coordinates of the stimulus center. sigma_xs and sigma_ys are the standard deviations of the width and height of a Gaussian envelope. However, as shown above, I have used a “raisedCos” mask and opacity instead of contrast.

Could you please give me the exact equation for the parameters that I used?

Link to the paper:


Tips for reporting PsychoPy-generated stimuli in a paper