CallbackSleep¶
- class odl.solvers.util.callback.CallbackSleep(seconds=1.0)[source]¶
Bases:
Callback
Callback for sleeping for a specific time span.
Methods
__call__
(x)Sleep for a specified time.
reset
()Reset the callback to its initial state.
- __init__(seconds=1.0)[source]¶
Initialize a new instance.
- Parameters:
- secondsfloat, optional
Number of seconds to sleep, can be float for subsecond precision.
Examples
Sleep 1 second between consecutive iterates:
>>> callback = CallbackSleep(seconds=1)
Sleep 10 ms between consecutive iterate:
>>> callback = CallbackSleep(seconds=0.01)