linear_ramp_stf
The Boulder Opal Toolkits are currently in beta phase of development. Breaking changes may be introduced.
- linear_ramp_stf(slope, shift=0.0)
Create an Stf representing a linear ramp.
- Parameters
- Returns
The sampleable linear ramp.
- Return type
See also
signals.linear_ramp()
Function to create a Signal object representing a linear ramp.
signals.linear_ramp_pwc()
Corresponding operation with Pwc output.
signals.tanh_ramp_stf()
Create an Stf representing a hyperbolic tangent ramp.
Notes
The linear ramp is defined as
\[\mathop{\mathrm{Linear}}(t) = a t + b .\]Examples
Define a linear STF ramp.
>>> linear = graph.signals.linear_ramp_stf(slope=4.0, shift=-2.0) >>> linear <Stf: operation_name="add", value_shape=(), batch_shape=()> >>> graph.sample_stf(stf=linear, sample_times=np.linspace(0, 1, 5), name="linear_ramp") <Tensor: name="linear_ramp", operation_name="sample_stf", shape=(5,)> >>> graph.discretize_stf(linear, duration=1, segment_count=100, name="discretized_linear") <Pwc: name="discretized_linear", operation_name="discretize_stf", value_shape=(), batch_shape=()> >>> result = qctrl.functions.calculate_graph( ... graph=graph, output_node_names=["linear_ramp", "discretized_linear"] ... ) >>> result.output["linear_ramp"]["value"] array([-2., -1., 0., 1., 2.]
Define a linear STF ramp with an optimizable slope and root.
>>> slope = graph.optimization_variable( ... count=1, lower_bound=-4, upper_bound=4, name="slope" ... ) >>> root = graph.optimization_variable( ... count=1, lower_bound=-4, upper_bound=4, name="slope" ... ) >>> shift = - slope * root >>> graph.signals.linear_ramp_stf(slope=slope, shift=shift) <Stf: operation_name="add", value_shape=(), batch_shape=()>