# linear_ramp_stf

Source: https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/signals/linear_ramp_stf

```python
signals.linear_ramp_stf(slope, shift=0.0)
```

Create an Stf representing a linear ramp.

### Parameters
* **slope** (*float* *or* *complex* *or* [*Tensor*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Tensor.md#boulderopal.graph.Tensor)) – The slope of the ramp, $a$.
  It must either be a scalar or contain a single element.
* **shift** (*float* *or* *complex* *or* [*Tensor*](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Tensor.md#boulderopal.graph.Tensor) *,* *optional*) – The value of the ramp at $t = 0$, $b$.
  It must either be a scalar or contain a single element.
  Defaults to 0.
### Returns
The sampleable linear ramp.
### Return type
[Stf](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Stf.md#boulderopal.graph.Stf)

### SEE ALSO
[`boulderopal.signals.linear_ramp`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/signals/linear_ramp.md#boulderopal.signals.linear_ramp)
: Create a Signal object representing a linear ramp.

[`Graph.signals.linear_ramp_pwc`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/signals/linear_ramp_pwc.md#boulderopal.graph.signals.linear_ramp_pwc)
: Corresponding operation with Pwc output.

[`Graph.signals.tanh_ramp_stf`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/signals/tanh_ramp_stf.md#boulderopal.graph.signals.tanh_ramp_stf)
: Create an Stf representing a hyperbolic tangent ramp.

## Notes

The linear ramp is defined as

$$
\mathop{\mathrm{Linear}}(t) = a t + b .
$$

## Examples

Define a linear STF ramp.

```pycon
>>> linear = graph.signals.linear_ramp_stf(slope=4.0, shift=-2.0)
>>> graph.discretize_stf(linear, duration=1, segment_count=5, name="linear")
<Pwc: name="linear", operation_name="discretize_stf", value_shape=(), batch_shape=()>
>>> result = bo.execute_graph(graph=graph, output_node_names="linear")
>>> result["output"]["linear"]
{'durations': array([0.2, 0.2, 0.2, 0.2, 0.2]),
'values': array([-1.6, -0.8,  0. ,  0.8,  1.6]),
'time_dimension': 0}
```

Define a linear STF ramp with an optimizable slope and root.

```pycon
>>> slope = graph.optimizable_scalar(
...     lower_bound=-4, upper_bound=4, name="slope"
... )
>>> root = graph.optimizable_scalar(
...     lower_bound=-4, upper_bound=4, name="slope"
... )
>>> shift = - slope * root
>>> graph.signals.linear_ramp_stf(slope=slope, shift=shift)
<Stf: operation_name="add", value_shape=(), batch_shape=()>
```
