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→+∞, a+.
- start_value (float or complex or None , optional) – The asymptotic value of the ramp towards t→−∞, a−. Defaults to minus end_value.
- ramp_duration (float or None , optional) – The characteristic time for the hyperbolic tangent ramp, tramp. Defaults to T/6.
- center_time (float or None , optional) – The time at which the ramp has its greatest slope, t0. Defaults to T/2.
Returns
The hyperbolic tangent ramp.
Return type
SEE ALSO
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
Tanh(t)=2a++a−+2a+−a−tanh(trampt−t0),where the function’s asymptotic values a± are defined by:
a±:=t→±∞limTanh(t),and t0 is related to tramp by:
dtdTanh(t)t=t0=2tramp(a+−a−).Note that if t0 is close to the edges of the ramp, for example t0≲2tramp, then the first and last values of the outputted array will differ from the expected asymptotic values.
With the default values of startvalue ($a-),rampduration(t_\mathrm{ramp}),andcentertime(t_0$), the ramp expression simplifies to
Tanh(t)=Atanh(T/6t−T/2),where A=a+ is the end value (the start value is then −A). This defines a symmetric ramp (around (T/2,0)) between −0.995A (at t=0) and 0.995A (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])