Utilities for keeping track of time in a task.
Counts to a given number then transmits a timeout event.
max_counthas been reached.
>>> from axopy.timing import Counter >>> timer = Counter(2) >>> timer.increment() >>> timer.count 1 >>> timer.progress 0.5 >>> timer.increment() >>> timer.count 0
Increment the counter.
If max_count is reached, the
timeoutevent is transmitted. If reset_on_timeout has been set to True (default), the timer is also reset.
Progress toward timeout, from 0 to 1.
Resets the count to 0 to start over.
Real-time one-shot timer.
This is useful in situations where you want to wait for some amount of time and locking the timing to data acquisition updates is not important. For example, inserting a waiting period between trials of a task can be done by connecting the
timeouttransmitter to your task’s
Parameters: duration (float) – Duration of the timer, in seconds.
Transmitted when the timer has finished.
Start the timer.
Stop the timer.
If you stop the timer early, the timeout event won’t be transmitted.