Decompose.Recommend#
Recommend decomposition options based on automated peak detection.
This module is the backend for SecSaxsData.recommend_decomposition_options().
Keeping the logic here allows it to grow (multi-channel heuristics, per-sample
tuning, custom strategies) without cluttering the top-level data object.
- recommend_decomposition_options(xr_data, detect_interparticle=True, lowq_suppression_threshold=0.995, egh_overlap_threshold=1.3)#
Recommend keyword arguments for
quick_decomposition()by detecting peaks.Uses EGH peeling to identify elution components robustly. Consecutive EGH peaks whose spacing/sigma_sum ratio falls below egh_overlap_threshold are merged into a single component (the one at the tallest peak position in that cluster).
- Parameters:
xr_data (XrData) – The X-ray scattering data channel of a corrected
SecSaxsData.detect_interparticle (bool, optional) – If True (default), test for repulsive interparticle effects via the Guinier low-q suppression criterion. When detected,
ranks=[2]is added to the returned options so thatoptimize_rigorously()uses a rank-2 component model.lowq_suppression_threshold (float, optional) – The Guinier suppression ratio below which interparticle effects are flagged. Default 0.995 (requires ≥0.5 % suppression at q_min).
egh_overlap_threshold (float, optional) – EGH peak pairs with spacing/sigma_sum below this value are merged into one component. Default 1.3. Validated on SAMPLE1–4: safe window is (1.232, 1.376).
- Returns:
Keyword arguments ready to pass to
quick_decomposition():{'num_components': n, 'xr_peakpositions': peaks}when all clusters are single EGH peaks (well-separated).{'num_components': n, 'proportions': [1]*n}when any cluster was formed by merging overlapping EGH peaks.{'num_components': 2, 'proportions': [1, 1]}as a fallback when EGH peeling finds no peaks.
Additionally,
'ranks': [2, ...]is included when repulsive interparticle effects are detected via the Guinier low-q test.- Return type: