(per_parser_rows: Dict[str, List[PageRow]], viz_dir: Path)
| 258 | |
| 259 | |
| 260 | def plot_hex_pairs(per_parser_rows: Dict[str, List[PageRow]], viz_dir: Path) -> None: |
| 261 | parsers = list(per_parser_rows.keys()) |
| 262 | if len(parsers) < 2: |
| 263 | return |
| 264 | for a_idx in range(len(parsers)): |
| 265 | for b_idx in range(a_idx + 1, len(parsers)): |
| 266 | pa, pb = parsers[a_idx], parsers[b_idx] |
| 267 | xa, yb = pairwise_common_page_times(per_parser_rows[pa], per_parser_rows[pb]) |
| 268 | if xa.size == 0: |
| 269 | continue |
| 270 | plt.figure(figsize=(6.5, 6)) |
| 271 | plt.hexbin(xa, yb, gridsize=50, norm=LogNorm(), cmap="viridis") |
| 272 | plt.colorbar(label="count (log)") |
| 273 | # Add x=y diagonal line |
| 274 | lim_min = min(xa.min(), yb.min()) |
| 275 | lim_max = max(xa.max(), yb.max()) |
| 276 | plt.plot([lim_min, lim_max], [lim_min, lim_max], 'r-', linewidth=1.5, label="x=y") |
| 277 | plt.legend(loc="upper left") |
| 278 | plt.xlabel(f"Seconds/page — {pa}") |
| 279 | plt.ylabel(f"Seconds/page — {pb}") |
| 280 | plt.title(f"'{pa}' vs '{pb}' (n={xa.size})") |
| 281 | plt.grid(True, alpha=0.2) |
| 282 | out = viz_dir / f"hex_{safe_name(pa)}_vs_{safe_name(pb)}.png" |
| 283 | plt.tight_layout() |
| 284 | plt.savefig(out, dpi=150) |
| 285 | plt.close() |
| 286 | |
| 287 | |
| 288 | def plot_hex_pairs_loglog(per_parser_rows: Dict[str, List[PageRow]], viz_dir: Path) -> None: |
no test coverage detected