torchsig.utils.dsp.design_half_band_filter¶
- torchsig.utils.dsp.design_half_band_filter(stage_number: int = 0, passband_percentage: float = 0.8, attenuation_db: float = 120) ndarray[source]¶
Designs half band filter weights for dyadic resampling
Implements the filter design for dyadic (power of 2) resampling, see fred harris, Multirate Signal Processing for Communication Systems, 2nd Edition, Chapter 8.7.
The dyadic filter uses a series of stages, a multi-stage structure, to efficiently implement large resampling rates. For interpolation, each additional stage increases the resampling rate by a factor of 2, and therefore the signal bandwidth becomes a smaller relative proportion of the sample rate. Therefore, both the passband edge will be decreased for each successive stage, which also allows for the transition bandwidth to be increased for each successive stage, thereby also reducing the amount of computation needed.
- Parameters:
stage_number (int, optional) – Stage number in the cascade, must be greater than or equal to zero. Defaults to 0.
passband_percentage (float, optional) – The proportion of the available bandwidth used for the passband edge. The default of 0.8 translates into the passband edge being 80% of maximum passband of fs/4, or 0.8*fs/4.
attenuation_db (float, optional) – The sidelobe attenuation level, must be greater than zero. Defaults to 120.
- Raises:
ValueError – Checks to ensure that the filter length has the appropriate length
- Returns:
Half band filter weights
- Return type:
np.ndarray