time_concatenate_pwc
Graph.time_concatenate_pwc(pwc_list, *, name=None)
Concatenate multiple piecewise-constant functions in the time dimension.
Parameters
- pwc_list (list [Pwc ]) – The individual piecewise-constant functions {Ai(t)} to concatenate. All the functions must have the same value shape, and can have broadcastable batch shapes.
- name (str or None , optional) – The name of the node.
Returns
The concatenated piecewise-constant function (or batch of functions).
Return type
SEE ALSO
Graph.pwc
: Create piecewise-constant functions.
Graph.pwc_sum
: Sum multiple Pwcs.
Graph.symmetrize_pwc
: Symmetrize Pwcs.
Graph.time_reverse_pwc
: Reverse Pwcs in time.
Notes
The function resulting from the concatenation is
C(t)=⎩⎨⎧A0(t)A1(t−τ0)A2(t−τ0−τ1)forforfor⋮0<t<τ0τ0<t<τ0+τ1τ0+τ1<t<τ0+τ1+τ2where τi is the duration of the i-th function.
For more information on Pwc nodes see the Working with time-dependent functions in Boulder Opal topic.
Examples
Concatenate two piecewise-constant functions.
>>> pwc1 = graph.pwc(durations=np.array([0.2, 0.5]), values=np.array([1, 2]))
>>> pwc2 = graph.pwc(durations=np.array([0.7, 0.9]), values=np.array([3, 4]))
>>> graph.time_concatenate_pwc([pwc1, pwc2], name="concat")
<Pwc: name="concat", operation_name="time_concatenate_pwc", value_shape=(), batch_shape=()>
>>> result = bo.execute_graph(graph=graph, output_node_names="concat")
>>> result["output"]["concat"]
{
'durations': array([0.2, 0.5, 0.7, 0.9]),
'values': array([1., 2., 3., 4.]),
'time_dimension': 0