evidence
List the runs of a paper that kept evidence, what two runs of one experiment differ in, how one value moved across all of them, write the newest run's numbers for the manuscript to print, tabulate or plot chosen values across every run, or find the numbers the text copied by hand and link them to the run.
Invocation#
lem-cli evidence <id-or-title> [--diff <experiment>] [--series <experiment> --file <file> --path <path> [--table <out> [--figure <out.tex>]]] [--values <experiment> --file <file> --out <values.tex>] [--matrix <experiment> --file <file> --places <pattern> [--out <table.tex>] [--plot <figure.tex>]] [--unlinked | --link]Inputs and options#
- id-or-title is required and uses the shared exact-id or title-substring lookup.
- --diff <experiment> names an experiment the paper's experiment.json declares and compares what its two newest runs kept.
- --series <experiment> follows one value across every run of that experiment; --file names the kept file as --diff names it (the run's own id written <run>), and --path the value's place in it, as --diff names places. --table <out> also writes the series to the file out, and --figure <out.tex>, given with --table, a pgfplots figure drawing that table. --series takes no --diff, and --path and --table come only with it.
- --values <experiment> writes the numbers the newest run of that experiment kept in the file --file names (named as --diff names it) to the file --out names. It takes no --diff, --series, --path, --table or --figure, and --out comes only with it or --matrix.
- --matrix <experiment> writes to --out a LaTeX table, and to --plot a pgfplots figure, of the places of the kept file --file names that --places matches, as --diff names places with `*` standing for one key between dots (`claims.*.status`), across every run of that experiment; at least one of --out and --plot is named. The figure draws a line through the runs for each place whose value is a number in some run, with the place as its legend entry; a pattern whose places hold no number is `lem.compute.evidence.plot-numberless`. --matrix takes no --diff, --series, --values, --path, --table or --figure, and --places and --plot come only with it.
- --unlinked and --link each take no other option and read every experiment's newest run against the whole manuscript.
Output and state#
Without --diff, prints the paper's compute jobs that kept evidence in its checkout, newest first: the job, its experiment and status, when it was submitted, the folder, and each kept file with the ignore rule that keeps Git from tracking it, when one does. A paper none of whose runs kept evidence lists none and says so.
With --matrix, every run of the experiment that kept evidence is a column, oldest first and numbered from the first, and every matched place a row, sorted; a string is shown without its quotes, and a value a run's file does not hold (or a run that kept no such file, or not as JSON) is a dash rather than a column left out. The `tabular` opens with a comment naming the command and the last run it shows, and has no style of its own; `\\input` it in a table environment, and `figures --redraw` writes it again once a newer run is kept. The answer lists `runs` (job and `created_at`), `rows` (each place and its value per run, null where absent), and `out` and `plot`, the files written. `POST /papers/<id>/compute/jobs/<job>/matrix` with `{file, places, out, plot}` (`plot` optional) writes the same for the job's experiment, both paths inside the paper's source folder (`lem.compute.evidence.matrix-outside`, 400, otherwise, before the job is looked up), and Lem Desktop's queue inspector sends it as Tabulate every run into the paper under each compared file, with an optional figure file, and shows the table below as a grid.
With --diff, reads every JSON file both runs kept and names each value by its place in the file (keys joined by a dot, an array's place as [n]). `changes` lists each value whose JSON text differs, with `before` and `after` (one absent when only one run's file holds the value); `unchanged` counts the rest. The run's own id in a file's path is written <run>, so the same file of two runs is one file. A file only one run kept, one that is not JSON and one that is no longer where it was kept are named under `uncompared` with why. Nothing is judged and nothing is left out for being noisy: a duration that differs on every run is listed beside the claim whose status changed.
With --series, prints `points`, one per run oldest first, each with its `job`, `created_at` and `value` as JSON text; a run that kept no such file, whose file is not JSON or is gone, or whose file holds no value at the path has no value and says why under `missing`, so a gap in a figure is one a reader can see. --table writes a header line `run submitted value` and one line for each run whose value is a number (the run counted from the first, its submission instant, the value), which pgfplots draws with `\\addplot table [x=run, y=value] {out}`; the answer names the table it wrote.
--figure writes a `tikzpicture` with one pgfplots axis, the run on x and the value on y, labelled with the experiment and the value's place, that reads the table by the path --table was given, as the paper's LaTeX reads it: `\\input` it in a figure environment and run the series again after each run to redraw. Nothing in it is sized or styled; the paper's own pgfplots settings apply. The answer names it under `figure`.
With --values, only the newest run of the experiment that kept evidence is read, and every number its file holds is written to --out as a LaTeX value: the file opens with a comment naming the command and the run, defines `\\lemvalue{<experiment>}{<place>}` (`\\providecommand`, so several such files can be read by one manuscript), and holds one `\\csname` definition per number, its place as --diff names it. `\\input` the file in the preamble and write `\\lemvalue{validation}{margin}` where the text gives that number; a place the file does not define stops LaTeX with a `lem` package error rather than printing nothing. Writing the file again after the next run updates every number the text prints. A value that is not a number, and a place holding a character other than letters, digits, `.`, `_`, `-`, `[` and `]`, are listed under `skipped` with why; `values` lists what was written, `job` and `created_at` the run.
With --unlinked, the newest run of each experiment that kept evidence is read (`runs` names it), and every number with a decimal point the manuscript and the files it includes write outside comments is set against the numbers those runs kept in their JSON files: `numbers` lists each one that a kept value prints as, rounded to the digits it shows (one written as a percentage, `87.3\\%`, as the value times a hundred), with its `source`, its `line`, the number as `written` and the `places` (experiment, file, place and value) it matches. A number that is part of a word or a control sequence, a version such as 1.2.3 and a length such as 0.5cm or 0.8\\textwidth are not read, nor are the files Lem writes itself (values files and drawn figures). Write the file with --values and print the number with `\\lemvalue` so the next run updates it; `\\lemvalue` prints the run's own number unrounded, and LaTeX's `\\fpeval` rounds or scales it where the text shows fewer digits or a percentage (`\\fpeval{round(100*\\lemvalue{validation}{accuracy}, 1)}\\%`). Nothing is changed by --unlinked. A number that equals a kept value by chance is listed too: the list is what to look at, not a judgement. `GET /papers/<id>/evidence/unlinked` answers the same, and Lem Desktop's Figures panel lists each such number under Drawn by with no figure selected.
With --link, each number --unlinked finds is written in its place as its `replacement`, the LaTeX that prints it from the run: `\\lemvalue{<experiment>}{<place>}` when the run's value is written so, else `\\fpeval{round(…, <digits>)}` around it, scaled and followed by `\\%` for a percentage, so the text shows the digits it showed (`\\fpeval` needs a LaTeX kernel from 2022 on, or the xfp package). A number several values match, one whose experiment's kept file has no current values file the manuscript includes (write it with --values and `\\input` it first), and one its line no longer holds where it was found are left as they were, each under `left` with why; `linked` lists those written. `POST /papers/<id>/evidence/link` does the same, and Lem Desktop's Figures panel offers it as Link these numbers to the runs under Drawn by, once one number matches a single value.
The job records are read from the compute store on this machine, so no backend has to run. `GET /papers/<id>/compute/jobs/<job>/comparison` answers the same comparison for one job and the run of its experiment before it, and Lem Desktop's queue inspector shows it under a job's kept evidence. `GET /papers/<id>/compute/jobs/<job>/series?file=<file>&path=<path>` answers the series of the job's experiment, and the inspector's Every run beside a changed value draws it as a line through the runs. `POST` to the same path with `{file, path, table, figure}` writes the table and the figure at those paths inside the paper's source folder, the figure reading the table by that path, and answers the series with both; the inspector's Draw into the paper sends it.
Refusals#
- --diff with no experiment after it is a wrong invocation: “--diff names the experiment whose two newest runs are compared, and no name follows it”, exit 2, before the registry is read. --series without --file and --path, any of them without its value, --path or --table without --series, --file without --series, --values or --matrix, --figure without --table, and --series with --diff are `lem.compute.evidence.series-incomplete`, exit 2, also before the registry is read. --values without --file and --out, --out without --values or --matrix, and --values with --diff, --series, --path, --table or --figure are `lem.compute.evidence.values-incomplete`, exit 2, before the registry is read. --matrix without --file and --places or without either of --out and --plot, any of them without its value, --places or --plot without --matrix, and --matrix with --diff, --series, --values, --path, --table or --figure are `lem.compute.evidence.matrix-incomplete`, exit 2, before the registry is read; a pattern no place of any run's file matches, or no run that kept evidence, is `matrix-unmatched`, listing the places the runs hold, a figure whose places hold no number is `plot-numberless`, and a table or figure that cannot be written is `series-unwritten` naming it the table or figure of runs. --unlinked or --link with any other option, or with each other, is `lem.compute.evidence.unlinked-alone`, exit 2, before the registry is read. With --link, a source that cannot be written is `link-unwritten`, the sources written before it staying written.
- With --values, a paper none of whose runs of the experiment kept evidence is `lem.compute.evidence.values-unrun`; a newest run that kept no such file, or not as JSON, is `values-unkept`, naming the run, rather than an older run's numbers being written as current; a file that cannot be written where --out names it is `values-unwritten`, with the state of it and of its folder. `POST /papers/<id>/compute/jobs/<job>/values` with `{file, out}` writes the same for the job's experiment, and Lem Desktop's queue inspector sends it as Write its numbers into the paper under each compared file; an `out` that is absolute or climbs out of the paper's source folder, or a paper with no local sources, is `lem.compute.evidence.values-outside` (400), before the job is looked up.
- A table or figure that cannot be written where it is named is `lem.compute.evidence.series-unwritten`, naming which, the file and the state of it and of its folder. Over `POST`, a table or figure path that is absolute or climbs out of the paper's source folder, or a paper with no local sources, is `lem.compute.evidence.series-outside` (400), before the job is looked up.
- An empty or unmatched paper selector refuses as it does for every paper command.
- A kept file that stands there and cannot be read refuses naming the file and the job (`lem.compute.evidence.evidence-unreadable`). With fewer than two runs the answer lists the runs there are and compares nothing; that is not a refusal.