visigoth.Experiment.frame_range

Experiment.frame_range(seconds=None, frames=None, round_func=<ufunc 'floor'>, adjust_for_missed=True, yield_skipped=False, expected_offset=None)[source]

Generator function for timing events based on screen flips.

Either seconds or frames, but not both, are required.

This function can adjust the number of flips generated in real time based on the PsychoPy Window’s estimate of its frame intervals. While not perfect (it can fall behind with consistently missed frames), when combined with expected_offset, this can improve robustness to intermittent timing issues. Doing so assumes that you are looping over this generator and trying to draw on every screen refresh.

Parameters
secondsfloat

Duration of the event in real time.

framesint

Number of screen flips.

round_funccallable, optional

Function used to turn a continuous duration into a integral number of screen flips.

adjust_for_missedbool, optional

If True, decrement the number of total frames to generate when PsychoPy thinks it has missed a flip.

yield_skippedbool, optional

If True, also return a list of flip indices that were missed

expected_offsetfloat, optional

Expected offset time for the stimulus. If provided, the generator will check the experiment clock and end if the next flip will be after the expected offset time.

Yields
frameint

Index into the frame, possibly discontinuous when adjusting for missed flips.

skippedlist of ints, optional

Indices of frames that were skipped if frames have been dropped, only when yield_skipped is True.