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
- kernel (ConvolutionKernel) – The node representing the kernel
Returns
The sampleable function representing the signal
Return type
SEE ALSO
Graph.discretize_stf
: Discretize an Stf into a Pwc.
Graph.filter_and_resample_pwc
: Filter a Pwc with a sinc filter and resample it.
Graph.gaussian_convolution_kernel
: Create a convolution kernel representing a normalized Gaussian.
Graph.pwc
: Create piecewise-constant functions.
Graph.sample_stf
: Sample an Stf at given times.
Graph.sinc_convolution_kernel
: Create a convolution kernel representing the sinc function.
Notes
The convolution is
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 ) to
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.