product_filtfilt: Zero-phase filter#

hypercoil.functional.fourier.product_filtfilt(X: Tensor, weight: Tensor, **params) Tensor[source]#

Perform zero-phase digital filtering of a signal via multiplication in the frequency domain.

This function operates by first filtering the data and then filtering a time-reversed copy of the filtered data again. Note that the effect on the amplitude is quadratic in the filter weight.

Note

If the weight argument is strictly real, then the filter has no phase delay component and it could make sense to simply use product_filter() depending on the context.

Dimension:
Input : \((N, *, obs)\)

N denotes batch size, * denotes any number of intervening dimensions, obs denotes number of observations per data channel.

Weight : \((*, \left\lfloor \frac{obs}{2} \right\rfloor + 1)\)

As above.

Output : \((N, *, 2 \left\lfloor \frac{obs}{2} \right\rfloor )\)

As above.

Parameters:
XTensor

The (potentially multivariate) signal to be filtered. The final axis should correspond to the time domain of each signal or its analogue.

weightTensor

The filter gain at each frequency bin in the spectrum, ordered low to high along the last axis. Dimensions before the last can be used to apply different filters to different variables in the input signal according to tensor broadcasting rules.

**params

Any additional parameters provided will be passed to jnp.fft.rfft and jnp.fft.irfft.

Returns:
Tensor

Original time series filtered via multiplication in the frequency domain.