Building the figures¶
The six paper figures are Python modules, one per figure, under
specsrbench.figures. There are no notebooks.
specsrbench figures all # all six
specsrbench figures 4 # by paper figure number
specsrbench figures mae # or by name
specsrbench figures all --outdir /tmp/check # somewhere other than figures/
# |
name |
what it shows |
output |
|---|---|---|---|
1 |
|
every method on a 1D toy where the truth is known |
|
2 |
|
one held-out galaxy, all methods, [O III] inset |
|
3 |
|
residual maps over all 572 spectra against redshift |
|
4 |
|
global fidelity: MAE, uncertainty-normalised, RMSE |
|
5 |
|
per-line S/N, detection, false detection, width bias |
|
6 |
|
error against redshift, in equal-count bins |
|
Each prints the numbers the paper quotes from it, so a figure that is wrong is usually visible in its own output before anyone looks at the PDF.
From Python¶
from specsrbench import figures
path = figures.build("mae", outdir="/tmp")
Every figure module exposes build(cache=None, outdir=None) -> Path. Some take
more: figure 2 accepts i_show to draw a different galaxy, and figure 1 takes
deterministic=True and device=.
Several also expose the computation separately from the drawing, which is what the tests check:
from specsrbench.data import load_cache
from specsrbench.figures.fig5_per_line_snr import compute
rows = compute(load_cache())
rows["fdr"]["SR2"] # false-detection rate per line
Where the data comes from¶
The figures read a cache of derived arrays — by default a cache_logR_tuned/
directory found by walking up from the working directory. Point somewhere else
with:
export SPECSRBENCH_CACHE=/path/to/cache_logR_tuned
If you have no cache, Rebuilding the cache explains how to make one.
Reproducibility¶
Five of the six figures are deterministic and were verified to render pixel-identical to the published PDFs.
Figure 1 is the exception and always was. It trains a small 1D CNN inline to
make its learned panel, and cuDNN reduces convolutions in a non-deterministic
order, so that panel moves in the third or fourth decimal between runs — RMSE
0.0143 against 0.0144 when it was checked. No conclusion moves; the CNN wins
every metric on that toy by a wide margin. Pass deterministic=True to trade
some speed for a fixed result.
Warning
Rebuilding overwrites figures/*.pdf. The content is deterministic but the PDF
metadata is not, so a rebuild shows up as a diff even when nothing changed.
Use --outdir when you only want to check.