# EnvelopeGrating¶

## Details¶

class psychopy.visual.EnvelopeGrating(*args, **kwargs)[source]

Second-order envelope stimuli with 3 textures; a carrier, an envelope and a mask

Examples:

env1 = EnvelopeGrating(win,ori=0, carrier=’sin’, envelope=’sin’,

mask = ‘gauss’, sf=24, envsf=4, size=1, contrast=0.5, moddepth=1.0, envori=0, pos=[-.5,.5],interpolate=0) # gives a circular patch of high frequency carrier with a # low frequency envelope

env2 = EnvelopeGrating(win,ori=0, carrier=noise, envelope=’sin’,

mask = None, sf=1, envsf=4, size=1, contrast=0.5, moddepth=0.8, envori=0, pos=[-.5,-.5],interpolate=0) # If noise is some numpy array containing random values gives a # patch of noise with a low frequency sinewave envelope

env4 = EnvelopeGrating(win,ori=90, carrier=’sin’, envelope=’sin’,

mask = ‘gauss’, sf=24, envsf=4, size=1, contrast=0.5, moddepth=1.0, envori=0, pos=[.5,.5], beat=True, interpolate=0) # Setting beat will create a second order beat stimulus which # critically contains no net energy at the carrier frequency # even though it appears to be present. In this case carrier # and envelope are at 90 degree to each other

With an EnvelopeStim the carrier and envelope can have different spatial frequencies, phases and orientations. Its position can be shifted as a whole.

contrast controls the contrast of the carrier and moddepth the modulation depth of the envelope. contrast and moddepth must work together, for moddepth=1 the max carrier contrast is 0.5 otherwise the displayable range will be exceeded. If moddepth < 1 higher contrasts can be accommodated.

Opacity controls the transparency of the whole stimulus.

Because orientation is implemented very differently for the carrier and envelope using this function without a broadly circular mask may produce unexpected results

Using EnvelopeStim with images from disk (jpg, tif, png, …)

Ideally texture images to be rendered should be square with ‘power-of-2’ dimensions e.g. 16x16, 128x128. Any image that is not will be upscaled (with linear interpolation) to the nearest such texture by PsychoPy. The size of the stimulus should be specified in the normal way using the appropriate units (deg, pix, cm, …). Be sure to get the aspect ratio the same as the image (if you don’t want it stretched!).