xpectra.weathering
Band-ratio weathering indicators (carbonyl index) and composition tables.
Two important caveats, both demonstrated in the study:
spectral_moments normalization centers intensities around zero, so raw integrated band areas can be negative and a naive band ratio is unstable. carbonyl_index therefore per-spectrum min-max renormalizes to a positive [0, 1] scale before integrating, and floors the denominator.
The carbonyl index conflates weathering with intrinsic polymer chemistry (pristine PET/PMMA have strong native C=O bands), so it is only a valid oxidation marker within a single polyolefin class (PE/PP). On this heterogeneous, multi-instrument dataset it does not cleanly separate environmental from pristine spectra — which is itself a finding: hand-crafted physical indices are unreliable across instruments, motivating data-driven OOD detection instead.
Functions
|
Integrated area (or peak height) of a wavenumber window. |
|
C=O band relative to the CH2-scissoring reference band. |
|
Class fractions among the unknowns, with and without abstentions. |
|
Spearman correlations of carbonyl index vs confidence and OOD scores. |
- xpectra.weathering.band_area(X, wavenumbers, lo, hi, mode='area', subtract_local_baseline=True)[source]
Integrated area (or peak height) of a wavenumber window.
With subtract_local_baseline, a straight line between the window’s endpoints is removed first — the usual convention for band indices.
- xpectra.weathering.carbonyl_index(X, wavenumbers, carbonyl=(1650.0, 1800.0), ref=(1420.0, 1470.0), mode='area', renormalize=True)[source]
C=O band relative to the CH2-scissoring reference band.
The default bands match
TrustConfig.carbonyl_band/reference_bandso every call site uses one band definition unless overridden explicitly.With renormalize=True (default), each spectrum is min-max scaled to [0, 1] first so the band areas are non-negative and the ratio is stable on moments-normalized data. See module docstring for the within-class caveat.