wait_until

typhoon.test.capture.wait_until(name, region, value, from_region=None, interval=1, timeout=60)

Waits until signal meets specified conditions.

Parameters:
  • name – Same as find function (see below)

  • region – Same as find function (see below)

  • value – Same as find function (see below)

  • from_region – Same as find function (see below)

  • interval – Time between reads of the signal.

  • timeout – Time after which, if the signals has not yet met the desired behavior, function will fail.

Returns:

Time when signal meets the behavior

Return type:

Timedelta

Raises:

Exception – If timeout is reached without meeting the behavior.

Examples

First moment when Power is inside the range, polling every one second, fails if not satisfied within 10 seconds. Detects even if signal already starts in the range.

>>> t = wait_until("P", region="at", value=(900,1000), interval=1, timeout=10)

Almost same as before but require the signal to be outside the range prior entering it. Detects the transition to the range from above or below

>>> t = wait_until("P", region="at", value=(900,1000), from_region="outside", interval=1, timeout=10)

Detecting a rising edge, when power goes above 1000

>>> t = wait_until("P", region="above", value=1000, from_region="below", interval=1, timeout=10)

Notes

This behaves very similarly to the find() function from analysis module. The difference is that this one executes in real-time, whereas the find() function checks an already captured signal.