Controlling GratingStim colors

Hello,

When creating a gabor patch, how do I change the color of every other bar? The following line produces red bars with every other being light blue. A blue patch yields blue and yellow bars.

gabor = visual.GratingStim(win, tex='sin', mask='gauss', units="deg",size=(4,4), sf=(2,2), color="red")

Could someone explain to me why this is, and if there is a way to control both colors rather than just the one?

Cheers,
Steve

The colors are designed to average to the mean grey of the screen. Otherwise your color would alter the overall luminance and chromaticity of the patch, which vision scientists don’t like.

You can create arbitrary colors by creating custom textures though:
https://groups.google.com/forum/#!topic/psychopy-users/WQfw2PKUHg4

1 Like

I am reviving this thread to ask a follow-up question: If i am to use a custom background image, will the gabor patch average to that value?

Additionally, is there a way to change the white portion of a gabor to a different color, leaving the black the same?

No, grating does nothing to inspect the background. It’s assumed to be grey

As I say, if you need custom texture then you need to create them as numpy arrays (or even just images if you only have a few that you need) in advance and pass that as the texture to the grating.

1 Like