Howdy, Stranger!

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

Supported by

Non-opposite colors for PsychoPy grating stimuli

dear forum,

We're working with a WM task in which color stimuli are to be merged with gratings of different orientations and, subsequently, probed. I'm working now on creating the probes - the merged stimuli (6 colors x 6 orientations = 36 stimuli).

I'm using PsychoPy to this end, and got stuck when trying to set the two colors I want the grating stimuli to have (one has to always be black, and the other color is one of the 6 stimuli colors). PsychoPy only allows defining one color and automatically sets the second color to its opposite.

Should I create my own texture in this case? If yes, I would really appreciate some examples of how to do this with a shade of green (rgb255 - [93, 141, 80]) and black.

Thank you!

cheers,

Valeria

Comments

  • Hi Valeria,

    You could define your own texture, but that's more complicated than necessary in this case. What I would do is simply use the gabor_file() function that OpenSesame uses to generate gabor patches for other backends. This function takes the same arguments as the regular Canvas.gabor() function:

    from openexp import canvas
    from psychopy.visual import ImageStim
    
    path = canvas.gabor_file(orient=30, freq=.05, col1='black', col2='red')
    stim = ImageStim(win, path, mask='gauss')  # mask='gauss' avoids a reddish background
    stim.draw()
    win.flip()
    

    This function is considerably slower than using PsychoPy's GratingStim . But for most purposes it's still fast enough.

    Cheers!

    Sebastiaan

Sign In or Register to comment.