staircase.Stairs.layer

Stairs.layer(start=None, end=None, value=None)

Changes the value of the step function.

Parameters:
  • start (int, float or vector data, optional) – start time(s) of the interval(s)
  • end (int, float or vector data, optional) – end time(s) of the interval(s)
  • value (int, float or vector data, optional) – value(s) of the interval(s)
Returns:

The current instance is returned to facilitate method chaining

Return type:

Stairs

Examples

>>> import staircase as sc
... (sc.Stairs()
...     .layer(1,3)
...     .layer(4,5,-2)
...     .plot()
... )
../_images/staircase-Stairs-layer-1.png
>>> import pandas as pd
>>> import staircase as sc
>>> data = pd.DataFrame({"starts":[1,4,5.5],
...                      "ends":[3,5,7],
...                      "values":[-1,2,-3]})
>>> data
   starts  ends  values
0     1.0     3      -1
1     4.0     5       2
2     5.5     7      -3
>>> (sc.Stairs(1.5)
...     .layer(data["starts"], data["ends"], data["values"])
...     .plot()
... )
../_images/staircase-Stairs-layer-2.png