linear_ramp
The Boulder Opal Toolkits are currently in beta phase of development. Breaking changes may be introduced.
- 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, 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, optional) – The time at which the linear ramp ends, \(t_\mathrm{end}\). Defaults to the given duration \(T\).
- Returns:
The linear ramp.
- Return type:
See also
signals.linear_ramp_pwc()
Graph operation to create a Pwc representing a linear ramp.
signals.linear_ramp_stf()
Graph operation to create a Stf representing a linear ramp.
signals.tanh_ramp()
Create a Signal object representing a hyperbolic tangent ramp.
Notes
The linear ramp is defined as
\[\begin{split}\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} .\end{split}\]Examples
Define a linear ramp with start and end times.
>>> signal = qctrl.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. ])