- class sdr.FractionalDelay(sdr.FIR)
Implements a fractional delay FIR filter.
Examples¶
Design
delay filters with various lengths. Examine the width and flatness of the frequency response passband.In [1]: plt.figure(); In [2]: for length in [4, 8, 16, 32, 64, 128]: ...: fir = sdr.FractionalDelay(length, 0.21719) ...: sdr.plot.magnitude_response(fir, label=f"$L = {length}$") ...: In [3]: plt.legend(loc="lower left");
Design filters with length
and various fractional delays. Examine the effects on the magnitude response outside the passband as a function of the fractional delay. Note the symmetry about and that the out-of-band magnitude response is worst at .In [4]: plt.figure(); In [5]: for delay in np.arange(0.1, 1, 0.1): ...: fir = sdr.FractionalDelay(8, delay) ...: sdr.plot.magnitude_response(fir, label=f"$\Delta n = {delay:0.1f}$") ...: In [6]: plt.ylim(-10, 1); \ ...: plt.legend(loc="lower left"); ...:
Examine the effects on the group delay outside the passband as a function of the fractional delay. Note the symmetry about
. The out-of-band group delay is worst around , however the group delay is perfectly flat at exactly .In [7]: plt.figure(); In [8]: for delay in np.arange(0.1, 1, 0.1): ...: fir = sdr.FractionalDelay(8, delay) ...: sdr.plot.group_delay(fir, label=f"$\Delta n = {delay:0.1f}$") ...: In [9]: plt.legend(loc="lower left");
Constructors¶
- FractionalDelay(length: int, delay: float)
Creates a fractional delay FIR filter.
Special methods¶
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 state : NDArray
The filter state consisting of the previous
inputs.
Methods¶
-
impulse_response(N: int | None =
None
) NDArray Returns the impulse response
of the FIR filter.
-
step_response(N: int | None =
None
) NDArray Returns the step response
of the FIR filter.
- frequency_response(...) tuple[numpy.ndarray[Any, numpy.dtype[numpy.float64]], numpy.ndarray[Any, numpy.dtype[numpy.complex128]]]
- frequency_response(freqs: float, ...) complex
- frequency_response(freqs, ...) ndarray[Any, dtype[complex128]]
Returns the frequency response
of the FIR filter.
- group_delay(...) tuple[NDArray, NDArray]
Returns the group delay
of the FIR filter.
- phase_delay(...) tuple[NDArray, NDArray]
Returns the phase delay
of the FIR filter.
Properties¶
- property taps : NDArray
The feedforward taps
with length .