comnum.resample_rational#

comnum.resample_rational(x, fs_in, fs_out, cutoff_hz, *, n_taps=129)#

The samples x (at fs_in) resampled to fs_out by the exact rational ratio of the two rates under the 80 dB Chebyshev-windowed low-pass filter of cut-off cutoff_hz (select_channel() without the removal of the mean and the shift).

Parameters:
  • x (array_like) – real or complex samples.

  • fs_in (float) – the input rate (Hz), a whole number of hertz.

  • fs_out (float) – the output rate (Hz), a whole number of hertz.

  • cutoff_hz (float) – the cut-off (Hz), at most half the lower rate.

  • n_taps (int) – the length of the filter at the input rate.

Returns:

ceil(len(x) fs_out / fs_in) samples (complex128).

Return type:

numpy.ndarray

Raises:

ValueError – for rates that are not whole numbers of hertz, a ratio that reduces to an interpolation by more than 1024, a cut-off out of range, or no tap.