What is a "peak-finding algorithm"?

How does a computer find the most accurate peak in a jumbled waveform?

In fiber Bragg grating (FBG) sensing demodulation and spectral analysis systems, the Peak-Finding Algorithm is the core digital signal processing (DSP) technology used by interrogators to process discrete spectral data and extract the Bragg center reflection wavelength (\lambda_B).

Due to hardware sampling rate and spectrometer pixel resolution limitations, the acquired discrete spectral points are often noisy, exhibit baseline drift, and undergo shape distortion. Instead of simply finding the single data point with the maximum value, computers achieve high-precision peak localization through a three-step process: filtering and denoising, coarse peak identification, and sub-sampling point fitting:


1. Signal Preprocessing and Denoising (Refining the Signal)

Actual acquired spectra often contain noise from photodetectors (thermal noise, shot noise) and baseline drift caused by fluctuations in light source power. The algorithm first preprocesses the raw discrete data:

  • Dynamic Thresholding (Threshold Filter): A reflection intensity threshold is set to eliminate background light and low-amplitude noise floor below the threshold, retaining only the effective regions where grating reflection peaks might exist.
  • Digital Filtering and Smoothing (Smoothing Filter): Moving Average filtering or Savitzky-Golay Convolution Smoothing Filter is employed. The Savitzky-Golay filter can remove high-frequency noise while maximally preserving the peak width, height, and symmetry of the reflection, thus avoiding broadening distortion at the peak.

2. Coarse Localization (Identifying Candidate Peak Regions)

On the smoothed spectral curve, the computer uses mathematical criteria to locate the coarse region of the peak:

  • Derivative Criterion: The first-order difference (approximate first derivative) and second-order difference of the spectral sequence are calculated. When the first derivative changes from positive to negative and crosses zero (\frac{dI}{d\lambda} = 0), and the second derivative is less than zero (\frac{d^2I}{d\lambda^2} < 0), the extremum point is identified as a candidate reflection peak.

3. Sub-sampling Fine Fitting (Sub-pixel / Sub-grid Peak Detection)

If the maximum discrete sample point from coarse localization were directly used as the wavelength, the system resolution would be entirely limited by the hardware sampling interval (e.g., if the sampling step is 10\ \text{pm}, the error would be on the order of 10\ \text{pm}). To achieve high resolutions of 1\ \text{pm} or 0.1\ \text{pm}, the computer uses mathematical models to fit the continuous data points around the peak:

(1) Centroid Algorithm

Calculates the weighted average center using the spectral energy distribution within the effective range of the reflection peak:

\lambda_c = \frac{\sum_{i=1}^{N} \lambda_i \cdot I_i}{\sum_{i=1}^{N} I_i}

Where \lambda_i is the sampling wavelength and I_i is the reflection intensity at that wavelength. The centroid method is computationally very fast and stable against noise, making it suitable for high-frequency dynamic demodulation.

(2) Polynomial / Parabolic Fitting

Selects the coarse peak point and its symmetric neighboring critical points (e.g., 3 \sim 5 points) to establish a quadratic parabolic equation:

I(\lambda) = a\lambda^2 + b\lambda + c

The theoretical extremum wavelength can be directly derived analytically using the extremum condition via differentiation:

\lambda_{peak} = -\frac{b}{2a}

This method is simple to compute and effectively overcomes the limitations of discrete sampling grids.

(3) Gaussian Curve Fitting

The theoretical line shape of the reflection spectrum of a standard uniformly distributed Bragg fiber grating closely matches a Gaussian distribution:

I(\lambda) = I_0 \exp\left( -\frac{(\lambda - \lambda_B)^2}{2\sigma^2} \right)

By taking the logarithm of the light intensity to linearize it for least-squares fitting, or by using the Levenberg-Marquardt nonlinear iterative algorithm. Gaussian fitting offers extremely high wavelength reconstruction accuracy and resistance to asymmetric noise, making it one of the standard algorithms for achieving sub-picometer ( ext{Sub-picometer}) wavelength resolution.


Synergistic Application of Hardware and Algorithms

In practical engineering, the aforementioned algorithms are typically embedded and run in the DSP/FPGA or host software of the demodulation system. For example, when used with the OFSCN® Fiber Bragg Grating Interrogator, the interrogator acquires the reflection spectrum in the range of 1525 \sim 1565\ \text{nm} through its high-precision spectral acquisition front-end. Combined with the built-in peak-finding and fitting algorithms, the standard system achieves a stable wavelength resolution of 1\ \text{pm} or 0.1\ \text{pm}.