v0.2.0 - Threshold Management Improvements (2025-12-21)¶
What Changed?¶
This release introduces centralized threshold filtering and improved data analysis for multi-channel detector systems. Both get_thresholds.py and fit_thresholds.py now use a unified THRESHOLD_MASK constant for consistent threshold filtering. The examples have been refactored to support filtering data where threshold values are less than 1000 ADC units, improving data quality in threshold measurement workflows.
What's New¶
Main Features: Threshold Filtering and Constants Management¶
What it does:
- Introduces
THRESHOLD_MASKconstant (value: 1000) inconstants.pyfor centralized management of threshold filtering fit_thresholds.pynow filters data to only include threshold values less thanTHRESHOLD_MASKget_thresholds.pyusesTHRESHOLD_MASKfor masking channels not being scanned during sequential threshold sweeps- Verbose output shows filtered event counts before and after filtering in analysis
How to use it:
Both scripts automatically use the THRESHOLD_MASK constant. Users can modify the threshold filtering behavior by editing the constant in src/kazunoko/constants.py.
Code example:
from kazunoko.constants import THRESHOLD_MASK
# In fit_thresholds.py: Filter data for curve fitting
df_filtered = df.query(f"threshold1 < {THRESHOLD_MASK}")
# In get_thresholds.py: Mask values for unused channels
masked = {1: THRESHOLD_MASK, 2: THRESHOLD_MASK, 3: THRESHOLD_MASK}
Installation¶
Quick Start¶
# Get the release
git checkout v0.2.0
# Setup
task env:setup
# Run threshold measurement
uv run get_thresholds.py "1:300;2:320;3:310" 100 1 --nsteps 10 --step-size 1
# Fit threshold data
uv run fit_thresholds.py "1:300;2:320;3:310" ./measurements
What's Different from the Last Version?¶
✅ Added¶
THRESHOLD_MASKconstant inconstants.pyfor centralized threshold filtering management- Threshold value filtering in
fit_thresholds.pyto exclude data above 1000 ADC units - Verbose logging showing event counts before and after threshold filtering in analysis scripts
🔧 Changed¶
get_thresholds.pynow imports and usesTHRESHOLD_MASKconstant instead of hardcoded valuesfit_thresholds.pynow imports and usesTHRESHOLD_MASKconstant instead of hardcoded values- Example scripts refactored for improved maintainability and consistency
Is It Safe to Upgrade?¶
Backward Compatible: Yes
- All changes are additive and refactoring-based
- Existing
get_thresholds.pyandfit_thresholds.pyfunctionality is preserved - Only the internal implementation changed to use centralized constants
- No breaking changes to APIs or command-line interfaces
Tests Passed¶
- ✅ Builds without errors
- ✅ Code passes ruff linting
- ✅ Code passes mypy type checking
- ✅ Example scripts execute without errors
Release Details¶
- Date: 2025-12-21
- Version: v0.2.0
- Files Changed: 3 (constants.py, get_thresholds.py, fit_thresholds.py)
- Commits:
5aab6b7refactor: extract THRESHOLD_MASK constant from examples0d574f5feat: add threshold < 1000 query filter in fit_thresholds.py90a073ebump: version 0.1.62 → 0.2.0
Next Steps¶
Future improvements could include:
- Additional filtering options for threshold data (e.g., by hit count, by date range)
- Configuration file support for threshold analysis parameters
- Integration of filtering options into CLI commands
- Performance optimization for large-scale threshold measurement datasets