From db818f716cd808877c03de3007fdf9c01c78a9c1 Mon Sep 17 00:00:00 2001 From: serversdown Date: Mon, 14 Sep 2026 20:18:29 +0000 Subject: [PATCH] feat(report): draw the USBM RI8507 compliance chart on the event report MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the "[compliance chart coming soon]" placeholder in _draw_mic_and_usbm with a real inset axes calling sfm.compliance.draw_compliance_chart on rd.channels / rd.sample_rate_sps (the full-rate in/s waveform samples). Title updated "USBM RI8507 And OSMRE" → "USBM RI8507" — we draw only the RI8507 lines (Drywall 0.75 + plaster 0.50); the OSMRE overlay is dropped by choice. Waveform events only (the histogram layout has no USBM chart). Falls back to a "(no waveform data)" note when samples are unavailable. Closes the 1.0 compliance-chart blocker. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01YDXjZCr4RqT2U3QvMDhgzf --- sfm/report_pdf.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sfm/report_pdf.py b/sfm/report_pdf.py index 60dca98..f0e7a97 100644 --- a/sfm/report_pdf.py +++ b/sfm/report_pdf.py @@ -578,15 +578,16 @@ def _draw_mic_and_usbm(ax, rd: ReportData) -> None: _kv(ax, 0.0, y, label, value, label_w=0.18) y -= 0.15 - # USBM chart placeholder — upper-right. Real piecewise compliance - # curves are a separate work item; for now this just shows the title - # + a "see report" message so the layout is correct. - ax.text(0.72, 0.97, "USBM RI8507 And OSMRE", - fontsize=9, weight="bold", color="#333", ha="center", va="top", - transform=ax.transAxes) - ax.text(0.72, 0.50, "[compliance chart\ncoming soon]", - fontsize=8, color="#bbb", ha="center", va="center", - transform=ax.transAxes, style="italic") + # 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") def _mic_rows(rd: ReportData) -> list[tuple[str, Optional[str]]]: