fix: persistence is the trace's own phosphor, not a density behind a stroke
The plotter now deposits every acquisition -- the newest included -- into one grid per trace and
draws no solid trace over it, each grid in that trace's colour and with a one-sweep ceiling (its own
commit, **1b8b55d**). This side needed almost no change of its own, because the colour was already
the trace's and the trace's colour is `RowSet::signal_color()` -- the invariants' one route -- but the
figures it reads back are now per trace:
- **The ceiling is left at the library's default of one sweep**, no longer derived from the fade.
Deriving it from the steady state is the gain offset the user reported between the latest
acquisition and the persistent image; a signal crossing the same place every acquisition now settles
at the trace's colour, at full strength, and the newest sweep reads as the trace it is a picture of.
- **`cells`/`grid_bytes` are the sum over the row's traces** -- one grid each, a trace with no series
holding none -- and both the probe and the exit dump carry `traces=` beside `rows=`. That is what
makes the per-signal memory figure read: **556 537 cells and 2.2 MB per signal**, at 8904600 bytes
over the four one-signal rows of the probe's run.
The probes, re-read on this build (the `verification.md` command, `--rate 500000 --batch 1000`):
[density-probe] off enabled=0 ... rows=0 traces=0 cells=0 ink=0.0 peak=0.0000
[density-probe] on enabled=1 ... rows=4 traces=4 cells=2226150 ink=226786.0 peak=1.0000
[density-probe] step-acquisitions ... peak=1.5000
[density-probe] time-before ... peak=2.1359
[density-probe] step-time ... ratio=0.367879
[density-probe] frame cost: tick 0.62 -> 6.96 ms (184/23 frames), draw 2.02 -> 6.16 ms (177/18)
[udpscope] density: frames=748 rows=4 traces=4 cells=2226150 grid_bytes=8904600 ink=489400.2 peak=2.2 upload_bytes=2226150
`on` `peak=1.0000`, `step-acquisitions` `peak=1.5000` and `step-time` `ratio=0.367879` are the legs
that were expected, unchanged; the *draw* mean is now **below** the run before the split (2.02 -> 6.16
against 2.09 -> 20.91), because the solid traces are no longer drawn over the image.
Docs updated with it: the trigger manual page (`persistence` is the trace, one image per signal, the
newest included), the README's persistence section, `invariants-trigger-and-pinning.md` (five rules,
the ceiling and the no-stroke rule among them), `verification.md` and `probe-readings.md` (the lines
above), the trigger panel's comment and tooltips, and the plotter submodule.
`cmake --build build --clean-first -j4`: **0 errors, the documented three warnings** (two
`MathNode::source`, one `-Woverlength-strings` at 12352); `make -C build test-ui` **13 ok**;
`make -C build test-help` **green** (15 pages); the self-check **0 `Gtk-WARNING`/`Gtk-CRITICAL`** and
`gtk warnings: 0`, two `buffer allocated:` lines.
This commit is contained in:
1 parent
5e32199597
commit
da826f2cb5
11 files changed
+181
-130
No files matched your search
+30
-21
@@ -6102,10 +6102,12 @@ double density_probe_tau() {
|
||||
return s > 0.0 ? std::min(s, 3600.0) : 1.0;
|
||||
}
|
||||
|
||||
/// What the density holds over every row it is on: the rows, the cells, and the two numbers the
|
||||
/// plot reports. A row with the display off contributes nothing -- it has no grid at all.
|
||||
/// What the density holds over every row it is on: the rows, the traces (one grid each), the cells,
|
||||
/// and the two numbers the plot reports. A row with the display off contributes nothing -- it has no
|
||||
/// grid at all.
|
||||
struct DensityReading {
|
||||
int rows = 0;
|
||||
int traces = 0;
|
||||
unsigned long long cells = 0;
|
||||
double ink = 0.0;
|
||||
double peak = 0.0;
|
||||
@@ -6116,11 +6118,17 @@ DensityReading density_read(const App& a) {
|
||||
for (int i = 0; i < a.rows->row_count(); ++i) {
|
||||
const RowSet::Row& row = a.rows->row(i);
|
||||
if (row.plot == nullptr || !row.plot->density().enabled) continue;
|
||||
const plot::DensityGrid& g = row.plot->density_grid();
|
||||
++r.rows;
|
||||
r.cells += static_cast<unsigned long long>(g.cell_count());
|
||||
r.ink += g.ink();
|
||||
r.peak = std::max(r.peak, static_cast<double>(g.peak()));
|
||||
// **One grid per trace**, each in its trace's own colour, so the row's cells/ink are the sum
|
||||
// over its traces and the peak the brightest of them.
|
||||
for (plot::u32 t = 0; t < row.plot->trace_count(); ++t) {
|
||||
const plot::DensityGrid& g = row.plot->density_grid(t);
|
||||
if (g.cell_count() == 0u) continue; // an unbound slot holds no grid
|
||||
++r.traces;
|
||||
r.cells += static_cast<unsigned long long>(g.cell_count());
|
||||
r.ink += g.ink();
|
||||
r.peak = std::max(r.peak, static_cast<double>(g.peak()));
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -6129,12 +6137,18 @@ DensityReading density_read(const App& a) {
|
||||
/// plotter's own accumulation (its per-acquisition fade happens inside it, before the deposit), and
|
||||
/// the time step is `decay_density(tau)` -- the same call the frame tick makes with a frame's `dt`.
|
||||
double density_step(App& a, bool by_time) {
|
||||
double before = 0.0;
|
||||
for (int i = 0; i < a.rows->row_count(); ++i) {
|
||||
const RowSet::Row& row = a.rows->row(i);
|
||||
if (row.plot == nullptr || !row.plot->density().enabled) continue;
|
||||
before += row.plot->density_grid().ink();
|
||||
}
|
||||
// The ink summed over every trace's grid (one grid per trace): the same total `density_read()`
|
||||
// reports, so a step's ratio is off one reading.
|
||||
const auto ink = [&]() {
|
||||
double total = 0.0;
|
||||
for (int i = 0; i < a.rows->row_count(); ++i) {
|
||||
const RowSet::Row& row = a.rows->row(i);
|
||||
if (row.plot == nullptr || !row.plot->density().enabled) continue;
|
||||
for (plot::u32 t = 0; t < row.plot->trace_count(); ++t) total += row.plot->density_grid(t).ink();
|
||||
}
|
||||
return total;
|
||||
};
|
||||
const double before = ink();
|
||||
for (int i = 0; i < a.rows->row_count(); ++i) {
|
||||
plot::Plot* p = a.rows->row(i).plot;
|
||||
if (p == nullptr || !p->density().enabled) continue;
|
||||
@@ -6144,12 +6158,7 @@ double density_step(App& a, bool by_time) {
|
||||
p->accumulate_density();
|
||||
}
|
||||
}
|
||||
double after = 0.0;
|
||||
for (int i = 0; i < a.rows->row_count(); ++i) {
|
||||
const RowSet::Row& row = a.rows->row(i);
|
||||
if (row.plot == nullptr || !row.plot->density().enabled) continue;
|
||||
after += row.plot->density_grid().ink();
|
||||
}
|
||||
const double after = ink();
|
||||
return before > 0.0 ? after / before : 0.0;
|
||||
}
|
||||
|
||||
@@ -6180,11 +6189,11 @@ void density_probe_report(App& a, const char* what, double ratio) {
|
||||
tc = a.model->trigger();
|
||||
}
|
||||
std::fprintf(stderr,
|
||||
"[density-probe] %s enabled=%d fade=%s tau=%.3f factor=%.3f rows=%d cells=%llu "
|
||||
"ink=%.1f peak=%.4f ratio=%.6f\n",
|
||||
"[density-probe] %s enabled=%d fade=%s tau=%.3f factor=%.3f rows=%d traces=%d "
|
||||
"cells=%llu ink=%.1f peak=%.4f ratio=%.6f\n",
|
||||
what, tc.density ? 1 : 0,
|
||||
tc.density_decay == PersistDecay::Time ? "time" : "acquisitions", tc.density_tau_s,
|
||||
tc.density_factor, r.rows, r.cells, r.ink, r.peak, ratio);
|
||||
tc.density_factor, r.rows, r.traces, r.cells, r.ink, r.peak, ratio);
|
||||
std::fflush(stderr);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user