| Reference | Downloads | Github

Does the first frame number (frame N) start with 0 or 1?

For example, if I want to present a stimulus for 10 frames starting from the beginning of the trial, should the start and stop frames be 0 and 9, or 1 and 10?


PsychoPy is written in Python, and Python is a language that counts from 0. So yes, you should start counting from 0 (not a silly question, as more mathematically-oriented languages like R and MATLAB count from 1).

The trickier thing is the “stop” number, which should probably be 10, rather than 9. i.e. present for 10 frames (0 through 9) and stop on the 11th (number 10). In Builder settings, it is probably easiest to set a start frame N of 0 and instead of setting the “stop” value specified as frame N, specify it as duration (frames) of 10, which should be less ambiguous.


Michael, thanks very much. To verify, does the “stop” frame N therefore indicate the first frame at which the stimulus is no longer present, rather than the last frame during stimulus presentation?