This Python script automates the processing of raw X-ray diffraction (XRD) data,
including signal smoothing, baseline correction, and optional normalization.
It reads a text file containing two columns: diffraction angle (2θ) and intensity,
and outputs two processed datasets: one smoothed file and one baseline-corrected file.
The smoothing step combines Savitzky–Golay and Gaussian filters to reduce random noise
while preserving peak shapes. The baseline is corrected using the adaptive arPLS
(asymmetric reweighted penalized least squares) algorithm
implemented in the pybaselines package.
Users can adjust parameters such as baseline smoothness (--lam), denoising strength (--sigma),
and optionally normalize intensity to a 0–100 scale (--normalize).
Baseline subtraction can also be skipped using the --no-baseline flag.
See more details in the Jupyter notebook (xrd_denoising.ipynb).