Skip to main content

mp-dsp-python

Python integration layer for the mixed-precision-dsp C++ library, providing nanobind bindings, matplotlib visualizations, and Jupyter notebooks for the full DSP domain.

Why

The mixed-precision-dsp library is a C++20 header-only DSP library covering signals, windows, quantization, IIR/FIR filtering, spectral analysis, signal conditioning, estimation (Kalman/LMS/RLS), image processing, and numerical analysis — all parameterized on arithmetic type for mixed-precision research.

DSP researchers work in Python. Jupyter notebooks, matplotlib, SciPy, and NumPy are the standard tools for prototyping, analysis, and publication-quality visualization. This repository bridges the gap: C++ does the mixed-precision math across the full DSP domain; Python orchestrates experiments and presents results.

Without this layer, every mixed-precision experiment requires writing a C++ application, exporting CSV, and hand-crafting plotting scripts. With mp-dsp-python, the entire sw::dsp library is accessible from a single import mpdsp statement.

import mpdsp
import numpy as np
import matplotlib.pyplot as plt

# Signal generation
signal = mpdsp.sine(length=2000, frequency=440, sample_rate=44100)
noise = mpdsp.gaussian_noise(length=2000, stddev=0.1)
noisy = signal + noise

# Windowing
window = mpdsp.hamming(2000)
windowed = noisy * window

# Spectral analysis
freqs, psd = mpdsp.psd(windowed, sample_rate=44100)
plt.semilogy(freqs, psd)

# IIR filtering with mixed precision
filt = mpdsp.butterworth_lowpass(order=4, sample_rate=44100, cutoff=1000)
ref    = filt.process(signal, dtype="reference")      # double/double/double
posit  = filt.process(signal, dtype="posit_full")      # double/posit<32,2>/posit<16,1>
print(f"SQNR: {mpdsp.sqnr_db(ref, posit):.1f} dB")

# Image processing
img = mpdsp.checkerboard(256, 256, block_size=8)
edges = mpdsp.canny(img, low_threshold=0.1, high_threshold=0.3, sigma=1.0)
mpdsp.write_pgm("edges.pgm", edges)

# Estimation
kf = mpdsp.KalmanFilter(state_dim=2, meas_dim=1)
# ... configure and run

# Analysis
margin = filt.stability_margin()
poles = filt.poles()
sensitivity = filt.worst_case_sensitivity()

What

Full DSP Domain Coverage

mp-dsp-python exposes every module of the C++ library to Python. The 2026-08-02 bindings-gap roadmap (epic #100) closed 18 sub-issues across 5 phases, bringing coverage from ~65% to ~93% of the v0.6.0 surface — see docs/gap_analysis_2026-08-02.md for the module-by-module state. For the complete enumeration of every public name with signatures and one-line descriptions, see docs/api_reference.md.

Module C++ Headers Python API Description
signals generators.hpp, sampling.hpp mpdsp.sine(), mpdsp.chirp(), mpdsp.impulse(), mpdsp.step(), mpdsp.ramp(), mpdsp.multitone(), mpdsp.white_noise(), mpdsp.gaussian_noise(), mpdsp.pink_noise(), mpdsp.upsample(), mpdsp.downsample(), ... Full signal generator suite returning NumPy arrays. Rate-conversion helpers (upsample/downsample) are zero-insert / naive decimation — for anti-aliasing pair them with FIR / halfband / polyphase.
windows hamming.hpp, hanning.hpp, blackman.hpp, kaiser.hpp, tukey.hpp, gaussian.hpp, dolph_chebyshev.hpp, bartlett_hann.hpp, flat_top.hpp, rectangular.hpp mpdsp.hamming(), mpdsp.hanning(), mpdsp.blackman(), mpdsp.kaiser(), mpdsp.tukey(), mpdsp.gaussian(), mpdsp.dolph_chebyshev(), mpdsp.bartlett_hann(), mpdsp.flat_top(), mpdsp.rectangular() All 10 window functions bound.
quantization adc.hpp, dac.hpp, dither.hpp, noise_shaping.hpp, sqnr.hpp mpdsp.adc(), mpdsp.dac(), mpdsp.sqnr_db(), mpdsp.measure_sqnr_db(), mpdsp.RPDFDither(), mpdsp.TPDFDither(), mpdsp.FirstOrderNoiseShaper(), ... ADC/DAC modeling with type dispatch. RPDF/TPDF dithering and first-order error-feedback noise shaping for quantization improvement. SQNR measurement — the core metric for mixed-precision evaluation.
filter/iir butterworth.hpp, chebyshev1.hpp, chebyshev2.hpp, elliptic.hpp, bessel.hpp, legendre.hpp, rbj.hpp mpdsp.butterworth_lowpass(), mpdsp.chebyshev1_highpass(), mpdsp.elliptic_bandpass(), mpdsp.rbj_lowshelf(), IIRFilter.from_coefficients(list), ... All 7 IIR families with LP/HP/BP/BS (and RBJ shelf/allpass) variants. Design in double, process with type dispatch. Filter objects expose poles(), frequency_response(), stability_margin(), condition_number(), pole_displacement(), worst_case_sensitivity() as methods. IIRFilter.from_coefficients() imports filters designed elsewhere (scipy, MATLAB, hand-cascaded).
filter/fir fir_filter.hpp, fir_design.hpp, remez.hpp, overlap.hpp, filtfilt.hpp mpdsp.fir_lowpass(), mpdsp.fir_bandpass(), mpdsp.fir_filter(), mpdsp.remez(), mpdsp.remez_lowpass(), mpdsp.remez_bandpass(), mpdsp.filtfilt(), mpdsp.OverlapAddConvolver(), mpdsp.OverlapSaveConvolver(), ... FIR window-method design, Parks-McClellan (Remez) equiripple design, zero-phase forward-backward filtering (filtfilt, scipy analogue), block-FFT convolvers for long signals.
spectral fft.hpp, dft.hpp, psd.hpp, spectrogram.hpp, ztransform.hpp, laplace.hpp mpdsp.fft(), mpdsp.ifft(), mpdsp.fft_magnitude_db(), mpdsp.psd(), mpdsp.periodogram(), mpdsp.welch(), mpdsp.spectrogram(), mpdsp.ztransform(), mpdsp.freqz(), mpdsp.group_delay(), mpdsp.laplace_freqs() FFT (Cooley-Tukey), power spectral density (single-shot psd and averaged welch), STFT/spectrogram, Z-transform and Laplace evaluation. All primitives accept dtype= for mixed-precision arithmetic.
spectrum realtime_spectrum.hpp, detectors.hpp, rbw_filter.hpp, vbw_filter.hpp, swept_lo.hpp, front_end_corrector.hpp, trace_averaging.hpp, waterfall_buffer.hpp, markers.hpp mpdsp.RealtimeSpectrum(), mpdsp.detect_peak() + _sample/_average/_rms/_negative_peak/detect(mode), mpdsp.RBWFilter(), mpdsp.VBWFilter(), mpdsp.SweptLO(), mpdsp.FrontEndCorrector(), mpdsp.CalibrationProfile(), mpdsp.TraceAverager(), mpdsp.WaterfallBuffer(), mpdsp.Marker/DeltaMarker, mpdsp.find_peaks(), mpdsp.harmonic_markers() Full spectrum-analyzer stack: streaming FFT engine + 5 detector reducers, resolution / video bandwidth filters, swept local oscillator, front-end equalization, cross-sweep trace averaging (5 modes), 2D waterfall memory, marker + peak-finder primitives.
acquisition nco.hpp, cic.hpp, halfband.hpp, polyphase_decimator.hpp, ddc.hpp, decimation_chain.hpp mpdsp.NCO(), mpdsp.CICDecimator(), mpdsp.CICInterpolator(), mpdsp.HalfBandFilter(), mpdsp.PolyphaseDecimator(), mpdsp.PolyphaseInterpolator(), mpdsp.DDC(), mpdsp.DecimationChain(), mpdsp.design_halfband(), mpdsp.design_cic_compensator(), mpdsp.polyphase_decompose(), nco.measure_sfdr_db(), cic.check_bit_growth() High-rate acquisition pipeline (numerically-controlled oscillator, CIC decimator/interpolator, halfband/polyphase filters). DDC composes NCO mixing with matched I/Q polyphase decimation to bring an IF band to complex baseband; DecimationChain cascades heterogeneous decimation stages (ADC → CIC → halfband → FIR) with per-stage rate bookkeeping, and design_cic_compensator inverts CIC passband droop. NCO and CIC also carry precision-analysis methods (measure_sfdr_db, check_bit_growth).
multirate channelizer.hpp, fractional_delay.hpp mpdsp.Channelizer(), mpdsp.FractionalDelay(), mpdsp.channelizer_prototype_bank() Bellanger polyphase channelizer — splits a wideband input into M uniformly-spaced complex baseband channels for roughly one prototype-filter evaluation per input sample, rather than one per channel. Polyphase fractional-sample delay with 1/L resolution, measured accurate to better than 0.01 samples at unity gain.
conditioning envelope.hpp, compressor.hpp, agc.hpp, src.hpp mpdsp.PeakEnvelope(), mpdsp.RMSEnvelope(), mpdsp.Compressor(), mpdsp.AGC(), mpdsp.RationalResampler() Envelope followers (peak, RMS). Dynamic range compressor with soft knee. Automatic gain control. Polyphase L/M rate conversion (scipy resample_poly analogue).
estimation kalman.hpp, ekf.hpp, ukf.hpp, lms.hpp, rls.hpp mpdsp.KalmanFilter(), mpdsp.ExtendedKalmanFilter(), mpdsp.UnscentedKalmanFilter(), mpdsp.LMSFilter(), mpdsp.NLMSFilter(), mpdsp.RLSFilter() Linear Kalman + nonlinear EKF (Python callbacks for f, F, h, H) + UKF (Python callbacks for f, h — no Jacobians). LMS/NLMS adaptive filters. RLS with forgetting factor. State matrices as NumPy 2D arrays.
image image.hpp, convolve2d.hpp, separable.hpp, morphology.hpp, edge.hpp, generators.hpp mpdsp.convolve2d(), mpdsp.gaussian_blur(), mpdsp.sobel_x(), mpdsp.canny(), mpdsp.dilate(), mpdsp.checkerboard(), ... 2D convolution, separable filters, Gaussian/box blur. Morphological operations (erode, dilate, open, close, gradient, tophat). Sobel, Prewitt, Canny edge detection. Image generators (checkerboard, zone plate, gradients, noise, blobs).
instrument measurements.hpp, peak_detect.hpp, ring_buffer.hpp mpdsp.peak_to_peak(), mpdsp.instrument_mean(), mpdsp.instrument_rms(), mpdsp.rise_time(), mpdsp.fall_time(), mpdsp.period(), mpdsp.frequency(), mpdsp.PeakDetectDecimator(), mpdsp.TriggerRingBuffer() Oscilloscope-style stateless measurements (7 primitives), scope min/max-preserving decimator, pre/post-trigger capture with 4-state lifecycle. mean/rms prefixed with instrument_ to avoid shadowing numpy.mean/numpy.rms.
analysis stability.hpp, sensitivity.hpp, condition.hpp, acquisition_precision.hpp filt.stability_margin(), filt.condition_number(), filt.worst_case_sensitivity(), filt.pole_displacement(dtype), mpdsp.coefficient_sensitivity(), mpdsp.biquad_condition_number(), mpdsp.enob_from_snr_db(), mpdsp.snr_db(), mpdsp.CICBitGrowthReport, mpdsp.AcquisitionPrecisionRow, mpdsp.write_acquisition_csv() Coefficient-level (free function) and cascade-level (filter method) stability / sensitivity / conditioning analysis. Acquisition-pipeline precision metrics (ENOB, SNR) plus a CSV writer schema-compatible with the C++ precision-sweep outputs.
math polynomial.hpp, quadratic.hpp, elliptic_integrals.hpp, root_finder.hpp mpdsp.evaluate_polynomial(), mpdsp.multiply_polynomials(), mpdsp.solve_quadratic() (+ _1, _2), mpdsp.elliptic_K(), mpdsp.RootFinder() Numerical utilities for advanced filter design: Horner polynomial evaluation, polynomial multiplication (convolution), quadratic solver returning complex roots, complete elliptic integral (Cauer filter design), Laguerre polynomial root finder up to degree 32.
transfer_function pole_zero.hpp, bode.hpp mpdsp.butterworth_prototype(), mpdsp.chebyshev1_prototype(), mpdsp.chebyshev2_prototype(), mpdsp.bessel_prototype(), mpdsp.elliptic_prototype(), mpdsp.lp_to_hp(), mpdsp.lp_to_bp(), mpdsp.lp_to_bs(), mpdsp.apply_bilinear(), mpdsp.PoleZeroPlot, mpdsp.sweep_bode(), mpdsp.BodeResult Analog (s-plane) prototypes for all five classical families, with LP→HP/BP/BS frequency transforms and the bilinear map to the z-plane — the pre-warp view a designed filter's digital response hides. sweep_bode measures a filter's response empirically by driving it with a settled sine per frequency, so unlike frequency_response() it registers sample-path quantization at the chosen dtype.
types projection.hpp, transfer_function.hpp, biquad_coefficients.hpp, pole_zero_pair.hpp, complex_pair.hpp mpdsp.TransferFunction(), mpdsp.ContinuousTransferFunction(), mpdsp.project_onto(), mpdsp.projection_error(), mpdsp.BiquadCoefficients(), mpdsp.PoleZeroPair(), mpdsp.ComplexPair(), mpdsp.to_transfer_function(filt) Rational transfer function H(z) = B(z)/A(z) with complex-plane evaluation, frequency response, stability check, and cascade via *. Structured biquad-level types with read-write fields for constructing filters from raw coefficients. Type-projection round-trip for quantifying quantization loss outside the filter path.
io wav.hpp, csv.hpp, pgm.hpp, ppm.hpp, bmp.hpp mpdsp.read_wav(), mpdsp.write_wav(), mpdsp.read_pgm(), mpdsp.write_pgm(), mpdsp.read_ppm(), mpdsp.write_ppm(), mpdsp.read_bmp(), mpdsp.write_bmp(), CSV via mpdsp.load_sweep() WAV audio (8/16/24/32-bit integer PCM read+write, 32-bit float PCM read). PGM/PPM/BMP image I/O. CSV signal I/O. All converting to/from NumPy arrays.

Mixed-Precision Type Dispatch

Every processing function that operates on data accepts a dtype parameter selecting the arithmetic configuration. Python never sees C++ template types — it passes a string key and gets back float64 NumPy arrays.

# Same API, different arithmetic — IIR/FIR filters
result_f32  = filt.process(signal, dtype="gpu_baseline")    # float state+sample
result_p16  = filt.process(signal, dtype="posit_full")      # posit<32,2> / posit<16,1>
result_half = filt.process(signal, dtype="half")            # cfloat<16,5> throughout

# Image processing — convolve2d, separable_filter, gaussian_blur,
# box_blur, sobel_x/y, prewitt_x/y, gradient_magnitude, canny, rgb_to_gray
edges_ref = mpdsp.canny(img, 0.1, 0.3, dtype="reference")
edges_p8  = mpdsp.canny(img, 0.1, 0.3, dtype="tiny_posit")

# Quantization — adc, measure_sqnr_db
quantized = mpdsp.adc(signal, dtype="half")

# Conditioning — PeakEnvelope, RMSEnvelope, Compressor, AGC
comp = mpdsp.Compressor(sample_rate=44100, threshold_db=-12.0, ratio=4.0,
                        attack_ms=5.0, release_ms=50.0, dtype="posit_full")

# Estimation — KalmanFilter, LMSFilter, NLMSFilter, RLSFilter
kf = mpdsp.KalmanFilter(2, 1, dtype="cf24")

Spectral primitives (fft, ifft, psd, welch, periodogram, spectrogram) all accept dtype=; inputs and outputs stay double/ complex128 at the Python layer while the internal arithmetic runs at the selected precision. Signal generators are intentionally reference- precision (they aren't part of a mixed-precision datapath). Window functions accept dtype= for cases where the window itself is part of a precision study.

Pre-Instantiated Configurations

Config CoeffScalar StateScalar SampleScalar Target
reference double double double Ground truth
gpu_baseline double float float GPU / embedded CPU
ml_hw double float cfloat<16,5> (IEEE half) ML accelerator
posit_full double posit<32,2> posit<16,1> Mixed-precision posit pipeline
cf24 double cfloat<24,5> cfloat<24,5> Custom 24-bit float research
half double cfloat<16,5> cfloat<16,5> IEEE half throughout
sensor_8bit double double integer<8> Standard 8-bit sensor ADC
sensor_6bit double double integer<6> Noise-limited sensor
fpga_fixed double fixpnt<32,24> fixpnt<16,12> FPGA fixed-point datapath

Posit taxonomy gridposit<N, es> single-type configs for N ∈ {8, 16, 32}, es ∈ {0, 1, 2}. All three scalars (coefficient, state, sample) use the same posit type, so these cells cleanly compare ES-vs-precision tradeoff at fixed bit width:

Config Posit type Notes
posit_8_0 / posit_8_1 / posit_8_2 posit<8, 0/1/2> posit_8_2 is canonical for 8-bit; tiny_posit is a legacy alias
posit_16_0 / posit_16_1 / posit_16_2 posit<16, 0/1/2> posit_16_1 is the standard 16-bit posit (also used as posit_full's sample)
posit_32_0 / posit_32_1 / posit_32_2 posit<32, 0/1/2> posit_32_2 is the standard 32-bit posit (also used as posit_full's state)

Query the live set at runtime with mpdsp.available_dtypes() (18 entries). Sample-scalar bit width per config is available via mpdsp.bits_of(dtype) — useful for labeling the x-axis of precision-vs-cost plots. For posit grid cells the ES dimension doesn't affect bit width, so every posit_N_* reports N; plotting a full sweep gives 3 points stacked vertically at each width showing ES's effect on SQNR.

Coefficients are designed in double by default — design-time precision is what keeps an IIR cascade well-conditioned (see the educational guide). The classical IIR families (Butterworth, Chebyshev, Bessel, Legendre, Elliptic) design in double unconditionally; dtype= on those filters selects the processing path only.

The designers that do expose a coeff_dtype= knob — the seven rbj_* biquads and the FIR/Remez designers — offer it to measure what design-time precision costs, not to recommend spending it. The result is still stored in double, so the knob isolates the arithmetic used to compute the coefficients from the arithmetic used to hold them. Its dual is IIRFilter.pole_displacement(dtype), which quantizes an already-designed cascade: coeff_dtype asks what computing in T costs, pole_displacement asks what storing in T costs.

For algorithms that don't have a design/runtime split (FFT, convolution, Kalman), all three scalars use the target configuration.

Visualization Toolkit

Beyond bindings, mp-dsp-python provides matplotlib helpers and Jupyter notebooks tailored to mixed-precision DSP research:

Visualization Description
Magnitude/phase response Filter frequency response overlaid across arithmetic types
Impulse response Time-domain comparison of filter outputs
SQNR heatmap Filter family × arithmetic type, colored by SQNR (dB)
SQNR bar chart Grouped bars per filter family
Pole-zero diagram Unit circle with reference vs. displaced poles
Spectrogram Time-frequency display from STFT
PSD comparison Power spectral density across arithmetic types
Image pipeline Side-by-side: original → noisy → filtered → edges
Sensor noise analysis SQNR vs. bit-width for image processing
Precision-cost frontier SQNR vs. bits-per-sample Pareto plot
Kalman tracking State estimation convergence across types

Interactive Filter Designer

A Streamlit dashboard at scripts/plot_dashboard.py exposes every IIR family (Butterworth, Chebyshev I/II, Bessel, Legendre, Elliptic, RBJ biquads) with live magnitude/phase plots, pole-zero diagrams, impulse and step response, and a side-by-side mixed-precision comparison across all 7 arithmetic configurations — modeled on Vinnie Falco's classic DSPFilters demo, with the mixed-precision angle that is the whole point of this library.

pip install mpdsp[dashboard]
streamlit run scripts/plot_dashboard.py

Full walkthrough (install paths for local / SSH-tunnel / LAN, tab-by-tab tour, mixed-precision interpretation guide, export conventions) in docs/dashboard.md.

How

Repository Structure

mp-dsp-python/
├── CMakeLists.txt                  # nanobind + sw::dsp + Universal + MTL5
├── src/
│   ├── bindings.cpp                # nanobind module definition
│   ├── types.hpp                   # ArithConfig enum + dispatch table
│   ├── types_bindings.cpp          # TransferFunction, structured biquad types
│   ├── _binding_helpers.hpp        # Shared marshalling + dispatch helpers
│   ├── BINDING_PATTERNS.md         # Contributor notes on binding conventions
│   ├── signal_bindings.cpp         # signals + windows + WAV I/O
│   ├── filter_bindings.cpp         # IIR/FIR design, filtfilt, remez, overlap
│   ├── spectral_bindings.cpp      # FFT, PSD, welch, spectrogram
│   ├── spectrum_bindings.cpp      # analyzer stack (RealtimeSpectrum, RBW/VBW, ...)
│   ├── conditioning_bindings.cpp  # envelope, compressor, AGC, RationalResampler
│   ├── estimation_bindings.cpp    # Kalman + EKF + UKF + LMS/NLMS/RLS
│   ├── acquisition_bindings.cpp   # NCO, CIC, halfband, polyphase
│   ├── instrument_bindings.cpp    # scope measurements, PeakDetectDecimator, TriggerRingBuffer
│   ├── image_bindings.cpp         # 2D convolution, morphology, edge
│   ├── quantization_bindings.cpp  # ADC/DAC, dither, SQNR
│   ├── analysis_bindings.cpp      # stability, sensitivity, condition, acquisition-precision
│   └── math_bindings.cpp          # polynomial, quadratic, elliptic_K, RootFinder
├── python/
│   └── mpdsp/
│       ├── __init__.py             # Public API surface
│       ├── filters.py              # Pythonic filter wrapper classes
│       ├── estimation.py           # Kalman/adaptive filter wrappers
│       ├── image.py                # Image processing helpers
│       ├── analysis.py             # Analysis helpers
│       ├── plotting.py             # matplotlib convenience functions
│       └── io.py                   # File I/O + CSV import
├── notebooks/
│   ├── 02_iir_precision.ipynb          # Mixed-precision IIR comparison
│   ├── 03_fir_and_windows.ipynb        # FIR design, window functions
│   ├── 04_interactive_precision.ipynb  # Interactive precision sweep
│   ├── 05_conditioning.ipynb           # Envelope, compression, AGC
│   ├── 06_estimation.ipynb             # Kalman tracking, LMS adaptive
│   ├── 07_image_processing.ipynb       # 2D filtering, edge detection
│   ├── 08_sensor_noise.ipynb           # Sensor noise precision analysis
│   └── 09_numerical_analysis.ipynb     # Stability, sensitivity, condition
├── scripts/
│   ├── plot_precision.py           # Magnitude/phase from CSV
│   ├── plot_heatmap.py             # SQNR heatmap from CSV
│   ├── plot_pole_zero.py           # Pole-zero on unit circle
│   └── plot_dashboard.py           # Streamlit interactive dashboard
├── tests/                          # 16 test files, ~1250 tests
│   ├── test_signals.py             # generators + windows (bundled)
│   ├── test_filters.py             # IIR + FIR + Remez + Overlap + filtfilt
│   ├── test_spectral.py            # FFT, PSD, welch, spectrogram
│   ├── test_spectrum.py            # analyzer stack (RealtimeSpectrum, RBW/VBW, ...)
│   ├── test_conditioning.py        # envelope, AGC, RationalResampler
│   ├── test_estimation.py          # Kalman + EKF + UKF + adaptive
│   ├── test_acquisition.py         # NCO, CIC, halfband, polyphase
│   ├── test_instrument.py          # scope measurements + capture primitives
│   ├── test_analysis.py            # stability, sensitivity, acquisition-precision
│   ├── test_math.py                # polynomial, quadratic, RootFinder, elliptic_K
│   ├── test_types.py               # TransferFunction + structured biquad types
│   ├── test_image.py               # image processing
│   ├── test_quantization.py        # ADC/DAC, dither, SQNR
│   ├── test_io.py                  # WAV/PGM/PPM/BMP round-trips
│   ├── test_scripts.py             # CSV-plotting script smoke tests
│   └── test_version.py             # version lockstep check
├── docs/
│   ├── api_reference.md
│   ├── dashboard.md
│   ├── publishing.md
│   ├── gap_analysis_2026-08-01.md  # Pre-roadmap coverage snapshot
│   └── gap_analysis_2026-08-02.md  # Post-roadmap coverage snapshot
└── README.md

Build

# Prerequisites: Python 3.9+, CMake 3.22+, C++20 compiler
pip install nanobind numpy matplotlib

# Build the C++ extension module
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

# Install in development mode
pip install -e .

The build system resolves mixed-precision-dsp, Universal, and MTL5 in this order:

  1. Sibling clone — if a checkout exists at ../mixed-precision-dsp, ../universal, or ../mtl5, it is used directly. This is the recommended workflow when iterating across the C++ stack and the Python bindings together.
  2. find_package — MTL5 only; checks for an installed package config.
  3. FetchContent — pulled from GitHub at the pin tags below. Used by cibuildwheel and any other environment without local siblings.

Minimum versions enforced at configure time on the sibling-clone path (stale checkouts abort with a clear error and the git checkout command needed to fix them):

Peer Floor (sibling-path) FetchContent pin
mixed-precision-dsp ≥ 0.6.0 v0.6.0
universal ≥ 4.6.11 v4.6.11
mtl5 ≥ 5.7.0 v5.7.0

Note: the MTL5 floor was bumped from 5.2.1 → 5.7.0 in 2026-08-02 as prep for UnscentedKalmanFilter, which uses mtl::ldlt_factor (landed in MTL5 v5.3.0). Jumping straight to the latest 5.x release keeps the project on current upstream.

Only the DSP pin is constrained to lag the floor during a development cycle: it moves in lockstep with project(VERSION) (see tests/test_version.py::test_lockstep_prefix) and only advances at release time. The universal and mtl5 pins are free to track the floor — keeping them current avoids CI building in a configuration strictly weaker than what sibling-path devs require.

Override at configure time with -DMPDSP_REQUIRED_DSP_VERSION=... (lower the floor for experimentation) or -DMPDSP_DSP_PIN=main (build against an unreleased upstream).

Quick Start: CSV Plotting (No Build Required)

The plotting scripts work immediately with CSV output from the C++ precision sweep, without building any nanobind module:

# In the mixed-precision-dsp repo:
cd build && ./applications/mp_comparison/iir_precision_sweep /tmp/csv_output

# In this repo:
python scripts/plot_precision.py /tmp/csv_output
python scripts/plot_heatmap.py /tmp/csv_output
python scripts/plot_pole_zero.py /tmp/csv_output

Quick Start: Full Python API

import mpdsp
import numpy as np
import matplotlib.pyplot as plt

# --- Signal Processing ---
# Generate and analyze signals
signal = mpdsp.sine(2000, frequency=440, sample_rate=44100)
window = mpdsp.blackman(2000)
freqs, psd = mpdsp.psd(signal * window, sample_rate=44100)

# --- Filtering ---
# Design and compare IIR filters across arithmetic types
filt = mpdsp.butterworth_lowpass(order=4, sample_rate=44100, cutoff=1000)
results = {}
for dtype in ["reference", "gpu_baseline", "posit_full", "half"]:
    results[dtype] = filt.process(signal, dtype=dtype)
    if dtype != "reference":
        sqnr = mpdsp.sqnr_db(results["reference"], results[dtype])
        print(f"  {dtype:20s}  SQNR = {sqnr:.1f} dB")

# --- Spectral Analysis ---
# fft / ifft / psd / periodogram / spectrogram all accept dtype=.
# Returned tuple is (real, imag).
real, imag = mpdsp.fft(signal, dtype="posit_full")

# --- Image Processing ---
# Full image pipeline
img = mpdsp.checkerboard(256, 256, block_size=16)
noisy = mpdsp.add_noise(img, stddev=0.1)
denoised = mpdsp.gaussian_blur(noisy, sigma=1.5)
edges = mpdsp.canny(denoised, low_threshold=0.1, high_threshold=0.3)

# Compare edge detection across arithmetic types
edges_ref = mpdsp.canny(denoised, 0.1, 0.3, dtype="reference")
edges_p8  = mpdsp.canny(denoised, 0.1, 0.3, dtype="tiny_posit")
agreement = np.mean(edges_ref == edges_p8)
print(f"  Edge agreement (posit<8,2>): {agreement:.1%}")

# --- Estimation ---
# Kalman filter tracking
kf = mpdsp.KalmanFilter(state_dim=4, meas_dim=2)
# configure F, H, Q, R matrices as NumPy arrays
# kf.predict(); kf.update(measurement)

# --- Analysis ---
# Numerical quality tools
print(f"  Stability margin: {filt.stability_margin():.4f}")
print(f"  Condition number: {filt.condition_number():.2e}")
print(f"  Worst sensitivity: {filt.worst_case_sensitivity():.4f}")

Relationship to mixed-precision-dsp

This repository is the Python integration layer for the full stillwater-sc/mixed-precision-dsp C++ library. The C++ library implements 17 DSP modules with mixed-precision arithmetic; this repo makes essentially all of them accessible to Python researchers (~93% of the v0.6.0 surface after the 2026-08-02 bindings-gap roadmap; see docs/gap_analysis_2026-08-02.md for the current coverage state and residual gaps).

Design Documents

Dependencies

Library Purpose Repository
mixed-precision-dsp C++ DSP algorithms (all 12 modules) stillwater-sc/mixed-precision-dsp
Universal Number type arithmetic (posit, cfloat, fixpnt, ...) stillwater-sc/universal
MTL5 Dense/sparse linear algebra stillwater-sc/mtl5
nanobind C++ ↔ Python bindings wjakob/nanobind
NumPy Array interop (all data passes through NumPy)
matplotlib 2D visualization
Streamlit Interactive dashboard (optional)

License

MIT License. Copyright (c) 2024-2026 Stillwater Supercomputing, Inc.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mpdsp-0.9.0.tar.gz (4.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mpdsp-0.9.0-cp312-cp312-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.12Windows x86-64

mpdsp-0.9.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

mpdsp-0.9.0-cp312-cp312-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

mpdsp-0.9.0-cp311-cp311-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.11Windows x86-64

mpdsp-0.9.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

mpdsp-0.9.0-cp311-cp311-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

mpdsp-0.9.0-cp310-cp310-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.10Windows x86-64

mpdsp-0.9.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

mpdsp-0.9.0-cp310-cp310-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

mpdsp-0.9.0-cp39-cp39-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.9Windows x86-64

mpdsp-0.9.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

mpdsp-0.9.0-cp39-cp39-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file mpdsp-0.9.0.tar.gz.

File metadata

  • Download URL: mpdsp-0.9.0.tar.gz
  • Upload date:
  • Size: 4.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mpdsp-0.9.0.tar.gz
Algorithm Hash digest
SHA256 e71d4fbbfa6fca7e8974ba5c666d524030ed209cc5696f3245a8e6b6e54fb41f
MD5 33938c08bfc70114aca3f190cfd4f8c7
BLAKE2b-256 271d271c070272349d778e8fc0b2e7ec54004151b65e2fe9d213d234b1a365e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for mpdsp-0.9.0.tar.gz:

Publisher: publish.yml on stillwater-sc/mp-dsp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mpdsp-0.9.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: mpdsp-0.9.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mpdsp-0.9.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 c2fef033868c9a10d44d0cb4d3474ccb13b111698133d1dca411aed2f39d424b
MD5 5bafe5a8e0a2256c510cb533b081d078
BLAKE2b-256 9d551420fb89ae1da89e4eb07d849d6c2c0a94ac35c117840be757d387ab4bf3

See more details on using hashes here.

Provenance

The following attestation bundles were made for mpdsp-0.9.0-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on stillwater-sc/mp-dsp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mpdsp-0.9.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mpdsp-0.9.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 91810ff897093f89b3e0b409efa7a5cea37adc2c0b42e6eb73bd4d401783c2df
MD5 afcabce67e8729b7f8e2a4249a08ac7f
BLAKE2b-256 b0190851c7c70d1cd261e9ce6b26af56b6641dd020f4a4ace2255df88d2ce91e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mpdsp-0.9.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on stillwater-sc/mp-dsp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mpdsp-0.9.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mpdsp-0.9.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 de34284d83752f8a11b78a7b345f200a2e3539af014b6d374f54d5a4a9bb53ff
MD5 fdb7d790e55cbc5f2110095fef478d00
BLAKE2b-256 277235bf821603002f9f799e145ab35046dbcf8cac3a7dddf71bf6ccb7292842

See more details on using hashes here.

Provenance

The following attestation bundles were made for mpdsp-0.9.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on stillwater-sc/mp-dsp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mpdsp-0.9.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: mpdsp-0.9.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mpdsp-0.9.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 bb5b0d3a0501421368c137d36c6a83345dd9d57719db807142bc1d717ed09df7
MD5 47b4c56f8ccb06ccf2f7edca9500183a
BLAKE2b-256 ed9cf0cfd309d5600d346097527930771252faf38ca4242575c27b4ed2ed7bef

See more details on using hashes here.

Provenance

The following attestation bundles were made for mpdsp-0.9.0-cp311-cp311-win_amd64.whl:

Publisher: publish.yml on stillwater-sc/mp-dsp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mpdsp-0.9.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mpdsp-0.9.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0e8a9864497f9237be56243297f8e86d0e024078a5e73ea85590fa29926a56d3
MD5 095ee29435e4778ba330255442997241
BLAKE2b-256 1a57454046855b0d5e0b6c28e485d225a4b6a19bb510c95145195afb0f8409fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for mpdsp-0.9.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on stillwater-sc/mp-dsp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mpdsp-0.9.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mpdsp-0.9.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7a9c5fa52c6f7f86aa6987007069a80f88a17ed838ac63ba83d857d07acf9e6f
MD5 40dd0bf62bcd7072f2e0435fe9b42358
BLAKE2b-256 4bc8c1aeb04ad77072918d96b3f00de66331a9d9aaf19cde0f8485a013936616

See more details on using hashes here.

Provenance

The following attestation bundles were made for mpdsp-0.9.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yml on stillwater-sc/mp-dsp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mpdsp-0.9.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: mpdsp-0.9.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mpdsp-0.9.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e4c114340903ad953ea01de4cc32693105ceb7a9127210a2ceee04b2d06da7f2
MD5 e2ad4ce92e7e1b016d7b366b7fee03e9
BLAKE2b-256 aca2dabc2727fba62f84e6ea2e896b4f1a62b299620d1be748dc31132581422f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mpdsp-0.9.0-cp310-cp310-win_amd64.whl:

Publisher: publish.yml on stillwater-sc/mp-dsp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mpdsp-0.9.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mpdsp-0.9.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 59d667ef288981f567cc6cce193deb478f9e44aedca4cf48ca804bce05c1ae6b
MD5 8ca0471bf23e5e9fc9f181f2e7b54e8c
BLAKE2b-256 fb9cb99ec50639aa390ab25e1e9d7ece2bd6a2ff542b81e003c0bc9abbb1ce8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mpdsp-0.9.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on stillwater-sc/mp-dsp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mpdsp-0.9.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mpdsp-0.9.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ece113f094918d86340fab885293fd4f4ce570583d18ab1888998b69f11a15c9
MD5 b89242fbeaabd53046c9fb7b7bcd79fe
BLAKE2b-256 013c4ffb3cd1337cd15ee20a6a337250a1a368dda63d49729765f770729d0209

See more details on using hashes here.

Provenance

The following attestation bundles were made for mpdsp-0.9.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish.yml on stillwater-sc/mp-dsp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mpdsp-0.9.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: mpdsp-0.9.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mpdsp-0.9.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ba121f9c0457ab74e923bc298034f8b2b119f46eb2311bc1da8a324a9bf1fc67
MD5 e8e7f4f2d436d58a898c417015729cb3
BLAKE2b-256 b21255a5e2fbd581ffbba1b9bd4984ac08492d1f2f2f51d2bc468c3cb7070461

See more details on using hashes here.

Provenance

The following attestation bundles were made for mpdsp-0.9.0-cp39-cp39-win_amd64.whl:

Publisher: publish.yml on stillwater-sc/mp-dsp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mpdsp-0.9.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mpdsp-0.9.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e52d498c35744a56726c2a3091d1de8920bb0a386bd1d725ebd0d54626c4b442
MD5 7b3ad0d2e01f08185854cb662865adc3
BLAKE2b-256 ce66e83c9633a28fbb242d06df578dae1a09afcee9086c3a03de6056c3923817

See more details on using hashes here.

Provenance

The following attestation bundles were made for mpdsp-0.9.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: publish.yml on stillwater-sc/mp-dsp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mpdsp-0.9.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

  • Download URL: mpdsp-0.9.0-cp39-cp39-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.9, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mpdsp-0.9.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 94fd389d6ffe80a01fac4c0caafc3f2fbbaf12eb8044e94688981c3183d5f849
MD5 0bca142e67be23fe40dc52c1322784b7
BLAKE2b-256 729095a528d3c86c103bf779bc6ef76b0a20d5b782c975bb05a174074f6cd70e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mpdsp-0.9.0-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: publish.yml on stillwater-sc/mp-dsp-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page