psychopy.org | Reference | Downloads | Github

Error when setting the stimulus size to 152 pixels

Hello everbody,

right now we try to replicate a yes-no visual contrast detection task.
For this we have all the needed specifications about how the noise and the stimulus (a vertical grating signal) need to look like. Since PsychoPy offers the useful classes GratingStim and RadialStim creating these kinds of signals was not the problem:

X = 256; # width of the gabor patch in pixels
sf = 0.02; # spatial frequency, cycles per pixel

gabortexture = (
    visual.filters.makeGrating(res=X, cycles=X * sf) *
    visual.filters.makeMask(matrixSize=X, shape="circle", range=[0, 1])
)

# a X-by-X array of random numbers in [-1,1]
noisetexture = random([Y,Y])*2.-1.

signal = visual.GratingStim(
    win = window, tex = gabortexture, mask = 'circle', pos=[0 + xoffset,0],
    size = X, contrast = 1.0, opacity = threshold
)

noise = visual.RadialStim(
    win = window, mask='none', tex = noisetexture, pos=[0 + xoffset,0],
    size = X, contrast = 1.0, opacity = 1.0
)

The problem we are facing right now is the correct size of the signals (noise and stimulus) which need to be 152 pixels and not 256 pixels. But when we change it to 152 pixels we get the error “Requiring a square power of two (e.g. 16 x 16, 256 x 256) texture but didn’t receive one”.
Is there a way to create the signals with the correct size?

I hope you can help.
Thanks in advance,
Franca