v0.28.0 - Enhanced erfc Fitting and Sigma Band Visualization (2026-06-28)¶
What Changed?¶
This release improves the threshold analysis workflow with a more accurate 4-parameter erfc fitting model and richer visualizations.
fit_thresholds.py now fits amplitude × erfc((x − μ) / (σ√2)) + background, and plot_thresholds.py displays sigma-level colored bands, fit range boundary lines, and aligned label colors.
What's New¶
Main Feature: 4-Parameter erfc Fitting¶
What it does:
Adds amplitude and background parameters to the erfc fitting function, enabling a more accurate model for detector threshold response curves where the detection efficiency does not saturate at exactly 1.0 or drop to exactly 0.0.
New model:
Parameters:
| Parameter | Meaning | Default bounds |
|---|---|---|
mu |
Threshold center | [x.min(), x.max()] |
sigma |
Width | [0, ∞) |
amplitude |
Saturation level | [0, 1.0] |
background |
Noise floor | [0, 0.5] |
Code example:
def complementary_error_function(x, mu, sigma, amplitude, background):
return amplitude * erfc((x - mu) / (sigma * np.sqrt(2))) + background
Main Feature: Sigma Band Visualization in plot_thresholds.py¶
What it does: Adds colored sigma-level bands, fit range boundary lines, and aligned label colors to threshold plots for easier visual inspection.
Sigma bands:
| Band | Color |
|---|---|
| 0σ – 1σ | Green |
| 1σ – 3σ | Orange |
| 3σ – 5σ | Purple |
| 5σ – 10σ | Brown |
Legend: Measured data / Fitted curve (erfc) / Fit range / 1 sigma / 3 sigma / 5 sigma / 10 sigma
How to use it:
# Fit threshold data
uv run examples/fit_thresholds.py ./measurements --save
# Plot with sigma bands
uv run examples/plot_thresholds.py ./measurements --save
Installation¶
Quick Start¶
What's Different from the Last Version?¶
✅ Added¶
fit_thresholds.py:amplitudeandbackgroundparameters to erfc fitting functionfit_thresholds.py:10sigmalevel in sigma_levels outputfit_thresholds.py: Amplitude and BG columns in display tableplot_thresholds.py:SIGMA_BANDSmodule-level constant for colored band definitionsplot_thresholds.py: Colored sigma bands (0σ–1σ, 1σ–3σ, 3σ–5σ, 5σ–10σ)plot_thresholds.py: Fit range boundary lines (gray dotted axvlines)plot_thresholds.py: Sigma label colors aligned with legend band colors
🔧 Changed¶
plot_thresholds.py: Stats text box now shows amplitude (A) and background (BG)plot_thresholds.py: Refactored for improved readability with simplified loop structure
Is It Safe to Upgrade?¶
Backward Compatible: Yes
- Existing
thresholds_fitted.jsonfiles from v0.27.0 will display with defaultamplitude=0.5andbackground=0.0if those fields are absent - No CLI option changes; workflow is unchanged
Tests Passed¶
- ✅ Builds without errors
- ✅
uv run fit_thresholds.py ./measurements --saveproduces JSON with amplitude and background fields - ✅
uv run plot_thresholds.py ./measurements --savegenerates plots with sigma bands
Release Details¶
- Date: 2026-06-28
- Version: v0.28.0
- Files Changed: 2 (
fit_thresholds.py,plot_thresholds.py)
Next Steps¶
- Per-channel threshold range specification in
fit_thresholds.py - Interactive threshold scan monitoring