is_ramp

typhoon.test.signals.is_ramp(signal, slope, tol, during=None, strictness=1, time_tol=0, initial_value=None, report_plot=None)

Checks if signal is a ramp with desired slope.

Parameters:
  • signal (pandas.Series) – Signal to be tested for.

  • slope (float) – Ramp slope that signal should have, in units per second.

  • tol (float) – Tolerance around which the signal can stay with respect to reference ramp when determining if result is True or False.

  • during (tuple) – 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.

  • initial_value (float) – If specified, a reference ramp is created starting with this value. Otherwise, the initial value of the reference is equal to the initial value of the analyzed signal

  • report_plot

    Dictionary which overrides the default allure report plot attachment behaviour. It also overrides behaviour specified for the whole test run with command line arguments --analysis-plot-type and --analysis-plot-on-fail-only. The dictionary has two keys to be specified:

    1. type: specifies which kind of allure plot should be used. Valid values:

      • static - only matplotlib plot attached as .png picture is attached

      • interactive - 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 attached

      • all - all plots will be added. Currently supported ones are matplotlib plot(static) and bokeh plot(interactive)

    2. when: specifies when to add plots that are specified with previous key to report. Available options:

      • always - always adds specified plots

      • on-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 and analysis-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

Signal should have a slope of 1 unit per second considering simulation from t=2 to t=5, signal can vary inside range of ±0.5:

>>> result = is_ramp(signal, slope=1, tol=0.5, during=(2,5))
>>> assert result == True

A more concise way of asserting is using the assertion helper functions:

>>> assert_is_ramp(signal, slope=1, tol=0.5, during=(2,5))

See also

typhoon.test.signals.AnalysisResult, typhoon.test.signals.assert_is_ramp