Previous topic

Reference Manual (API)

Next topic

psychopy.visual - many visual stimuli

This Page

Quick links

psychopy.core - basic functions (clocks etc.)

Basic functions, including timing, rush (imported), quit

class psychopy.core.Clock

A convenient class to keep track of time in your experiments. You can have as many independent clocks as you like (e.g. one to time responses, one to keep track of stimuli...) The clock is based on python.time.time() which is a sub-millisec timer on most machines. i.e. the times reported will be more accurate than you need!

getTime()

Returns the current time on this clock in secs (sub-ms precision)

reset(newT=0.0)

Reset the time on the clock. With no args time will be set to zero. If a float is received this will be the new time on the clock

psychopy.core.quit()

Close everything and exit nicely (ending the experiment)

psychopy.core.shellCall(shellCmd, stderr=False)

Call a single system command with arguments, return its stdout. Returns stdout,stderr if stderr is True. Does not handle pipes (“|”).

psychopy.core.wait(secs, hogCPUperiod=0.20000000000000001)

Wait for a given time period.

If secs=10 and hogCPU=0.2 then for 9.8s python’s time.sleep function will be used, which is not especially precise, but allows the cpu to perform housekeeping. In the final hogCPUperiod the more precise method of constantly polling the clock is used for greater precision.

If you want to obtain key-presses during the wait, be sure to use pyglet and to hogCPU for the entire time, and then call event.getKeys() after calling core.wait()