| Reference | Downloads | Github

Black bars delay respect to white bars presentation during simple grating visual stimulus

I wrote a simple code in Python 3 to present vertical gratings and invert them every second. The code seems to work fine but when I measured a single bar timing with a photometer, I found that the transition between black and white is exactly every second while the transition between white and black is slower and take place after about 70ms that the other black bars became white. So basically I have 70ms during which I have all the screen white.
To study electrophysiology parameters I need that black bars and white bars invert simultaneously.
I think that this delay is due to Psychopy architecture, but maybe I was wrong with coding.
Anyone of you encountered the same problem?
Is there any possibility to solve it or I have to code without Psychopy?
Any suggestions are very appreciated

Here is the code:

from psychopy import visual, core, event

# Setup the Window
win = visual.Window(size=(1280, 800), fullscr=True, screen=0, 
             monitor='testMonitor', color=[0,0,0], colorSpace='rgb')
grat_stim=visual.GratingStim(win=win, tex='sqr', units='pix', 
                         pos=(0.0,0.0), size=(1280), 
                         sf=0.01, ori=0, phase=0.0 )
grat_stim.autoDraw = True

# Show gratings
while x<15:

     grat_stim.phase=grat_stim.phase + 0.5


That’s almost certainly not something in PsychoPy, or it’s not something PsychoPy can control, based on this code. In your code, there is one flip from buffer to screen per second. The buffer that PsychoPy is constructing has no state where it is all white, as far as PsychoPy is concerned it should have two discrete states that are simply the two phases of your grating, and the transition between the two should be immediate.

That basically cuts it down to two possibilities: The monitor itself (this does sound like something an LCD might have trouble with), or something in the underlying rendering code at a very, very deep level that PsychoPy can’t control. Have you ever used this particular monitor for this kind of display before?

Thank you jonathan for your answer.
The monitor I am using to present the visual stimulus is a chatode ray tube, so I don’t think this phenomena is due to input lag or other monitor problems, however I am writing a new code using tkinter to present two images (of gratings in different phase) that alternate every second. In this way I hope to better understand the problem. If you have any other suggestions would be very appreciated.

This is quite puzzling. Can you give us a few more hardware details? Essentially, if I have this correct, your white-to-black changes are several refreshes late in happening. Do you have the CRT brightness jacked to the extreme? Please identify your OS, video card, monitor and whether you have any other video output ( 2nd monitor? ). Also 1280x800 is more usually a projector resolution than a CRT resolution.