find¶
- typhoon.test.signals.find(signal, region, value, from_region=None, during=None)¶
Like the function typhoon.test.signals.find_all, it finds the desired characteristic on the signal. The difference is that find function looks only for the first occurrence of described behaviour, while find_all function returns the list of all moments where that condition is met.
- Parameters:
signal (pandas.Series) – Signal to be tested for.
region (string) – Can be “at”, “outside”, “above” or “below”. The option “outside” means “above” or “below”.
value (float or tuple) – Defines the region as a single number or range.
from_region (string) – Defines which region the signal should be prior to the desired region. Use this to detect transitions.
during (tuple) – Time period (as a range) to be considered for analysis.
- Returns:
result – Time of detected behavior
- Return type:
- Raises:
Exception – If the desired characteristic could not be detected.
Examples
First moment when Power is inside the range. Detects even if signal already starts in the range.
>>> t = find(capture["P"], region="at", value=(900,1000))
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 = find(capture["P"], region="at", value=(900,1000), from_region="outside")
Detecting a rising edge, when power goes above 1000
>>> t = find(capture["P"], region="above", value=1000, from_region="below")