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[源代码]#

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.

参数:
  • 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, where 0 is DC and 0.5 is Nyquist.

返回:

Filtered signal in MATLAB-style orientation.

返回类型:

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][源代码]#

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. sndr is the fitted-sine RMS power divided by in-band residual RMS power. sfdr is a fast single-bin estimate from the residual spectrum; use compute_spectrum/analyze_spectrum for full integrated-lobe SFDR.

Parameters mirror the MATLAB name-value arguments where practical. disp controls plotting; when omitted it defaults to False because Python callers commonly consume returned values programmatically.

adctoolbox.oversampling.ntfperf(ntf, fl: float, fh: float, disp: bool | int = False, *, n_grid: int = 1000000) float[源代码]#

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 flat NTF = 1 baseline. The default frequency grid matches MATLAB ntfperf.m.

adctoolbox.oversampling.ntf_analyzer(ntf, flow, fhigh, is_plot=None, *, n_grid=65536, grid_policy='python')[源代码]#

Analyze the performance of NTF (Noise Transfer Function)

参数:
  • 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.

返回:

Integrated noise suppression of NTF in signal band in dB (compared to NTF=1)

返回类型:

noiSup

Workflow Notes#

ifilter

Ideal FFT brickwall filtering. Use ifilter(x, [[0, 0.5 / OSR]]) to extract the in-band waveform before downstream narrow-band analysis.

perfosr

MATLAB-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. Use analyze_spectrum or compute_spectrum when you need the full integrated-lobe SFDR used by the main spectrum analyzer.

ntfperf / ntf_analyzer

Analyze theoretical NTF in-band noise suppression. These functions do not generate a noise-shaped waveform; they evaluate an NTF response over a signal band.