Skip to content

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:

f(x) = amplitude × erfc((x − μ) / (σ√2)) + background

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

# Get the release
git checkout 0.28.0

# Setup
task env:setup

# Run CLI
uv run kazunoko --help

What's Different from the Last Version?

✅ Added

  • fit_thresholds.py: amplitude and background parameters to erfc fitting function
  • fit_thresholds.py: 10sigma level in sigma_levels output
  • fit_thresholds.py: Amplitude and BG columns in display table
  • plot_thresholds.py: SIGMA_BANDS module-level constant for colored band definitions
  • plot_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.json files from v0.27.0 will display with default amplitude=0.5 and background=0.0 if those fields are absent
  • No CLI option changes; workflow is unchanged

Tests Passed

  • ✅ Builds without errors
  • uv run fit_thresholds.py ./measurements --save produces JSON with amplitude and background fields
  • uv run plot_thresholds.py ./measurements --save generates 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