convolve_pwc
- Graph.convolve_pwc(pwc, kernel)
Create the convolution of a piecewise-constant function with a kernel.
- Parameters:
pwc (Pwc) – The piecewise-constant function \(\alpha(t)\) to convolve. You can provide a batch of functions, in which case the convolution is applied to each element of the batch.
kernel (ConvolutionKernel) – The node representing the kernel \(K(t)\).
- Returns:
The sampleable function representing the signal \((\alpha * K)(t)\) (or batch of signals, if you provide a batch of functions).
- Return type:
See also
discretize_stf
Discretize an Stf into a Pwc.
gaussian_convolution_kernel
Create a convolution kernel representing a normalized Gaussian.
pwc
Create piecewise-constant functions.
sample_stf
Sample an Stf at given times.
sinc_convolution_kernel
Create a convolution kernel representing the sinc function.
utils.filter_and_resample_pwc()
Filter a Pwc with a sinc filter and resample it.
Notes
The convolution is
\[(\alpha * K)(t) \equiv \int_{-\infty}^\infty \alpha(\tau) K(t-\tau) d\tau.\]Convolution in the time domain is equivalent to multiplication in the frequency domain, so this function can be viewed as applying a linear time-invariant filter (specified via its time domain kernel \(K(t)\)) to \(\alpha(t)\).
For more information on Stf nodes see the Working with time-dependent functions in Boulder Opal topic.
Examples
Filter a piecewise-constant signal using a Gaussian convolution kernel.
>>> gaussian_kernel = graph.gaussian_convolution_kernel(std=1.0, offset=3.0) >>> gaussian_kernel <ConvolutionKernel: operation_name="gaussian_convolution_kernel"> >>> pwc_signal <Pwc: name="alpha", operation_name="pwc_signal", value_shape=(), batch_shape=()> >>> filtered_signal = graph.convolve_pwc(pwc=pwc_signal, kernel=gaussian_kernel) >>> filtered_signal <Stf: operation_name="convolve_pwc", value_shape=(), batch_shape=()>
Refer to the How to add smoothing and band-limits to optimized controls user guide to find the example in context.