From 95f926c3187f05020005c344187fe47febec95b0 Mon Sep 17 00:00:00 2001 From: serversdown Date: Mon, 14 Sep 2026 20:33:09 +0000 Subject: [PATCH] feat(report): enlarge the compliance chart to a full upper-right panel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The chart was cramped into the short mic band (~2in) and rendered tiny. Move it to its own large square panel (_draw_compliance_panel) spanning the mic + stats rows on the right, clear of the stats columns — matching Blastware's Event Report proportions. _draw_mic_and_usbm now draws only the mic block. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01YDXjZCr4RqT2U3QvMDhgzf --- sfm/report_pdf.py | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/sfm/report_pdf.py b/sfm/report_pdf.py index f0e7a97..b1545e9 100644 --- a/sfm/report_pdf.py +++ b/sfm/report_pdf.py @@ -396,9 +396,27 @@ def _render_waveform_layout(fig, rd: ReportData) -> None: ax_stats = fig.add_subplot(gs[2]); ax_stats.axis("off") _draw_channel_stats_waveform(ax_stats, rd) + _draw_compliance_panel(fig, gs, rd) _draw_waveform_subplot(fig, gs[3], rd) +def _draw_compliance_panel(fig, gs, rd: ReportData) -> None: + """Large square USBM RI8507 compliance chart in the upper-right, spanning the + mic (row 1) and stats (row 2) rows — matching Blastware's Event Report.""" + bottoms, tops, _lefts, rights = gs.get_grid_positions(fig) + y0, y1 = bottoms[2], tops[1] # bottom of stats row → top of mic row + x0, x1 = 0.64, rights[0] # clear of the stats columns → page right margin + fig.text((x0 + x1) / 2, y1 + 0.004, "USBM RI8507", fontsize=9, weight="bold", + color="#333", ha="center", va="bottom") + if rd.channels and rd.sample_rate_sps: + from sfm.compliance import draw_compliance_chart + ax = fig.add_axes([x0, y0, x1 - x0, y1 - y0]) + draw_compliance_chart(ax, rd.channels, rd.sample_rate_sps) + else: + fig.text((x0 + x1) / 2, (y0 + y1) / 2, "(no waveform data)", fontsize=8, + color="#bbb", ha="center", va="center", style="italic") + + def _render_histogram_layout(fig, rd: ReportData) -> None: """Histogram layout: header / mic-only / per-channel stats / bar plot. @@ -577,17 +595,8 @@ def _draw_mic_and_usbm(ax, rd: ReportData) -> None: for label, value in rows: _kv(ax, 0.0, y, label, value, label_w=0.18) y -= 0.15 - - # USBM RI8507 compliance chart — inset axes in the right half of this band. - ax.text(0.74, 1.00, "USBM RI8507", fontsize=9, weight="bold", color="#333", - ha="center", va="top", transform=ax.transAxes) - if rd.channels and rd.sample_rate_sps: - from sfm.compliance import draw_compliance_chart - inset = ax.inset_axes([0.52, 0.02, 0.46, 0.82]) - draw_compliance_chart(inset, rd.channels, rd.sample_rate_sps) - else: - ax.text(0.74, 0.48, "(no waveform data)", fontsize=8, color="#bbb", - ha="center", va="center", transform=ax.transAxes, style="italic") + # The USBM compliance chart is drawn as its own large square panel spanning + # the mic + stats rows on the right — see _draw_compliance_panel(). def _mic_rows(rd: ReportData) -> list[tuple[str, Optional[str]]]: