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 α(t)\alpha(t)
  • kernel (ConvolutionKernel) – The node representing the kernel K(t)K(t)

Returns

The sampleable function representing the signal (αK)(t)(\alpha * K)(t)

Return type

Stf

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

(αK)(t)α(τ)K(tτ)dτ. (\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)K(t)) to α(t)\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.

Was this useful?