|
| 1 | +--- |
| 2 | +name: analysis-graphing |
| 3 | +description: "RenoDX workflow for creating readable analysis graphs and plots from shader math, CSVs, EXRs, LUTs, hue sweeps, tone curves, gamut comparisons, energy/scalar maps, and test-pattern statistics. Use when graphing, plotting, visualizing, comparing curves, making dark-theme matplotlib figures, or avoiding repeated one-off plot scripts." |
| 4 | +argument-hint: "data source, variables to compare, output path, units/axis scale, and whether the graph is scratch or durable" |
| 5 | +--- |
| 6 | + |
| 7 | +# RenoDX Analysis Graphing |
| 8 | + |
| 9 | +Use this small skill for **plots and graphs**. Larger skills should call this out instead of embedding graphing rules. |
| 10 | + |
| 11 | +## Boundaries |
| 12 | + |
| 13 | +- Focus on visualizing data, not generating source test images or editing shaders. |
| 14 | +- Keep one-off plots and source scripts in a scratch output path unless the graph becomes a durable analysis artifact. |
| 15 | +- Promote repeated graph workflows into `tools/analysis/` with the data export beside the image. |
| 16 | +- Prefer `matplotlib` for Python analysis unless an existing script in the same workflow already uses another plotting library. |
| 17 | +- Use `bt2020-png-generation` for final HDR PQ PNG writing and signaling. |
| 18 | +- Use `hdr-test-pattern-generation` for ramps, sweeps, charts, and synthetic image inputs. |
| 19 | + |
| 20 | +## Default style |
| 21 | + |
| 22 | +- Use a dark theme by default: `plt.style.use("dark_background")`. |
| 23 | +- Save readable static images: usually PNG at `dpi=150` to `180`. |
| 24 | +- Choose figure sizes for labels first, not minimum pixels; common overview plots are `14x9`, `16x11`, or `17x11` inches. |
| 25 | +- Close figures after saving to avoid leaking state in batch scripts. |
| 26 | +- If the graph will be inspected in an issue or PR, prefer a single self-contained overview image plus any focused split images. |
| 27 | + |
| 28 | +## Plot checklist |
| 29 | + |
| 30 | +For every generated graph, make the output self-describing: |
| 31 | + |
| 32 | +- Title states the experiment and transform/version being compared. |
| 33 | +- Axes include units: nits, linear RGB, PQ code value, hue degrees, stops, frame index, etc. |
| 34 | +- Legends use stable method names matching CSV column names or shader function names. |
| 35 | +- Include reference lines for anchors such as zero, diffuse white, mid-gray, `1.0`, peak nits, or gamut boundary when relevant. |
| 36 | +- Do not normalize silently. If data is normalized, show the normalization factor in the title, label, or CSV. |
| 37 | +- Use log/stops axes only when the labels make the scale obvious. |
| 38 | +- Save the plotted source data as CSV when values are generated rather than loaded from an existing CSV. |
| 39 | + |
| 40 | +## Common RenoDX graph types |
| 41 | + |
| 42 | +| Graph type | Use for | Notes | |
| 43 | +|---|---|---| |
| 44 | +| Tone/inverse diagnostic curve | Vanilla vs RenoDRT/PsychoV/ACES matching | Mark diffuse white, mid-gray, peak, and shoulder anchors; inverse plots are for fitting/diagnosis, not final-frame inverse-tonemap strategy. | |
| 45 | +| Gain/loss or delta plot | Comparing old/new math or fitted curves | Plot absolute output and error/delta, not only one. | |
| 46 | +| Hue sweep | Gamut compression, hue preservation, negative-channel checks | Hue degrees on x-axis; include min/max channel or perceptual metric. | |
| 47 | +| Gamut scatter / chip grid | BT.709, BT.2020, AP1/AP0 comparisons | State source gamut and adaptation path. | |
| 48 | +| LUT/stat overview | LUT pair comparisons, channel summaries, error histograms | Keep CSV summaries beside the graph. | |
| 49 | +| Image diagnostic panel | EXR/test-pattern before/after comparisons | Use fixed scales when comparing panels. | |
| 50 | + |
| 51 | +## Existing examples |
| 52 | + |
| 53 | +- [Dark plot template](./templates/dark_plot.py) for a minimal reusable matplotlib setup. |
| 54 | +- `tools/analysis/plot_cp2077_*` for readable dark-theme multi-panel graphs. |
| 55 | +- `tools/analysis/validate_mb_compress.py` for hue sweep validation and CSV-plus-plot output. |
| 56 | +- scratch `zelda_*` curve and derivative plots. |
| 57 | + |
| 58 | +## Common mistakes to avoid |
| 59 | + |
| 60 | +- Do not output light-theme graphs unless the user explicitly requests that style. |
| 61 | +- Do not crop legends, tick labels, or colorbars; use `tight_layout()` or explicit layout spacing. |
| 62 | +- Do not mix scene-linear, display-linear nits, and encoded PQ values on one axis without clear labels. |
| 63 | +- Do not present a graph without preserving the script or source CSV needed to reproduce it. |
| 64 | +- Do not keep copying a repeated plotting scaffold across scratch scripts; promote the pattern when it recurs. |
0 commit comments