spike.control
High resolution timer with a milliseconds resolution emulating spike timer interfaces on standard python
Functions
|
Default function for wait_until function :meta private: |
|
Waits for a specified number of seconds before continuing the program. |
|
Waits until the condition is true before continuing with the program. |
Classes
|
Timer mocking class |
- spike.control.equal_to(a, b)
Default function for wait_until function :meta private:
- class spike.control.Timer
Timer mocking class
- __init__()
Contructor
- now()
Retrieves the “right now” time of the Timer.
- Returns:
the current time, specified in seconds.
- Return type:
integer
- reset()
Sets the Timer to “0.”
- spike.control.wait_for_seconds(seconds)
Waits for a specified number of seconds before continuing the program.
- Parameters:
seconds (float) – time to wait in seconds
- Raises:
TypeError – seconds is not a number
ValueError – seconds is not at least 0
- spike.control.wait_until(get_value_function, operator_function=<function equal_to>, target_value=True)
Waits until the condition is true before continuing with the program.
- Parameters:
get_value_function (callable) – a function that returns the current value to be compared to the target value.
operator_function (callable) – a function that compares two arguments. The first argument will be the result of get_value_function(), and the second argument will be target_value. The function will compare both values and return the result.
target_value (any type) – any object that can be compared by operator_function.
- Raises:
TypeError – get_value_function or operator_function is not callable or operator_function does not compare two arguments.