psychopy.org | Reference | Downloads | Github

Opposite colors for my stimuli

color

#1

Hi,

I am using python since may 2018 and I’m learning to use psychopy. I try to create a dot that should be red but, when I set the color to red, the dot is displaying in blue. When I set it to black, the dot is displaying in white. I tried to change the opacity of my fixmark but it isn’t working either. Does anyone have a clue on how to fixe it?

I’m coding with VSCode on Mac(version 10.11.6) and I installed psychopy 1.90.3.

Thank you!


#2

Show us the relevant code please.


#3

Hi and thank you for the quick reply!

I created two files:

Constant.py

DISPSIZE=(1440, 900) #Display of my screen. A tuple

#doit etre en RGB. Psychopy interprete de meme.

FGC=(-1,-1,-1) #foreground color textes et lignes.

BGC=(0,0,0) #background color. '''

experiment.py
'''#Window is a class
from psychopy.visual import Window, GratingStim, ImageStim
from constants import DISPSIZE, FGC
from psychopy.core import wait #une fct
import numpy as numpy

disp=Window(size=DISPSIZE, units='pix',fullscr=True)
img=ImageStim(disp,image='/Users/gassersaleh/Documents/Programmation/pratique_psychoexp/example.jpg')

fixmark=GratingStim(win=disp,mask="circle",size=15,pos=[-4,0],sf=3,colorSpace='rgb255') #(disp,radius=6,edges=64,lineColor=FGC,fillColor=FGC)
fixmark.opacity=3
fixmark.fillColor=FGC
fixmark.setColor([255,255,255]) #gives an inversed color

fixmark.draw()
disp.flip()
wait(1)


img.draw()
disp.flip()
wait(2) 

disp.close() 

#4

Firstly:

We can’t easily cut and paste your code if it isn’t formatted as code (e.g. straight quotes become curly quotes).

Secondly:
I’m not really sure what the issue is here. Perhaps things will be clearer if you change the spatial frequency to be 0.03 rather than 3:


#5

Yes, I think the spatial frequency is the issue here. It is so high that the output is a constant, evaluated at the trough of the grating - changing the phase to be 0.5 recovers the desired colour.

I think a Circle is better suited to the purpose.


#6

Terrific! Thank you so much for your help!


#7

Oh terrific! Thank you so much for your help and I’ll definitely pay attention for the code formatting!