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, .
- end_value (float or complex) – The asymptotic value of the ramp towards , .
- start_value (float or complex or None , optional) – The asymptotic value of the ramp towards , . Defaults to minus end_value.
- ramp_duration (float or None , optional) – The characteristic time for the hyperbolic tangent ramp, . Defaults to .
- center_time (float or None , optional) – The time at which the ramp has its greatest slope, . Defaults to .
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
where the function’s asymptotic values are defined by:
and is related to by:
Note that if is close to the edges of the ramp, for example , then the first and last values of the outputted array will differ from the expected asymptotic values.
With the default values of start_value (), ramp_duration (), and center_time (), the ramp expression simplifies to
where is the end value (the start value is then ). This defines a symmetric ramp (around ) between (at ) and (at ).
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])