Detect firmware event-buffer truncation and plot count rate, not raw sums - #17
Merged
Merged
Conversation
…sums
The AIRDOS03 firmware caps above-threshold events at MAX_EVENTS per
interval; anything past that is silently dropped while the true count
(evCount in $STOP) keeps growing. Nothing surfaced this to the user.
Separately, since the firmware can now flush early when that buffer
fills (see the corresponding AIRDOS03 firmware change), interval length
is no longer fixed, making raw per-record totals hard to compare.
- Warn (file parser and live UART thread) whenever a $STOP's evCount
exceeds the number of $E lines actually received, i.e. the firmware's
per-interval event buffer was exceeded and the spectrum above
THRESHOLD is undercounted for that interval.
- Parse captStart/stopSystime from $START/$STOP and derive each
record's real duration: prefer the delta between consecutive
GNSS-synced timestamps (or host wall-clock in the live case), falling
back to the raw TCNT1 tick pair (128 µs/tick) when no absolute time is
available yet. Persisted through save_as()/NpzLogParser so reopened
sessions keep it.
- Evolution plot now shows counts/sec ("Count rate", cps) whenever a
duration is known, since a shortened (early-flushed) interval and a
full one are no longer directly comparable as raw sums. Falls back to
the previous "Total count per exposition" raw-count display for
sources with no duration info (older logs/NPZ archives).
Verified against the existing test suite plus manual smoke tests
(synthetic multi-run logs exercising GNSS-diff, tick-fallback and
NPZ round-trip paths); no display-side (PyQt) smoke test since this
environment has no display, only offscreen import/construction checks.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to UniversalScientificTechnologies/AIRDOS03#15 (the "spectrum doesn't connect at channel 64" report) and its fix, UniversalScientificTechnologies/AIRDOS03#16.
Summary
$STOP'sevCountexceeds the number of$Elines actually received — i.e. the firmware's per-interval event buffer was exceeded and the spectrum above THRESHOLD is undercounted for that interval.captStart/stopSystimefrom$START/$STOPand derive each record's real duration: prefer the delta between consecutive GNSS-synced timestamps (or host wall-clock in the live case), falling back to the raw TCNT1 tick pair (128 µs/tick) when no absolute time is available yet. Persisted throughsave_as()/NpzLogParserso reopened sessions keep it.Test plan
pytest tests/passes (8/8).QT_QPA_PLATFORM=offscreen) construction/plot smoke test forPlotCanvas, both with and without duration data, confirming correct axis label and counts/sec values.