Fix the error band, and let a caller read back whether it is drawn - #7
Merged
Conversation
set_show_error had no counterpart, so a caller could ask for the band but not find out whether it got one. It reads back the resolved value rather than the request: asking for a band with statistics switched off resolves to off, and a caller persisting the request would restore a setting that never took effect.
Ticking Mean +/- SD raised ValueError on every rendered frame. _map_y maps
amplitudes into per-channel cells, so it wants n_ch rows; the band is the lower
and upper edges stacked, 2 x n_ch, and the per-channel terms could not broadcast
against it. _curve_positions now maps each per-channel block on its own.
It surfaced as a warning that says nothing about any of this:
UserWarning: Could not resolve argspec of Figure animation function ...
calling it without arguments.
fastplotlib wraps both the argspec check and the call to the animation function
in one try, catching ValueError and TypeError. An exception from inside our
callback is therefore reported as a problem introspecting it, and the callback
is then called a second time. Nothing about the message suggests our code, and
nothing about it suggests the band.
The tests did not catch it because make_widget stubbed _map_y with the identity,
which is precisely the collaborator whose contract the band violated -- and one
of the tests asserts the band has 2 x n_ch rows, the exact shape that breaks it.
They now build the real _map_y, and two tests that read raw amplitudes off drawn
y values compare through the mapping instead. Three fail with the fix reverted.
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.
Two small things on top of v0.9.0, found by driving the trace grid against live
hardware.
The band raised on every frame
Turning on
show_errormade_curve_positionspass the band -- the lower andupper edges stacked,
2 x n_chrows -- to_map_y, which maps amplitudes intoper-channel cells and so expects
n_ch:Each per-channel block is now mapped on its own.
It surfaced as a warning that points nowhere near it:
fastplotlib wraps both the argspec check and the call to an animation function
in one
try, catchingValueErrorandTypeError. An exception raised insidethe callback is therefore reported as a failure to introspect it, and the
callback is called a second time.
getfullargspecon the lambda works fine --the message is simply misleading about its own cause, which is worth knowing for
anyone else who sees it.
The tests could not have caught it
make_widgetstubbed_map_ywith the identity -- precisely the collaboratorwhose contract the band violated. One of those tests asserts the band has
2 x n_chrows: the exact shape that raises, checked against a stub thatcannot. The tests now build the real
_map_y, and the two that read rawamplitudes off drawn y values compare through the mapping instead. Three fail
with the fix reverted.
show_errorcan be read backset_show_errorhad no counterpart, so a caller could ask for the band but notfind out whether it got one. It reports the resolved value rather than the
request: asking for a band with statistics switched off resolves to off, and a
caller persisting the request would restore a setting that never took effect.
127 tests.
🤖 Generated with Claude Code