Skip to content

monitor_thresholds.py

Purpose: Real-time TUI monitoring of threshold scan results

Use case: Inspecting threshold scan progress, visualizing hit count vs threshold curves per channel

Features:

  • Watches a directory for a threshold scan summary file (default: thresholds_scanned.jsonl)
  • Reads all existing content on startup (pre-existing records are shown immediately)
  • Scatter plots (threshold vs hit count) for each of the 3 channels
  • Configurable axis ranges for focused viewing
  • Keyboard shortcuts: q to quit, r to reset data

Usage:

# Basic usage
uv run examples/monitor_thresholds.py ./2026-03-20/

# Set x-axis range
uv run examples/monitor_thresholds.py ./2026-03-20/ --xmin 280 --xmax 320

# Set y-axis maximum
uv run examples/monitor_thresholds.py ./2026-03-20/ --ymax 100

# Watch a custom summary file
uv run examples/monitor_thresholds.py ./2026-03-20/ --pattern my_scan.jsonl

CLI Options:

Option Default Description
READ_FROM (required) Directory to monitor
--pattern thresholds_scanned.jsonl Filename of the threshold scan summary file
--xmin auto Minimum threshold value for x-axis
--xmax auto Maximum threshold value for x-axis
--ymax auto Maximum hit count for y-axis
--poll-interval 1.0 Polling interval in seconds for file change detection
--log-level error Log level (debug/info/error)