Steps

New in version 0.2.

Changed in version 0.4.

This function generates steps according to given sequence of values and given width of steps. Function also can repeat given sequence according required number of repeats, or desired lenght of data.

Example Usage

Usage is as simple as

import signalz
x = signalz.steps(2, [1, 2, 3], repeat=2)

where the 2 stands for step width, [1, 2, 3] are values for steps and repeat=2 make the sequence of steps repeat twice. So the returned output is

>>> [1 1 2 2 3 3 1 1 2 2 3 3]

Function Documentation

signalz.generators.steps.steps(step_width, values, repeat=1, size=None)[source]

This function generates steps from given values.

Args:

  • step_width - desired width of every step (int)
  • values - values for steps (1d array)

Kwargs:

  • repeat - number of step sequence repetions (int), this variable is used, if the size is not defined
  • size - size of output data in samples (int), if the size is used, the repeat is ignored.

Returns:

  • array of values representing desired steps (1d array)