MultiGaussFit is a desktop GUI application for interactive signal preprocessing and multi-Gaussian deconvolution. Built with Python and Tkinter, it is designed for spectroscopists, analytical chemists, and researchers who need to decompose complex overlapping peaks into individual Gaussian components. It provides a complete workflow from raw data loading through noise filtering, baseline correction, peak fitting, and batch export of results.
- CSV Data Loading: Supports both XYYY and XYXY column structures with automatic header detection.
- Interactive Plot: Real-time visualization with zoom, pan, and click-to-select functionality powered by Matplotlib.
- Signal Preprocessing:
- Linear baseline correction
- Minimum shift (translate signal so min = 0)
- Negative value removal
- Savitzky-Golay smoothing filter (configurable window and polynomial order)
- Fourier Transform noise filter (configurable number of frequencies)
- Full Undo and Reset support for all preprocessing steps
- Multi-Gaussian Deconvolution:
- Click on the plot to define deconvolution intervals
- Fit 1 or 2 Gaussians per peak center
- Optimization via Differential Evolution (global optimizer)
- Displays individual Gaussian components, total fit, and SSE quality metric
- Batch Processing: Deconvolve the first signal manually, then automatically apply the same preprocessing pipeline and interval configuration to all remaining signals in the file.
- Real-Time Results: Peak parameters (Amplitude, Center, Width) are displayed live during batch processing.
- Export to CSV: Save preprocessed signals and deconvolution results with full peak parameters.
- Dark/Light Theme: Toggle between dark and light modes for comfortable viewing.
20260506_020400.mp4
The typical workflow in MultiGaussFit follows these steps:
Load a CSV file containing your spectral or signal data. MultiGaussFit supports two column structures:
A single shared X column (e.g. wavenumber, wavelength, time) followed by multiple Y columns, one per signal:
| Wavenumber (cm⁻¹) | Signal_A | Signal_B | Signal_C |
|---|---|---|---|
| 4000 | 0.0236 | 0.0195 | 0.0253 |
| 3998 | 0.0238 | 0.0171 | 0.0252 |
| 3996 | 0.0224 | 0.0180 | 0.0238 |
| ... | ... | ... | ... |
Alternating X–Y column pairs, where each signal has its own independent X axis:
| X_Signal_A | Signal_A | X_Signal_B | Signal_B |
|---|---|---|---|
| 4000 | 0.0236 | 4000 | 0.0195 |
| 3998 | 0.0238 | 3998 | 0.0171 |
| 3996 | 0.0224 | 3996 | 0.0180 |
| ... | ... | ... | ... |
Select the correct data structure (XYYY or XYXY) and click Load Data. The available signals will appear in the sidebar.
Click on any signal from the sidebar list to visualize it on the main plot.
Apply one or more preprocessing steps as needed:
- Baseline Correction: removes a linear baseline estimated from the signal edges.
- Savitzky-Golay Filter: smooths the curve to reduce high-frequency noise.
- Fourier Transform Filter: filters the signal in the frequency domain, keeping only the dominant frequency components.
- Shift Minimum: translates the signal so that its minimum value equals zero.
- Remove Negatives: sets any remaining negative values to zero.
Use Undo to step back one operation or Reset All to restore the original signal.
Click on the plot to mark the boundaries (start and end) of each peak region you want to deconvolve.
Choose 1 or 2 Gaussians per peak and click Run Deconvolution.
Tip: If your peaks are sharp or pointed (i.e. they end in a narrow tip rather than a smooth rounded top), try using 2 Gaussians per peak. The two-Gaussian mode can better capture the cusp-like shape of sharp signals that a single Gaussian cannot reproduce.
The fitted Gaussian components, total fit curve, and SSE quality metric are shown on the plot. Peak parameters (Amplitude, Center, Width) appear in the results panel.
Click Deconvolve All (same config) to automatically apply the same preprocessing pipeline and deconvolution intervals to every signal in the file. Results update in real time.
Click Save Results... to export preprocessed signals and deconvolution parameters to CSV files.
| File | Description |
|---|---|
{name}_preprocessed.csv |
Preprocessed signal values (Position + preprocessed Y for each signal) |
{name}_deconv.csv |
Deconvolution parameters per peak: Amplitude, Center, Width, SSE |
| Column | Description |
|---|---|
Signal |
Signal name from the original CSV |
Peak |
Peak number (1, 2, …) |
Amplitude (A) |
Total amplitude of the peak (in 2-Gaussian mode: |
Center (µ) |
Peak center position |
Width (σ) |
Peak width (standard deviation) |
SSE |
Sum of Squared Errors for the fit |
a1, a2, sigma1, sigma2
|
Individual Gaussian parameters (only in 2-Gaussian mode) |
⬇ Download MultiGaussFit_Setup.exe
The installer will:
- Install MultiGaussFit to
Program Files - Create a Start Menu shortcut
- Optionally create a Desktop shortcut
No Python installation required. Everything is bundled in the installer.
Run from Source
git clone https://github.com/1JELC1/MultiGaussFit.git
cd MultiGaussFit
conda env create -f environment.yml
conda activate multigaussfit
python MultiGaussFit.pygit clone https://github.com/1JELC1/MultiGaussFit.git
cd MultiGaussFit
pip install -r requirements.txt
python MultiGaussFit.pyRequirements: Python 3.9+
Building from Source
pyinstaller MultiGaussFit_onefile.specOutput: dist/MultiGaussFit.exe (self-contained, ~120 MB)
pyinstaller MultiGaussFit_onedir.specOutput: dist/MultiGaussFit/ directory with fast startup time.
Requires Inno Setup 6:
- Build the
onedirversion first. - Compile the installer script:
iscc installer/MultiGaussFit.iss
- Output:
dist/MultiGaussFit_Setup.exe
A sample CSV file is included in the examples/ folder:
python MultiGaussFit.py
# Then open: examples/sample_signal.csvMultiGaussFit uses Differential Evolution (scipy.optimize.differential_evolution) for global optimization of Gaussian parameters. Differential Evolution is a stochastic, population-based optimizer that explores the entire parameter space without requiring an initial guess. Unlike gradient-based methods (e.g. Levenberg-Marquardt), it does not get trapped in local minima, which makes it particularly robust when fitting overlapping or poorly resolved peaks.
Objective function: The optimizer minimizes the Sum of Squared Errors (SSE) between the observed signal and the sum of Gaussian components within each user-defined interval:
A lower SSE indicates a better fit.
Each peak is modeled as a single Gaussian function:
Where:
-
$A$ = amplitude (peak height) -
$\mu$ = center position -
$\sigma$ = standard deviation (controls the width)
This mode works well for peaks with a smooth, rounded, symmetric shape.
When a peak is sharp or pointed (i.e. it has a narrow, cusp-like tip rather than a smooth rounded maximum), a single Gaussian cannot accurately reproduce its shape. In this case, MultiGaussFit uses two Gaussians sharing the same center position
Where:
-
$\mu$ = shared center position (both Gaussians are centered at the same point) -
$A_1$ ,$A_2$ = individual amplitudes -
$\sigma_1$ ,$\sigma_2$ = individual widths (typically one narrow, one broad)
The total peak height at the center is the sum
| Step | Equation | Method |
|---|---|---|
| Baseline Correction | Estimates a linear baseline |
|
| Savitzky-Golay Filter | Polynomial fit over a sliding window | Noise filtering and smoothing method. Fits a low-degree polynomial to successive subsets of data points using least-squares regression (scipy.signal.savgol_filter). Reduces high-frequency noise while preserving peak shape and height. Configurable window size and polynomial order. |
| Fourier Transform Filter | Noise filtering and smoothing method. Transforms the signal to the frequency domain via FFT, retains only the |
|
| Minimum Shift | Translates the entire signal vertically so that its minimum value equals zero. Useful to remove any residual negative offset after baseline correction. | |
| Negative Removal | Clips any remaining negative values to zero. Ensures the signal is non-negative before deconvolution, which assumes positive-definite Gaussian components. |
Contributions, issues, and feature requests are welcome! Feel free to check the issues page if you want to report a bug or request a feature.
If you use this software in your research, please cite it using the citation metadata provided in the CITATION.cff file.
This project is licensed under the Apache License 2.0 — see the LICENSE file for details.
Publisher: JELC
