Signal Processing

Overview

Introduction Signal processing is the discipline of representing, transforming, and extracting information from measured data that varies in time, space, or another independent variable. In practice, this includes everything from cleaning noisy sensor streams to isolating machine faults in vibration signals, estimating communication channel quality, and reconstructing events from sparse measurements. The core idea is that a measured signal contains a mixture of useful structure (trend, periodic content, transients) and unwanted content (noise, drift, interference), and that mathematically grounded transforms and filters can separate those components in a controlled way.

From a mathematical perspective, signal processing combines linear systems, stochastic modeling, and numerical methods. Typical workflows treat a sampled signal x[n] as the output of a physical process plus noise, then apply operations such as convolution, decimation, spectral estimation, or wavelet decomposition to answer engineering questions. The field is foundational to controls, audio, communications, biomedical devices, predictive maintenance, and finance. A useful general reference is the Signal processing article on Wikipedia, while implementation details for most functions in this category come primarily from SciPy Signal, SciPy ndimage, and NumPy FFT.

In Boardflare, this category is organized around four jobs: filtering, resampling, spectral analysis, and wavelets. Filtering tools such as BUTTER, CHEBY1, CHEBY2, ELLIP, FIRWIN, REMEZ, FILTFILT, and SOSFILTFILT support deterministic control over passbands and stopbands. Smoothers like GAUSSIAN_FILTER1D, MEDFILT, and SAVGOL_FILTER target denoising and shape preservation. Utility functions such as GET_WINDOW, FREQZ, and IIRDESIGN help specify and verify filter behavior. Resampling tools DECIMATE, RESAMPLE, RESAMPLE_POLY, and UPFIRDN handle sample-rate conversion while controlling aliasing. Spectral tools like RFFT, RFFTFREQ, ENG_PERIODOGRAM, ENG_WELCH, CSD, COHERENCE, STFT, ISTFT, SPECTROGRAM, and LOMBSCARGLE quantify frequency-domain and time-frequency behavior. Wavelet tools DAUB, QMF, CASCADE, CWT, MORLET2, RICKER, THRESHOLD, and WAVEDEC support multiscale analysis and sparse denoising.

When to Use It Signal processing is most valuable when a business or engineering decision depends on information hidden by noise, resolution limits, or mixed frequency content. Teams often start with raw time-series data and quickly discover that straightforward averages or static thresholds miss the dynamics that matter. These tools are best used when the objective is not just to visualize a waveform, but to produce stable, explainable metrics or reconstructions that can drive operational actions.

One common scenario is predictive maintenance for rotating equipment (motors, pumps, turbines, compressors). Raw vibration channels are often contaminated by broadband noise and harmonics from neighboring machinery. A practical pipeline may begin with MEDFILT to suppress impulse spikes, then apply a designed bandpass using IIRDESIGN with implementation through SOSFILTFILT for stable zero-phase conditioning. Engineers verify passband behavior with FREQZ, then estimate energy by band using ENG_WELCH or ENG_PERIODOGRAM. If they need to compare two sensors (for shaft alignment or transfer path diagnosis), CSD and COHERENCE quantify shared frequency content and coupling strength. For transient fault signatures (bearing defects, blade strikes), SPECTROGRAM or STFT reveals event timing, while WAVEDEC plus THRESHOLD can denoise without overly blurring sharp impacts.

Another frequent scenario is measurement-system integration, where multiple devices record at different sample rates. A controls team might have force data at 10 kHz, displacement at 2 kHz, and temperature at 10 Hz. Before model fitting, rates must be aligned. RESAMPLE_POLY is typically preferred for rational rate conversion because polyphase filtering gives strong alias control with good efficiency; UPFIRDN gives lower-level control when the team wants to tune filter taps directly. DECIMATE is practical for integer downsampling with anti-alias filtering built in. RESAMPLE (FFT method) is useful for periodic-like records or fixed-length transforms, but teams should validate endpoint behavior for non-periodic signals. In communications and test automation, these same methods support anti-aliasing before archival compression, reducing storage while preserving decision-relevant bandwidth.

A third high-impact scenario is biomedical or human-signal analytics (ECG, EMG, respiration, motion). These streams are nonstationary and often include baseline drift, motion artifacts, and intermittent events. SAVGOL_FILTER can smooth while retaining local morphology, useful for derivative-based peak features; GAUSSIAN_FILTER1D provides controlled low-pass smoothing for continuous channels. Frequency tracking via RFFT and RFFTFREQ supports fast feature extraction, while LOMBSCARGLE is important when sampling is irregular due to dropped packets or variable acquisition cadence. For event localization across scales, CWT with MORLET2 or RICKER can isolate bursts better than fixed-window FFT methods. If reconstruction in the original domain is required after time-frequency manipulation, ISTFT is the corresponding inverse operation for STFT.

Across these examples, the “job to be done” is consistent: reduce uncertainty in signals so that downstream decisions (maintenance schedules, quality alarms, controller tuning, or health scoring) are more reliable. Signal processing is appropriate when traceability matters, because many methods are parameterized and physically interpretable rather than black-box.

How It Works Most functions in this category implement linear operators or statistically consistent estimators. At the center is convolution. A discrete-time filter with impulse response h[n] transforms input x[n] into output y[n]:

y[n] = (h * x)[n] = \sum_{k=-\infty}^{\infty} h[k]x[n-k].

In frequency space, convolution becomes multiplication:

Y(e^{j\omega}) = H(e^{j\omega})X(e^{j\omega}).

This is why filter design tools matter: they define H(e^{j\omega}) to pass desired bands and attenuate unwanted ones. IIR families BUTTER, CHEBY1, CHEBY2, and ELLIP trade off transition sharpness, ripple, and order. Butterworth is maximally flat in passband; Chebyshev Type I allows passband ripple for steeper transitions; Type II allows stopband ripple; elliptic allows ripple in both bands for the most aggressive transition width at a given order. IIRDESIGN is specification-driven: you provide passband/stopband edges and ripple targets, and it solves for a realizable design.

FIR methods FIRWIN and REMEZ instead build finite impulse responses. FIR filters can guarantee linear phase (constant group delay), which preserves waveform shape in applications like audio and pulse analysis. FIRWIN uses windowed sinc concepts and depends on a chosen window from GET_WINDOW, while REMEZ solves a minimax optimization to reduce worst-case approximation error in specified bands.

For implementation, numerical stability and phase behavior are critical. Forward-only filtering introduces phase lag; forward-backward application with FILTFILT cancels phase distortion by filtering in both directions. For higher-order IIR designs, SOSFILTFILT is often more stable because second-order sections reduce coefficient sensitivity and overflow risk. FREQZ evaluates the designed filter response before deployment, which is essential for verifying gain at key frequencies and checking whether design specs were actually achieved.

Denoising filters address different noise models. MEDFILT is nonlinear and robust to salt-and-pepper spikes. GAUSSIAN_FILTER1D assumes smoothness and suppresses high-frequency noise through a Gaussian kernel. SAVGOL_FILTER performs local polynomial regression, which often preserves peaks and derivatives better than moving averages. The right choice depends on whether the signal of interest is impulsive, smooth, or shape-sensitive.

Resampling is governed by sampling theory. If a signal is sampled at rate f_s, frequencies above f_s/2 alias into lower frequencies. Proper downsampling requires anti-alias filtering before decimation:

x_\downarrow[m] = x[mM], \quad \text{after low-pass filtering with cutoff } \leq \frac{\pi}{M}.

DECIMATE packages this pattern for integer factors. RESAMPLE_POLY performs rational conversion by upsampling, FIR filtering, and downsampling efficiently via polyphase decomposition, which is often the best practical default for high-quality sample-rate conversion. UPFIRDN exposes the same primitive as a building block. RESAMPLE uses FFT-domain interpolation/truncation and can be highly effective, but assumptions about periodic extension can influence edge behavior.

Spectral methods estimate how signal power is distributed over frequency. The discrete Fourier transform is

X[k] = \sum_{n=0}^{N-1} x[n]e^{-j2\pi kn/N},

and RFFT computes the one-sided transform for real-valued signals, with bin mapping from RFFTFREQ. A naive periodogram has high variance; ENG_PERIODOGRAM is direct but noisy. ENG_WELCH reduces variance by averaging windowed, overlapped segments:

\hat{S}_{xx}(f)=\frac{1}{K}\sum_{i=1}^{K} \frac{1}{U} |\mathcal{F}\{w[n]x_i[n]\}|^2.

CSD estimates cross power spectral density S_{xy}(f), and COHERENCE normalizes it to a 0–1 coupling measure:

C_{xy}(f)=\frac{|S_{xy}(f)|^2}{S_{xx}(f)S_{yy}(f)}.

Time-frequency methods handle nonstationarity. STFT applies FFT over sliding windows to produce localized spectra; SPECTROGRAM is a commonly visualized STFT power representation. ISTFT reconstructs time-domain signals when windowing and overlap constraints are met. LOMBSCARGLE extends spectral estimation to uneven sampling by fitting sinusoidal components without requiring uniform intervals, which is crucial for astronomy, telemetry dropouts, or event-driven logs.

Wavelet methods complement FFT methods by using localized basis functions that dilate and translate. CWT analyzes a signal across continuous scales, with wavelet choices like MORLET2 (complex oscillatory) and RICKER (Mexican hat) emphasizing different feature types. Discrete wavelet decomposition via WAVEDEC splits signals into approximation and detail bands recursively, enabling multiresolution denoising and compression. Supporting functions DAUB, QMF, and CASCADE define and analyze wavelet/scaling filter structures, while THRESHOLD applies shrinkage to coefficients for noise suppression.

From an implementation viewpoint, assumptions matter: stationarity for some PSD estimators, linearity for filter interpretation, sufficient sampling density for faithful reconstruction, and correct boundary handling for finite records. Boardflare’s wrappers are most effective when users make those assumptions explicit and validate outputs (e.g., by checking residuals, coherence, and reconstruction error).

Practical Example Consider a manufacturing team monitoring a high-speed pump with two accelerometers and one current sensor. Their objective is to detect early bearing wear and discriminate it from process-related load variation. They collect 60-second windows each hour, but one sensor occasionally drops samples due to network jitter.

Step 1 is signal conditioning. They remove impulsive spikes from each accelerometer channel with MEDFILT, then smooth high-frequency measurement noise using SAVGOL_FILTER to preserve local peak structure used by peak-to-peak health features. To isolate bearing-related energy, they design a bandpass: either direct topology choice via BUTTER or full spec-driven design via IIRDESIGN. They inspect magnitude response with FREQZ, implement in second-order sections, and apply SOSFILTFILT so timing of impacts is not shifted.

Step 2 is sample-rate alignment. The current sensor is lower rate than vibration channels. They convert all channels to a common analysis grid using RESAMPLE_POLY. For an archived lower-resolution trend store, they produce a decimated stream with DECIMATE, maintaining anti-alias protection. In one subsystem where custom interpolation is needed in an FPGA emulation workflow, they prototype with UPFIRDN.

Step 3 is frequency-domain diagnostics. On each hourly segment, they compute PSD with ENG_WELCH, then track integrated power in defect-related bands. They also compute ENG_PERIODOGRAM for quick fine-resolution checks on selected windows. To understand coupling between motor current and vibration, they compute CSD and COHERENCE: high coherence near rotating frequency suggests process-linked excitation; low coherence with growing vibration sidebands suggests mechanical deterioration.

Step 4 is transient localization. As fault signatures evolve, stationary PSD features alone are insufficient. The team uses SPECTROGRAM and STFT to identify when sidebands intensify during operation cycles. For reconstruction after selective suppression of narrowband interference, they use ISTFT.

Step 5 is multiscale denoising and anomaly scoring. They run WAVEDEC, apply coefficient THRESHOLD, and reconstruct denoised components for robust impulsiveness metrics. During algorithm development they compare wavelet families using DAUB and QMF, and inspect generated scaling/wavelet functions with CASCADE. For transient pattern matching, they test CWT with MORLET2 and RICKER.

Step 6 is governance and rollout. They baseline metrics for healthy operation and set alert thresholds based on historical percentiles and maintenance outcomes. Because each metric comes from interpretable transforms, maintenance and reliability teams can audit why an alert fired: increased Welch bandpower, reduced coherence consistency, and rising wavelet detail energy. Compared with ad hoc Excel smoothing and static thresholds, this workflow is more reproducible, better at separating causes, and easier to maintain as equipment or operating regimes change.

How to Choose The fastest way to select the right calculator is to begin with your primary question: “Do I need to clean the signal, change its sample rate, measure frequency content, or detect multiscale transients?” The matrix below maps that question to the most appropriate functions and key tradeoffs.

Goal Use these tools Best for Watch-outs
Design smooth IIR filters with monotonic passband BUTTER General low/high/band filtering with predictable response Higher order can be numerically sensitive unless implemented as SOS
Steeper transitions with passband ripple allowance CHEBY1 Tighter transition than Butterworth at same order Passband ripple may affect amplitude-sensitive features
Steeper transitions with stopband ripple allowance CHEBY2 Strong stopband attenuation with monotonic passband Stopband ripple may matter in strict rejection use-cases
Most aggressive IIR transition for a given order ELLIP Compact designs when both ripple types are acceptable Ripple in both bands; careful spec tuning required
Spec-driven IIR synthesis IIRDESIGN Automated design from engineering requirements Incorrect edge specs lead to misleading designs
Zero-phase application of direct-form filters FILTFILT Offline denoising when phase delay must be removed Not causal for real-time control loops
Zero-phase application with robust numerical stability SOSFILTFILT Higher-order IIR in production pipelines Requires SOS representation and boundary awareness
Window-based FIR design FIRWIN, GET_WINDOW Linear-phase filtering and intuitive window control Transition width may require long filters
Minimax-optimal FIR design REMEZ Tight error bounds across specified bands Setup is more technical than simple window methods
Verify frequency response before deployment FREQZ QA of gain, cutoff, and attenuation Misread normalized frequencies can cause design mistakes
Remove impulse outliers MEDFILT Spike-heavy noise environments Can flatten narrow genuine features
Smooth while preserving local polynomial shape SAVGOL_FILTER Peak/derivative-sensitive preprocessing Window/order choices can overfit or oversmooth
Gaussian low-pass smoothing GAUSSIAN_FILTER1D Continuous-noise suppression Blurs sharp transients if sigma is too large
Integer downsampling with anti-aliasing DECIMATE Simple, robust rate reduction Choose factors/cutoffs aligned with target bandwidth
Arbitrary-length FFT-domain resampling RESAMPLE Convenient fixed-length transforms and periodic signals Endpoint artifacts possible on non-periodic records
Rational sample-rate conversion (recommended default) RESAMPLE_POLY High-quality, efficient multirate processing Need sensible filter settings for extreme ratios
Low-level multirate primitive UPFIRDN Custom DSP pipelines and architecture control More parameters to tune correctly
One-sided FFT of real signals RFFT, RFFTFREQ Fast spectral features and harmonic detection Leakage/window effects still apply
Direct PSD estimate ENG_PERIODOGRAM Quick spectrum snapshots Higher variance than Welch
Averaged PSD estimate ENG_WELCH Stable PSD for trend monitoring Segment/window choices affect resolution
Cross-spectrum between channels CSD Transfer-path and coupling studies Interpretation requires synchronized channels
Normalized coupling metric COHERENCE Detect shared dynamics between sensors High coherence does not prove causality
Time-frequency decomposition STFT, SPECTROGRAM Nonstationary events and evolving harmonics Time-frequency resolution tradeoff is unavoidable
Reconstruct after STFT-domain processing ISTFT Denoising/masking workflows requiring time-domain output Must respect overlap/window constraints
Period detection with uneven sampling LOMBSCARGLE Irregular telemetry and missing timestamps Frequency grid choice influences detectability
Build wavelet basis coefficients DAUB, QMF, CASCADE Custom wavelet analysis and educational verification Conceptually deeper than standard filtering tools
Continuous wavelet analysis CWT, MORLET2, RICKER Localized transient/scale analysis Scale-to-frequency interpretation requires care
Multilevel discrete wavelet decomposition and denoising WAVEDEC, THRESHOLD Sparse denoising and multiresolution features Threshold strategy strongly affects bias/variance

graph TD
    A[Start with analysis goal] --> B{Need to clean noise?}
    B -- Yes --> C{Noise type?}
    C -- Spikes --> C1[Use MEDFILT]
    C -- Smooth broadband --> C2[Use GAUSSIAN_FILTER1D or SAVGOL_FILTER]
    C -- Band-limited target --> C3[Design with BUTTER/CHEBY1/CHEBY2/ELLIP/IIRDESIGN]
    C3 --> C4[Validate with FREQZ]
    C4 --> C5[Apply with FILTFILT or SOSFILTFILT]
    B -- No --> D{Need sample-rate conversion?}
    D -- Yes --> D1[Use RESAMPLE_POLY as default]
    D -- Integer downsample --> D2[Use DECIMATE]
    D -- Custom multirate chain --> D3[Use UPFIRDN]
    D -- FFT-style length change --> D4[Use RESAMPLE]
    D -- No --> E{Need spectral metrics?}
    E -- Yes --> E1[RFFT/RFFTFREQ, ENG_WELCH, ENG_PERIODOGRAM]
    E1 --> E2[CSD/COHERENCE for multi-sensor coupling]
    E -- Nonstationary --> E3[STFT/SPECTROGRAM, then ISTFT if reconstruction needed]
    E -- Uneven sampling --> E4[LOMBSCARGLE]
    E -- Multiscale transients --> F[CWT or WAVEDEC + THRESHOLD]
    F --> F1[MORLET2/RICKER or DAUB/QMF/CASCADE support]

In practice, teams often combine methods: resample first, design and verify filters second, compute spectral indicators third, and add wavelet features for robustness to transients. This layered approach balances interpretability and detection power while keeping the workflow close to physical intuition.

Filtering

Tool Description
BUTTER Butterworth digital and analog filter design.
CHEBY1 Chebyshev Type I digital and analog filter design (passband ripple).
CHEBY2 Chebyshev Type II digital and analog filter design (stopband ripple).
ELLIP Elliptic (Cauer) digital and analog filter design.
FILTFILT Apply a digital filter forward and backward to a signal for zero phase distortion.
FIRWIN FIR filter design using the window method.
FREQZ Compute the frequency response of a digital filter.
GAUSSIAN_FILTER1D 1-D Gaussian filter for signal denoising and smoothing.
GET_WINDOW Generate a window function vector for signal processing.
IIRDESIGN Complete IIR digital and analog filter design from passband and stopband specs.
MEDFILT Perform a median filter on a signal array to remove spike noise.
REMEZ Calculate the minimax optimal filter using the Remez exchange algorithm.
SAVGOL_FILTER Apply a Savitzky-Golay filter to a signal array for smoothing.
SOSFILTFILT Forward-backward digital filter using cascaded second-order sections.

Resampling

Tool Description
DECIMATE Downsample the signal after applying an anti-aliasing filter.
RESAMPLE Resample x to num samples using Fourier method.
RESAMPLE_POLY Resample x along the matrix using polyphase filtering.
UPFIRDN Upsample, FIR filter, and downsample.

Spectral Analysis

Tool Description
COHERENCE Estimate the magnitude squared coherence (Cxy) using Welch’s method.
CSD Estimate the cross power spectral density (Pxy) using Welch’s method.
ENG_PERIODOGRAM Estimate power spectral density using a periodogram.
ENG_WELCH Estimate power spectral density using Welch’s method.
ISTFT Perform the Inverse Short-Time Fourier Transform (ISTFT).
LOMBSCARGLE Estimate a Lomb-Scargle periodogram for unevenly sampled data.
RFFT Compute the one-dimensional discrete Fourier transform for real input.
RFFTFREQ Return sample frequencies for one-sided real FFT bins.
SPECTROGRAM Compute a spectrogram with consecutive Fourier transforms.
STFT Compute the Short Time Fourier Transform (STFT).

Wavelets

Tool Description
CASCADE Compute scaling and wavelet functions at dyadic points from filter coefficients.
CWT Perform a Continuous Wavelet Transform (CWT).
DAUB Get coefficients for the low-pass filter producing Daubechies wavelets.
MORLET2 Generate a complex Morlet wavelet for a given length and width.
QMF Return a Quadrature Mirror Filter (QMF) from low-pass coefficients.
RICKER Return a Ricker wavelet (Mexican hat wavelet).
THRESHOLD Apply elementwise wavelet thresholding to numeric data.
WAVEDEC Compute a multilevel one-dimensional discrete wavelet decomposition.