# tanh_ramp

boulderopal.signals.tanh_ramp(duration, end_value, start_value=None, ramp_duration=None, center_time=None)

Create a Signal object representing a hyperbolic tangent ramp.

### Parameters

• duration (float) – The duration of the signal, $T$
• end_value (float or complex) – The asymptotic value of the ramp towards $t \to +\infty$, $a_+$
• start_value (float or complex or None , optional) – The asymptotic value of the ramp towards $t \to -\infty$, $a_-$
• ramp_duration (float or None , optional) – The characteristic time for the hyperbolic tangent ramp, $t_\mathrm{ramp}$. Defaults to $T/6$
• center_time (float or None , optional) – The time at which the ramp has its greatest slope, $t_0$. Defaults to $T/2$

### Returns

The hyperbolic tangent ramp.

### Return type

Signal

boulderopal.signals.linear_ramp : Create a Signal object representing a linear ramp.

Graph.signals.tanh_ramp_pwc : Graph operation to create a Pwc representing a hyperbolic tangent ramp.

Graph.signals.tanh_ramp_stf : Graph operation to create a Stf representing a hyperbolic tangent ramp.

## Notes

The hyperbolic tangent ramp is defined as

$\mathop{\mathrm{Tanh}}(t) = \frac{a_+ + a_-}{2} + \frac{a_+ - a_-}{2} \tanh\left( \frac{t - t_0}{t_\mathrm{ramp}} \right) ,$

where the function’s asymptotic values $a_\pm$

$a_\pm := \lim_{t\to\pm\infty} \mathop{\mathrm{Tanh}}(t) ,$

and $t_0$ is related to $t_\mathrm{ramp}$

$\left.\frac{{\rm d}\mathop{\mathrm{Tanh}}(t)}{{\rm d}t}\right|_{t=t_0} = \frac{ (a_+ - a_-)}{2 t_\mathrm{ramp}} .$

Note that if $t_0$ is close to the edges of the ramp, for example $t_0 \lesssim 2 t_\mathrm{ramp}$

With the default values of start_value ($a_-$), ramp_duration ($t_\mathrm{ramp}$), and center_time ($t_0$

$\mathop{\mathrm{Tanh}}(t) = A \tanh\left( \frac{t - T/2}{T/6} \right),$

where $A = a_+$ is the end value (the start value is then $-A$). This defines a symmetric ramp (around $(T/2, 0)$) between $-0.995 A$ (at $t=0$) and $0.995 A$ (at $t=T$

## Examples

Define a tanh ramp.

>>> signal = bo.signals.tanh_ramp(
...     duration=4, end_value=2, start_value=1, ramp_duration=0.4, center_time=2.
... )
>>> signal.export_with_time_step(time_step=0.4)
array([1.00012339, 1.00091105, 1.00669285, 1.04742587, 1.26894142,
1.73105858, 1.95257413, 1.99330715, 1.99908895, 1.99987661])