Repository navigation
feat: arithmetic of signals, and sources relative to the first - #16
Merged
Merged
Conversation
A signal can be computed from others and from numbers: +, -, * and / with the
usual precedence and parentheses, and deriv(), abs() and norm() of an
expression. Since "/" also separates the nodes of a path, a division has spaces
around it ("a / b"); a "/" right after a path, with no space, is the path's.
- Two signals are combined on the times and the grid of the first: the second
is interpolated in time for traces, and taken at its closest time slice
(within its time range, a single one only at its time) and interpolated on
the grid of the first for profiles and maps. A time trace applies to profiles
and maps at their times (a profile over its central value); a static profile
or map times a time trace depends on time. Profiles against different
coordinates cannot be combined.
- Signals with wildcards combine member by member, by name (those both have),
in order when all are renamed, or each member with the same signal.
- deriv() is d/dt for traces and d/dx for profiles, in the order of x.
- The result is labeled with the expression, with units that follow: those of
a difference, none for a ratio of like quantities, a/b, a.b, per second.
- A data source evaluates an expression from its cached signals, and caches the
result; what a source does not have is still a note, not an error.
Alternatives can be expressions. Plain paths parse as before.
A panel can show every source but the first relative to the first, signal by
signal: its difference (B − A) or its ratio (B / A), with the same arithmetic.
It is `relative:` in the configuration, "sources" in the setup dialog, and a
"Sources" menu of the panel (undoable). The first source is then not drawn and
the legend says what is compared ("[B − A]"); the scale still applies to a
difference but not the offset, and a ratio has neither. Shapes are drawn as
they are, and a single source is shown as it is.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp
Main now has the crosshair (#14) and the device template (#15). The crosshair reads the curves a panel draws, so with sources relative to the first it gives B − A or B / A; a test checks it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp
icyspirit
pushed a commit
that referenced
this pull request
Sep 29, 2026
Main now has the arithmetic of signals and the sources relative to the first (#16). The conflicts were side by side: imports, helpers of the panel, and tests appended at the same place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp
icyspirit
pushed a commit
that referenced
this pull request
Sep 29, 2026
With the arithmetic of signals (#16) on main, values on the cells of an unstructured grid can now be computed with: - numbers and abs(), cell by cell; - values on the same cells (the same points and cells, e.g. two runs of an edge code), at the closest slice of the second within its time range, and NaN for a slice on another grid; grids of different cells are an error; - a time trace, at the time of each slice, and a static grid at the times of a trace. deriv() and other maps or profiles are refused with an error. A panel showing sources relative to the first thus gives B − A or B / A of such values, where it failed with an AttributeError. Its line-style legend now counts these values as an image, as it does maps, so the boundaries over them are named after their sources (A, B), not "B − A". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp
4 tasks done
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.
Summary
Arithmetic of signals. A signal can be computed from other signals and from numbers:
+,-,*and/, with the usual precedence and parentheses;deriv(x): d/dt for time traces, d/dx for profiles (in the order of x);abs(x), andnorm(x), which now also takes an expression./also separates the nodes of a path, so a division has spaces around it (a / b). A/right after a path, with no space, belongs to the path. Plain paths parse as before, includingnorm(),transpose(), Fortran indices,[-1]and odd spacing.a/banda.bfor other quotients and products;derivof a trace.a - b | c) can be expressions.Sources relative to the first. A panel can show every source but the first relative to the first, signal by signal:
relative: differenceshows B − A, andrelative: ratioshows B / A, using the same arithmetic.[B − A]). The y and colorbar titles sayΔ …or… ratio.Docs: the README (signal paths, panel comparison, configuration keys), the path tooltip in the setup dialog, and the module documentation.
Notes
idscope.data.expressions) sits on top ofSignalPath:parse_alternativesreturnsSignalPaths for plain paths, as before, andExpressions otherwise.Expressionstands wherever a path does (text,label,name,canonical()).DataSource.signalevaluates it.transpose()must still take a path: it reorders dimensions before the data is extracted.Test plan
QT_QPA_PLATFORM=offscreen pytest: 228 passed in the dev environment, a clean PySide6 6.11 environment and a PyQt5 5.15 environment, after merging main. The clean installs were rebuilt without a stalebuild/directory.norm(),transpose(), Fortran indices and spaces;a/bvsa / b;[-1]is not a subtraction;transposeof an expression,**, a bare IDS name, a number alone;normof an expression, different coordinates), maps, members, shapes refused, and what a source does not have (note, and fallback to the next alternative);relative_to;Ip (equilibrium) [B − A] = -0.2);pyflakes src testsreports nothing.🤖 Generated with Claude Code
https://claude.ai/code/session_018aVekYzCRLPE71Mm6UH8Zp
Generated by Claude Code