Time-Interleaved ADC Analysis (timeinterleave)#
The timeinterleave module provides utilities for channel splitting,
mismatch extraction, spur prediction, and foreground correction in
time-interleaved ADCs.
Data Layout#
- adctoolbox.deinterleave(x: ndarray, M: int) ndarray[源代码]#
Deinterleave
xintoMsub-channels.- 参数:
x (array_like, shape (N,)) -- Interleaved time series. Sample at index
nbelongs to channeln mod M.M (int) -- Number of sub-ADCs (channels).
- 返回:
channels --
channels[m]contains the samples of channelmin chronological order.- 返回类型:
ndarray, shape (M, N // M)
- adctoolbox.interleave(channels: ndarray) ndarray[源代码]#
Inverse of
deinterleave()— stitch M channels back into one stream.- 参数:
channels (array_like, shape (M, K)) --
channels[m, k]is the k-th sample of channel m.- 返回:
x
- 返回类型:
ndarray, shape (M * K,)
Mismatch Analysis#
- adctoolbox.extract_mismatch_sine(x: ndarray, M: int, fs: float, fin: float | None = None) dict[源代码]#
Extract per-channel offset, gain, and sample-skew from a TI-ADC sine capture.
- 参数:
x (array_like, shape (N,)) -- Interleaved output. Sample
x[n]belongs to channeln mod Mand was taken at timen / fs.M (int) -- Number of sub-ADCs.
fs (float) -- Aggregate sample rate (Hz).
fin (float, optional) -- Input-tone frequency. If None, it is estimated from the FFT of
x(use coherent sampling for best results).
- 返回:
params --
gain: (M,) relative gain, normalized somean == 1.offset: (M,) DC offset per channel (same units asx).skew: (M,) sample-skew per channel (seconds, mean zero).fin: float — tone frequency used for the fit.A: float — fitted fundamental amplitude (mean across channels).phases: (M,) raw fitted phase per channel (rad) for diagnostics.- 返回类型:
备注
The "skew" returned here is relative: the mean is subtracted so an overall clock delay (which is not observable from a single capture) does not leak into the per-channel result. Pass
skew - skew.mean()upstream.
- adctoolbox.predict_spurs(params: dict, fs: float, fin: float | None = None, full_scale: float = 1.0) list[dict][源代码]#
Predict TI-ADC spur frequencies and magnitudes.
- 参数:
params (dict) -- Output of
extract_mismatch_sine(). Must containgain,offset,skew, and at least one offin/A;fincan also be supplied via the argument below.fs (float) -- Aggregate sample rate (Hz).
fin (float, optional) -- Input-tone frequency. Defaults to
params['fin']if present.full_scale (float, default 1.0) -- Signal full-scale (peak) used as the dBFS reference. If your
xwas scaled so the ideal sine has peak amplitudeA, setfull_scale = A_full_scale— usually the converter's peak code.
- 返回:
spurs -- One dict per predicted spur with keys:
freq_hz: spur frequency folded to[0, fs/2]kind:'offset'or'gain_skew'k: spur index in the M-point DFT (1..M-1)amp: spur amplitude in the same units asxdbfs: spur magnitude in dBFS (relative tofull_scale)dbc: spur magnitude in dBc (relative to fundamental)
- 返回类型:
Correction#
- adctoolbox.fractional_delay_fft(x: ndarray, delay_sec: float, fs: float) ndarray[源代码]#
Apply a fractional-sample delay via DFT phase rotation.
Output
y[n]approximatesx((n / fs) - delay_sec)using the sinc interpolation implicit in a length-NDFT. Exact for signals that are periodic over their length and strictly bandlimited to[0, fs/2).- 参数:
- 返回:
y
- 返回类型:
ndarray, same length as
x.
备注
Because the DFT assumes periodic extension, non-periodic signals will wrap around when
|delay_sec|approaches the full record length. For clean results near the edges, zero-padxbefore calling and trim afterwards.
- adctoolbox.fractional_delay_farrow(x: ndarray, delay_sec: float, fs: float, n_taps: int = 7) ndarray[源代码]#
Apply a fractional-sample delay via a Lagrange FIR interpolator.
Causal / streaming alternative to
fractional_delay_fft(). Then_taps-tap centered filter trades accuracy against boundary transient length (n_taps // 2samples on each end are unreliable, because the same-mode convolution zero-pads the input edges).- 参数:
- 返回:
y
- 返回类型:
ndarray, same length as
x.
备注
The delay is split into an integer part (applied by zero-padded shift) and a fractional remainder in
(-0.5, 0.5]handled by the centered Lagrange filter. Whendelay_sec == 0the filter is an impulse at the center tap.
- adctoolbox.calibrate_foreground(x: ndarray, M: int, params: dict, fs: float, *, skew_method: str = 'fft', n_taps: int = 7) ndarray[源代码]#
Apply offset / gain / skew corrections to a TI-ADC interleaved capture.
- 参数:
x (array_like, shape (N,)) -- Interleaved time series.
M (int) -- Sub-ADC count.
params (dict) -- Output of
extract_mismatch_sine(). Required keys:offset,gain,skew.fs (float) -- Aggregate sample rate (Hz).
skew_method ({'fft', 'farrow'}, default 'fft') --
How to apply the fractional-sample skew correction:
'fft'— per-channel DFT phase rotation. Near machine-precision accuracy for signals with energy strictly belowfs/(2M); circular wrap at record boundaries.'farrow'— per-channel Lagrange FIR. Causal and streaming-friendly. Accuracy and boundary transient length are set byn_taps.
n_taps (int, default 7) -- Only consulted when
skew_method == 'farrow'; must be a positive odd integer.
- 返回:
y -- Calibrated interleaved signal.
- 返回类型:
ndarray, shape (N,)
备注
The order matters: offset is removed first (before gain normalization), then gain is applied, and skew correction is last — mixing channels only at the fractional-delay interpolation stage preserves the per-channel amplitude balance that the prior two steps just enforced.