is_first_order¶
- typhoon.test.signals.is_first_order(signal, time_constant, init_value, final_value, tol, during=None, strictness=1, time_tol=0, report_plot=None)¶
Checks if signal represents first order response.
- Verifies that signal follows exponential equation defined with formula:
x(t) = x(inf) + (x(0) - x(inf)) * exp(-t / tau),
where t represents the time axis of the signal.
- Parameters:
signal (pandas.Series) – Signal to be tested for.
time_constant (float) – Time constant of the signal; represents tau in formula (1).
init_value (float) – Initial value of the signal; represents x(0) in formula (1)
final_value (float) – Stationary state value of the signal; represents x(inf) in formula (1).
tol (float) – Tolerance around which the signal can stay with respect to reference ramp when determining if result is True or False.
during (2-element tuple of numbers or Timedelta) – Time period (as a range) to be considered for analysis.
strictness (float) – Number between 0.0 and 1.0 that determines percentage of time signal should be inside the defined range for test to pass.
time_tol (float or timedelta) – Time tolerance - argument which allows that signal is leading or lagging up to specified time in seconds, compared to created reference.
report_plot (dict) –
Dictionary which overrides default allure report plot attachment behaviour. It also overrides behaviour specified for whole test run with command line arguments
--analysis-plot-type
and--analysis-plot-on-fail-only
. Dictionary has two keys to be specified:type
: specifies which kind of allure plot should be used. Valid values:static
- only matplotlib plot attached as .png picture is attachedinteractive
- only interactive html plot created with bokeh library is attached. Advantage of this plot it has options to zoom in/zoom out. Disadvantage is that it consumes significantly more memory.none
- none of the plots will be attachedall
- all plots will be added. Currently supported ones are matplotlib plot(static) and bokeh plot(interactive)
when
: specifies when to add plots that are specified with previous key to report. Available options:always
- always adds specified plotson-fail
- adds plots only if comparison of reference and measured signal fails. This is good way to decrease size of allure plots.
Note
If
report_plot
argument is not provided, and command line arguments--analysis-plot-type
andanalysis-plot-on-fail-only
are not specified, default behaviour is static plot, attached always. If command line arguments are specified, they define new default behaviour for whole test run.
- Returns:
result – Result of the analysis.
- Return type:
AnalysisResult
Examples
>>> import typhoon.test.signals as signals >>> tau = 0.1 >>> init = 0 >>> fin = 10 >>> exp_sig = signals.pandas_first_order(tau, init, fin) # first order response signal >>> assert signals.is_first_order(exp_sig, tau, init, fin, tol=0.01*fin)