Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] Gabor grating contrast

edited March 2013 in OpenSesame

Hi,

for my experiment I want to change the contrast of the grating. I wrote a script that accounts for that by interpolating the measured luminance of the screen on a RGB scale. Based on these data points I assess the high and low luminance values and their according RGB values and define them as the two colors for the grating (versions of white/black resp. gray). Works fine for MATLAB.

My problem is, that I just stumbled across the documentation of the gabor function and saw that this might not work since I have to use the Psycho backend. That is, because Psycho backend does not allow changing the background and the second color. Does that mean that the second color would always be black and I would only be able to change the white color in order to manipulate the contrast? Or is only a change in an actual color (like red) not possible but within the range of black and white (so as long as all three RGB values stay the same) it is? I wanted to verify whether that's the case before I start transferring the script to python/opensesame.

If it is not possible to change the second color whatsoever, is there another way to change the contrast of a gabor patch in the Psycho backend?

Thanks!

Michif

Comments

  • edited March 2013

    Hi Michel,

    If you use OpenSesame's built-in Gabor patches, or the openexp.canvas.gabor() function, you can only get maximum contrast Gabor patches using the psycho back-end. However, by using PsychoPy directly you can create any kind of stimuli you like.

    Essentially, PsychoPy works with a single color and a contrast (whereas for example the online Gabor patch generator works with two colors). You can go from color-contrast to two colors like this:

    color1 = contrast * color # The 'maximum' color
    color2 = -1 * contrast * color # The 'minimum' color
    

    The color is usually a value between 1 (white) and -1 (black), but see my post for other examples. So if you set color to 1 and contrast to .05, you get a low contrast Gabor patch:

    from psychopy import visual
    p = visual.GratingStim(win, mask='gauss', contrast=.05, size=128, sf=.1, color=1)
    p.draw()
    win.flip()
    

    For more information, see my recent post or the PsychoPy documentation:

    Cheers!
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

Sign In or Register to comment.