Skip to content

v0.2.2 - Threshold Data Processing Refactoring (2025-12-21)

What Changed?

This release refactors the threshold data processing in fit_thresholds.py to use a data-driven approach. The script now automatically detects threshold step sizes from measurement data instead of relying on pre-calculated expected ranges. This improves robustness and simplifies the CLI by removing unnecessary parameters.


What's New

Main Change: Data-Driven Threshold Range Detection

What it does: The threshold fitting script now automatically detects the step size and range from measurement data instead of using pre-calculated expected ranges. This means the script works correctly regardless of how the original measurement was configured.

How to use it: No changes to the CLI usage. Simply run the script as before:

uv run fit_thresholds.py "1:300;2:320;3:310" ./measurements
uv run fit_thresholds.py "1:300;2:320;3:310" ./measurements --verbose
uv run fit_thresholds.py "1:300;2:320;3:310" ./measurements --save

What changed internally:

  • Removed --nsteps and --step-size command-line options
  • Removed _calculate_threshold_range() function
  • Unified all data processing to use pandas DataFrame operations
  • Step size is now detected from actual measurement gaps using np.diff()

Installation

Quick Start

# Get the release
git checkout v0.2.2

# Setup
uv sync

# Run the threshold fitting script
uv run examples/fit_thresholds.py "1:300;2:320;3:310" ./measurements

What's Different from the Last Version?

✅ Added

  • Automatic threshold step size detection from measurement data
  • Unified pandas DataFrame-based data processing

🔧 Changed

  • process_threshold_data() now automatically detects ranges instead of using pre-calculated expected ranges
  • Removed dependency on --nsteps and --step-size parameters
  • CLI is simpler with fewer options to configure

🐛 Fixed

  • Threshold range calculation is now more robust and data-driven
  • Eliminated potential mismatch between expected and actual measurement ranges

Is It Safe to Upgrade?

Backward Compatible: Mostly - CLI behavior unchanged for most users

  • The CLI interface is simpler: removed --nsteps and --step-size options
  • Scripts using the old CLI with these options will need to be updated (they're no longer supported)
  • Python API is unaffected: process_threshold_data() now has a simpler signature
  • Measurement results are identical or more accurate due to data-driven detection

Tests Passed

  • ✅ Builds without errors
  • ✅ Lint checks pass (ruff, mypy)
  • ✅ Pre-commit hooks pass (commitizen)

Release Details

  • Date: 2025-12-21
  • Version: v0.2.2
  • Files Changed: 1 (examples/fit_thresholds.py)
  • Commits:
  • 3d4d00e - refactor: unify threshold data processing with pandas DataFrame operations
  • 6d0ac24 - refactor: use data-driven approach for threshold range calculation
  • ba21ee5 - refactor: remove unused nsteps and step_size parameters (YAGNI)

Next Steps

Future improvements could include:

  • Add visualization of fitted curves with matplotlib
  • Support multiple fitting algorithms (e.g., sigmoid, logistic function)
  • Add statistical tests for goodness-of-fit
  • Optimize performance for large datasets with parallel processing