

An error of 16.7ms might be acceptable to long-duration stimuli, but not to a brief presentation. So using this method you get timing accurate to the nearest frame period but with little consistent precision. Alternatively, if the time has reached 2.001s, there will not be an extra frame drawn. If the screen is refreshing at 60Hz (16.7ms per frame) and the getTime() call reports that the time has reached 1.999s, then the stimulus will draw again for a frame, in accordance with the while loop statement and will ultimately be displayed for 2.0167s.

In the above, the stimulus does not actually get drawn for exactly 0.5s (500ms). flip ()Ĭlocks are accurate to around 1ms (better on some platforms), but using them to time stimuli is not very accurate because it fails to account for the fact that one frame on your monitor has a fixed frame rate. phase += 0.1 # Increment by 10th of cycle win. getTime () < 2.0 : # Clock times are in seconds if 0.5 <= clock. autoLog = False # Or we'll get many messages about phase change # Let's draw a stimulus for 2s, drifting for middle 0.5s clock = core. autoDraw = True # Automatically draw every frame gabor. GratingStim ( win, tex = 'sin', mask = 'gauss', sf = 5, name = 'gabor' ) gabor.

From psychopy import visual, core # Setup stimulus win = visual.
