Skip to content

Show per-camera progress with detection rates and gaps while scanning - #92

Draft
gunicsba wants to merge 1 commit into
TheMariday:mainfrom
gunicsba:scan-progress-display
Draft

gunicsba wants to merge 1 commit into
TheMariday:mainfrom
gunicsba:scan-progress-display

Conversation

@gunicsba

@gunicsba gunicsba commented Oct 19, 2026 •

Copy link
Copy Markdown

The scan showed one progress bar, so you couldn't tell if the camera was even seeing the LEDs until a scan was done. This replaces it with a line for the whole scan and a line for every camera:

Overall   100%|████████████████████| 200/200 LEDs [01:05<00:00]
Camera 1 detected  90%|██████████████████░░| 181/200 found, gaps: 1 too long (longest: LEDs 70-76)
Camera 2 detected  58%|████████████░░░░░░░░| 117/200 found, gaps: 12 fillable, 1 too long (longest: LEDs 95-113)

It works with one camera too (an overall line and a camera line). The per camera lines are what you need as soon as there are several cameras (see #91, multi camera), but nothing here depends on it.

What it shows

  • Detection rate per camera: how many LEDs that camera has detected out of the ones scanned so far.
  • Gaps: a run of LEDs a camera missed between two it saw. LEDs before the first or after the last detection aren't gaps, they are just outside what the camera sees. Gaps short enough for the reconstruction to interpolate (--interpolation_max_fill) are marked fillable, longer ones too long, with the longest named. When the scan ends the LEDs of every too long gap are listed.
  • A hint if a camera hasn't found any of the first 20 LEDs: is it looking at the LEDs, is the room dark, --exposure and --threshold.

How it is drawn

I first used tqdm bars, but with several lines of changing width and colour they came out in the wrong order and with leftover text when the scan finished (in a Windows terminal). So the lines are redrawn by a small ScanDisplay class: the whole block is redrawn in place, each line is cut to the width of the window (a wrapped line would break the cursor movement), and messages are printed above the block. Block characters are only used when the terminal can show them. When the output isn't a terminal (a log, a pipe) it only writes the final state, with no colour or cursor codes.

Testing

Tests cover the gap logic (leading and trailing misses, fillable against too long), the line for each camera in a scan with several cameras, the hint, the final report and the redrawing (in place, message above, trimmed width, no terminal, no block characters). flake8 is clean and the existing tests pass. I also ran it in a real terminal during real multi camera scans and it looks right.

This touches scanner.py and the README in the same places as two other pull requests, #91 (multi camera) and #93 (--capture_only). They're independent but whichever lands second needs a small rebase. All three merged together pass all 74 tests.

🤖 Generated with Claude Code

The scan used to show a single progress bar. It now shows a line for the whole scan and a
line for every camera: how many leds that camera has detected out of those scanned (with a
bar and a percentage), and where it has gaps. A gap is a run of leds a camera missed
between two it saw. Gaps short enough for the reconstruction to interpolate
(--interpolation_max_fill) are marked fillable, longer ones too long with the longest one
named, and the leds of every too-long gap are listed when the scan ends.

A camera that has found none of the first 20 leds gets a hint about what to check (is it
looking at the leds, is the room dark, --exposure and --threshold).

The lines are redrawn in place on a terminal, cut to the width of the window, with block
characters only where the terminal can show them. When the output isn't a terminal (a log
or a pipe) only the final state is written.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant