find_all¶
- typhoon.test.signals.find_all(signal, region, value, from_region=None, during=None)¶
Finds a desired characteristic on a signal.
- 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 – All moments in which the signal meets described behaviour
- Return type:
list of Timedelta
Examples
Find all rising edges of the sine signal with zero as threshold value
>>> from typhoon.test.signals import pandas_sine, find_all >>> sine_sig = pandas_sine(frequency=50, duration=0.05, Ts=1e-6) >>> rising_edges = find_all(sine_sig, region="above", value=0, from_region="below")
Find all falling edges of the sine signal with zero as threshold value
>>> from typhoon.test.signals import pandas_sine, find_all >>> sine_sig = pandas_sine(frequency=50, duration=0.05, Ts=1e-6) >>> falling_edges = find_all(sine_sig, region="below", value=0, from_region="above")
Find all the moments when signal enters the specified region (with assumption that signal is already captured)
>>> entering_moments = find_all(captured_sig, region="at", value=(900, 1000), from_region="outside")