Preprocessing
This section covers spectral preprocessing techniques for NIRS data.
Overview
Preprocessing is a critical step in NIRS data analysis. NIRS4ALL provides a comprehensive set of preprocessing operators that are sklearn-compatible and can be chained in pipelines.
Comprehensive guide to available preprocessing techniques, operators, and when to use them.
Quick reference for preprocessing selection by model type.
In-depth guide with theory, advanced techniques, and multi-layer preprocessing.
Wavelength resampling and interpolation techniques.
Available Preprocessing Methods
Method |
Description |
Use Case |
|---|---|---|
SNV |
Standard Normal Variate |
Scatter correction |
MSC / EMSC |
Multiplicative Scatter Correction |
Reference-based scatter correction |
Derivatives |
Savitzky-Golay, First/Second |
Baseline removal, peak enhancement |
NorrisWilliams |
Gap derivative with segment smoothing |
Noise-robust derivatives |
WaveletDenoise |
Multi-level wavelet denoising |
Noise reduction with frequency selectivity |
OSC |
Orthogonal Signal Correction |
Remove Y-orthogonal variation |
EPO |
External Parameter Orthogonalization |
Remove external parameter influence |
Detrend |
Polynomial detrending |
Linear/quadratic baseline removal |
Baseline |
ALS, AirPLS, ArPLS, SNIP, etc. |
Advanced baseline correction |
Normalization |
Min-max, area, vector |
Scale standardization |
Smoothing |
Gaussian, moving average |
Noise reduction |
Quick Example
from nirs4all.operators.transforms import SNV, SavitzkyGolay, NorrisWilliams, WaveletDenoise
pipeline = [
SNV(), # Scatter correction
SavitzkyGolay(window_length=15, deriv=1), # First derivative
# ... rest of pipeline
]
# Or use newer transforms
pipeline = [
WaveletDenoise(wavelet='db4', level=3), # Wavelet denoising
NorrisWilliams(gap=5, segment=5, deriv=1), # Norris-Williams gap derivative
# ... rest of pipeline
]
See Also
Operator catalog: choose a job, then inspect the method - Complete operator reference
Standard Normal Variate (SNV) Transformation - Detailed SNV documentation
TransferPreprocessingSelector Cheat Sheet - Transfer learning preprocessing