Oversampling Analysis (oversampling)#
The oversampling module provides MATLAB-compatible tools for oversampling
and Delta-Sigma ADC analysis.
MATLAB-Compatible Entry Points#
- adctoolbox.oversampling.ifilter(sigin: ndarray, passband: ndarray) ndarray[source]#
Filter a signal by retaining only the specified normalized passbands.
This is the Python counterpart of MATLAB
ifilter(sigin, passband). It applies an ideal FFT-domain brickwall mask, preserves Hermitian symmetry for real-valued output, and filters each column independently.- Parameters:
sigin (array_like) – Real-valued input signal. Vectors are treated as column vectors; for matrices, each column is filtered independently. If the matrix is wider than tall, it is transposed to match the MATLAB orientation rule.
passband (array_like) –
(P, 2)passband table. Each row is[f_low, f_high]normalized to the sampling frequency, where0is DC and0.5is Nyquist.
- Returns:
Filtered signal in MATLAB-style orientation.
- Return type:
ndarray
- adctoolbox.oversampling.perfosr(sig: ndarray, *, disp: bool | int | None = None, osr: ndarray | None = None, logscale: bool | int = True, harmonic: int = 5, smooth: int | None = None, ax: Axes | None = None) tuple[ndarray, ndarray, ndarray, ndarray][source]#
Sweep ADC performance metrics versus oversampling ratio.
This is the Python counterpart of MATLAB
perfosr. It returns the same four outputs in the same order:osr, sndr, sfdr, enob.sndris the fitted-sine RMS power divided by in-band residual RMS power.sfdris a fast single-bin estimate from the residual spectrum; usecompute_spectrum/analyze_spectrumfor full integrated-lobe SFDR.Parameters mirror the MATLAB name-value arguments where practical.
dispcontrols plotting; when omitted it defaults toFalsebecause Python callers commonly consume returned values programmatically.
- adctoolbox.oversampling.ntfperf(ntf, fl: float, fh: float, disp: bool | int = False, *, n_grid: int = 1000000) float[source]#
Analyze NTF in-band noise suppression.
This is the Python counterpart of MATLAB
ntfperf(ntf, fl, fh, disp). It returns the SNR improvement in dB over a flatNTF = 1baseline. The default frequency grid matches MATLABntfperf.m.
- adctoolbox.oversampling.ntf_analyzer(ntf, flow, fhigh, is_plot=None, *, n_grid=65536, grid_policy='python')[source]#
Analyze the performance of NTF (Noise Transfer Function)
- Parameters:
ntf – The noise transfer function (in z domain) - scipy.signal.TransferFunction or tuple (num, den)
flow – Low bound frequency of signal band (relative to Fs)
fhigh – High bound frequency of signal band (relative to Fs)
is_plot – Optional plotting flag (1 to plot, None or 0 to skip)
n_grid – Number of frequency grid points used for integration.
grid_policy – “python” keeps the historical linspace grid; “matlab” uses the same grid as MATLAB ntfperf.m.
- Returns:
Integrated noise suppression of NTF in signal band in dB (compared to NTF=1)
- Return type:
noiSup
Workflow Notes#
ifilterIdeal FFT brickwall filtering. Use
ifilter(x, [[0, 0.5 / OSR]])to extract the in-band waveform before downstream narrow-band analysis.perfosrMATLAB-style four-output wrapper around the Python OSR sweep engine:
osr, sndr, sfdr, enob = perfosr(x, osr=[2, 4, 8, 16]). The sweep uses a sine-fit residual path for speed: SNDR is fitted-sine RMS power divided by in-band residual RMS power, while SFDR is a fast single-bin residual spur estimate. Useanalyze_spectrumorcompute_spectrumwhen you need the full integrated-lobe SFDR used by the main spectrum analyzer.ntfperf/ntf_analyzerAnalyze theoretical NTF in-band noise suppression. These functions do not generate a noise-shaped waveform; they evaluate an NTF response over a signal band.