comnum.select_channel#
- comnum.select_channel(x, fs_in, offset_hz, fs_out, cutoff_hz, *, n_taps=129)#
One channel of a capture brought to baseband at the rate of its receiver: the mean of the capture removed (the DC offset of the converter), the channel
offset_hzabove the tuning frequency shifted to 0 Hz, then resampled by the exact ratiofs_out/fs_in(integers in hertz) with a low-pass filter of cut-offcutoff_hz(half amplitude): a sinc under a Dolph–Chebyshev window of 80 dB, aboutn_tapstaps at the input rate (a transition band about4 fs_in / n_tapswide), without delay.- Parameters:
x (array_like) – the complex samples of the capture.
fs_in (float) – the sampling rate of the capture (Hz).
offset_hz (float) – the centre of the channel minus the tuning frequency (Hz).
fs_out (float) – the sampling rate of the output (Hz).
cutoff_hz (float) – the cut-off of the filter (Hz), at most
fs_out / 2.n_taps (int) – the length of the filter at the input rate.
- Returns:
ceil(len(x) fs_out / fs_in)samples (complex128).- Return type:
- Raises:
ValueError – for rates that are not whole numbers of hertz, a ratio that reduces to an interpolation by more than 1024, an offset outside the band, a cut-off above
fs_out / 2, or no tap.
Examples
>>> import comnum, numpy as np >>> n = np.arange(15360) >>> x = np.exp(2j * np.pi * 2e6 * n / 15.36e6) # a tone 2 MHz up >>> y = comnum.select_channel(x, 15.36e6, 2e6, 1.92e6, 0.8e6) >>> len(y), round(float(abs(y[960])), 3) (1920, 1.0)