class sdr.PolyphaseFIR(sdr.FIR)

Implements a generic polyphase FIR filter.

Notes

The polyphase feedforward taps \(h_i[n]\) are related to the prototype feedforward taps \(h[n]\), given the number of polyphase branches \(B\), by

\[h_i[j] = h[i + j B] .\]

The input signal \(x[n]\) can be passed to each polyphase partition (used in interpolation) or commutated from bottom to top (used in decimation).

Polyphase FIR Filter with Input Hold
                       +------------------------+
                   +-->| h[0], h[3], h[6], h[9] |
                   |   +------------------------+
                   |   +------------------------+
 ..., x[1], x[0] --+-->| h[1], h[4], h[7], 0    |
                   |   +------------------------+
                   |   +------------------------+
                   +-->| h[2], h[5], h[8], 0    |
                       +------------------------+
Polyphase FIR Filter with Input Commutation (Top to Bottom)
                          +------------------------+
 ..., x[4], x[1], 0    -->| h[0], h[3], h[6], h[9] |
                          +------------------------+
                          +------------------------+
 ..., x[5], x[2], 0    -->| h[1], h[4], h[7], 0    |
                          +------------------------+
                          +------------------------+
 ..., x[6], x[3], x[0] -->| h[2], h[5], h[8], 0    |
                          +------------------------+
Polyphase FIR Filter with Input Commutation (Bottom to Top)
                          +------------------------+
 ..., x[6], x[3], x[0] -->| h[0], h[3], h[6], h[9] |
                          +------------------------+
                          +------------------------+
 ..., x[5], x[2], 0    -->| h[1], h[4], h[7], 0    |
                          +------------------------+
                          +------------------------+
 ..., x[4], x[1], 0    -->| h[2], h[5], h[8], 0    |
                          +------------------------+

The output of each polyphase partition can be summed to produce the output signal \(y[n]\) (used in decimation), commutated from top to bottom (used in interpolation), or taken as parallel outputs \(y_i[n]\) (used in channelization).

Polyphase FIR Filter with Output Summation
 +------------------------+
 | h[0], h[3], h[6], h[9] |--+
 +------------------------+  |
 +------------------------+  v
 | h[1], h[4], h[7], 0    |--@--> ..., y[1], y[0]
 +------------------------+  ^
 +------------------------+  |
 | h[2], h[5], h[8], 0    |--+
 +------------------------+
Polyphase FIR Filter with Output Commutation (Top to Bottom)
 +------------------------+
 | h[0], h[3], h[6], h[9] |--> ..., y[3], y[0]
 +------------------------+
 +------------------------+
 | h[1], h[4], h[7], 0    |--> ..., y[4], y[1]
 +------------------------+
 +------------------------+
 | h[2], h[5], h[8], 0    |--> ..., y[5], y[2]
 +------------------------+
Polyphase FIR Filter with Output Commutation (Bottom to Top)
 +------------------------+
 | h[0], h[3], h[6], h[9] |--> ..., y[5], y[2]
 +------------------------+
 +------------------------+
 | h[1], h[4], h[7], 0    |--> ..., y[4], y[1]
 +------------------------+
 +------------------------+
 | h[2], h[5], h[8], 0    |--> ..., y[3], y[0]
 +------------------------+
Polyphase FIR Filter with Parallel Outputs
 +------------------------+
 | h[0], h[3], h[6], h[9] |--> ..., y[0,1], y[0,0]
 +------------------------+
 +------------------------+
 | h[1], h[4], h[7], 0    |--> ..., y[1,1], y[1,0]
 +------------------------+
 +------------------------+
 | h[2], h[5], h[8], 0    |--> ..., y[2,1], y[2,0]
 +------------------------+

Constructors

PolyphaseFIR(branches: int, taps: ArrayLike, ...)

Creates a polyphase FIR filter.

Special methods

__call__(x: ArrayLike, mode: 'rate' | 'full' = 'rate') NDArray

Filters the input signal \(x[n]\) with the polyphase FIR filter.

__len__() int

Returns the filter length \(N + 1\).

Streaming mode only

reset()

Resets the filter state. Only useful when using streaming mode.

flush() NDArray

Flushes the filter state by passing zeros through the filter. Only useful when using streaming mode.

property streaming : bool

Indicates whether the filter is in streaming mode.

property state : NDArray

The filter state consisting of the previous \(N\) inputs.

Methods

impulse_response(N: int | None = None) NDArray

Returns the impulse response \(h[n]\) of the FIR filter.

step_response(N: int | None = None) NDArray

Returns the step response \(s[n]\) of the FIR filter.

frequency_response(...) tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[complex128]]]
frequency_response(freqs: float, ...) complex
frequency_response(freqs, ...) ndarray[Any, dtype[complex128]]

Returns the frequency response \(H(\omega)\) of the FIR filter.

group_delay(...) tuple[NDArray, NDArray]

Returns the group delay \(\tau_g(\omega)\) of the FIR filter.

phase_delay(...) tuple[NDArray, NDArray]

Returns the phase delay \(\tau_{\phi}(\omega)\) of the FIR filter.

noise_bandwidth(sample_rate: float = 1.0) float

Returns the noise bandwidth \(B_n\) of the FIR filter.

Properties

property branches : int

The number of polyphase branches \(B\).

property taps : NDArray

The prototype feedforward taps \(h[n]\).

property polyphase_taps : NDArray

The polyphase feedforward taps \(h_i[n]\).

property order : int

The order \(N = (M + 1)B - 1\) of the FIR prototype filter \(h[n]\).

property polyphase_order : int

The order \(M = (N + 1)/B - 1\) of each FIR polyphase filter \(h_i[n]\).

property input : 'hold' | 'top-to-bottom' | 'bottom-to-top'

The input connection method.

property output : 'sum' | 'top-to-bottom' | 'bottom-to-top' | 'all'

The output connection method.

property interpolation : int

The integer interpolation rate \(P\).

property decimation : int

The integer decimation rate \(Q\).

property rate : float

The fractional resampling rate \(r = P/Q\). The output sample rate is \(f_{s,out} = f_{s,in} \cdot r\).

property delay : int

The delay of polyphase FIR filter in samples.