# linear_ramp

boulderopal.signals.linear_ramp(duration, end_value, start_value=None, start_time=0.0, end_time=None)

Create a Signal object representing a linear ramp.

### Parameters

• duration (float) – The duration of the signal, $T$.
• end_value (float or complex) – The value of the ramp at $t = t_\mathrm{end}$, $a_\mathrm{end}$.
• start_value (float or complex or None , optional) – The value of the ramp at $t = t_\mathrm{start}$, $a_\mathrm{start}$. Defaults to $-a_\mathrm{end}$.
• start_time (float , optional) – The time at which the linear ramp starts, $t_\mathrm{start}$. Defaults to 0.
• end_time (float or None , optional) – The time at which the linear ramp ends, $t_\mathrm{end}$. Defaults to the given duration $T$.

The linear ramp.

### Return type

Signal

Graph.signals.linear_ramp_pwc : Graph operation to create a Pwc representing a linear ramp.

Graph.signals.linear_ramp_stf : Graph operation to create a Stf representing a linear ramp.

boulderopal.signals.tanh_ramp : Create a Signal object representing a hyperbolic tangent ramp.

## Notes

The linear ramp is defined as

$\mathop{\mathrm{Linear}}(t) = \begin{cases} a_\mathrm{start} &\mathrm{if} \quad t < t_\mathrm{start}\\ a_\mathrm{start} + (a_\mathrm{end} - a_\mathrm{start}) \frac{t - t_\mathrm{start}}{t_\mathrm{end} - t_\mathrm{start}} &\mathrm{if} \quad t_\mathrm{start} \le t \le t_\mathrm{end} \\ a_\mathrm{end} &\mathrm{if} \quad t > t_\mathrm{end} \end{cases} .$

## Examples

Define a linear ramp with start and end times.

>>> signal = bo.signals.linear_ramp(
...     duration=4, end_value=2, start_time=1, end_time=3
... )
>>> signal.export_with_time_step(time_step=0.25)
array([-2.  , -2.  , -2.  , -2.  , -1.75, -1.25, -0.75, -0.25,  0.25,
0.75,  1.25,  1.75,  2.  ,  2.  ,  2.  ,  2.  ])