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=tend, aend.
- start_value (float or complex or None , optional) – The value of the ramp at t=tstart, astart. Defaults to −aend.
- start_time (float , optional) – The time at which the linear ramp starts, tstart. Defaults to 0.
- end_time (float or None , optional) – The time at which the linear ramp ends, tend. Defaults to the given duration T.
Returns
The linear ramp.
Return type
SEE ALSO
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
Linear(t)=⎩⎨⎧astartastart+(aend−astart)tend−tstartt−tstartaendift<tstartiftstart≤t≤tendift>tend.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. ])