Skip to content

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_MASK constant (value: 1000) in constants.py for centralized management of threshold filtering
  • fit_thresholds.py now filters data to only include threshold values less than THRESHOLD_MASK
  • get_thresholds.py uses THRESHOLD_MASK for 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_MASK constant in constants.py for centralized threshold filtering management
  • Threshold value filtering in fit_thresholds.py to exclude data above 1000 ADC units
  • Verbose logging showing event counts before and after threshold filtering in analysis scripts

🔧 Changed

  • get_thresholds.py now imports and uses THRESHOLD_MASK constant instead of hardcoded values
  • fit_thresholds.py now imports and uses THRESHOLD_MASK constant 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.py and fit_thresholds.py functionality 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:
  • 5aab6b7 refactor: extract THRESHOLD_MASK constant from examples
  • 0d574f5 feat: add threshold < 1000 query filter in fit_thresholds.py
  • 90a073e bump: 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