As a result, on most cards, as long as frames are not being ‘dropped’ (see Detecting dropped frames) you can present stimuli for a fixed, reproducible period.
![psychopy drawing a stimulus based on if statement psychopy drawing a stimulus based on if statement](https://s1.studyres.com/store/data/002726983_1-2c0f8e9b753115ee2b706e0c5c426ca0.png)
Calls to Window.flip() will be synchronised to the frame refresh the script will not continue until the flip has occurred. The frame rate is extremely precise, much better than ms-precision. At 60Hz refresh you can not present your stimulus for, say, 120ms the frame period would limit you to a period of 116.7ms (7 frames) or 133.3ms (8 frames).Īs a result, the most precise way to control stimulus timing is to present them for a specified number of frames. By writing scripts in standard Python syntax users can generate an enormous variety of visual and auditory stimuli and can interact. It is designed to allow the construction of as wide a variety of neuroscience experiments as possible, with the least effort.
PSYCHOPY DRAWING A STIMULUS BASED ON IF STATEMENT SOFTWARE
It also might also give the false impression that a stimulus can be presented for any given period. PsychoPy is a software library written in Python, using OpenGL to generate very precise visual stimuli on standard personal computers. 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.
![psychopy drawing a stimulus based on if statement psychopy drawing a stimulus based on if statement](https://cdn.slidesharecdn.com/ss_thumbnails/essentialbiologye1stimulusandresponse2011-110115211904-phpapp01-thumbnail.jpg)
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. setPhase ( 0.1, '+' ) # increment by 10th of cycle win. getTime () < 2.0 : # clock times are in seconds if 0.5 <= clock. from psychopy import visual, core win visual.Window( 400,400) message visual.TextStim(win, text'hello') tAutoDraw(True) automatically draw every frame win.flip() core.wait(2.0) tText('world') change properties of existing stim win.flip() core.wait(2. Clock () #let's draw a stimulus for 2s, drifting for middle 0.5s while clock. autoLog = False #or we'll get many messages about phase change clock = core.
![psychopy drawing a stimulus based on if statement psychopy drawing a stimulus based on if statement](https://textilestudygroup.co.uk/wp-content/uploads/2011/06/Kay-Greenlees-Miners-Moon.jpg)
setAutoDraw ( 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.