Skip to content

radiens_qc.plot

Render a :class:~radiens_qc.report.QualityReport as a single-page figure or as separate panels.

Every function here is pure: it builds and returns matplotlib Figure objects and never touches the filesystem, so callers keep control of where figures go (a report folder, a lab notebook, a temp viewer). :mod:radiens_qc.persist is the only module that writes them.

Figures are constructed directly from :class:matplotlib.figure.Figure rather than through pyplot, so nothing is registered in pyplot's global figure manager (returned figures cannot leak) and no interactive backend is required.

Classes

Functions:

plot_report

plot_report(report)

Build the single-page quality-report figure, sized as a US Letter page.

Layout (6 rows x 3 cols): 0. metadata/scorecard header, spanning all columns. 1. three probe-geometry maps (SNR, noise, activity). 2-3. a ranked per-channel SNR bar spanning a 2x2 block (tall enough to list every site with upright labels), with the noise-floor histogram in the 2x1 column to its right. 4-5. temporal profiles block (array-wide trend line plot, channel x time SNR heatmap, and channel x time firing-dynamics heatmap sharing an x-axis), full width.

The ranked bar and both stability heatmaps share one channel row order (:meth:~radiens_qc.report.QualityReport.rank_order -- ranked by SNR, best at top/row 0), so a given row/bar is the same physical channel across all three panels and they are directly comparable.

.. important:: The figure is laid out at an exact 8.5x11in figsize. Save it with bbox_inches=None -- matplotlib's savefig default of "tight" crops to content and destroys the page sizing. :func:~radiens_qc.persist.save_report does this for you.

Parameters:

Name Type Description Default
report QualityReport

Report to plot.

required

Returns:

Type Description
Figure

The figure. The caller owns it and is responsible for closing it.

plot_report_panels

plot_report_panels(report)

Build each report panel as its own standalone figure.

Emits the same panels the composite page is built from -- header, the three spatial maps, the ranked SNR bar, the noise histogram, the temporal trend, and the two channel x time heatmaps -- by reusing the same private _draw_* functions, so no drawing logic is duplicated. Rows use the same :meth:~radiens_qc.report.QualityReport.rank_order as the composite, so panels stay comparable with it and with each other.

Unlike the fixed-page composite, these are sized per panel and are meant to be saved cropped to content (bbox_inches="tight", matplotlib's default).

Parameters:

Name Type Description Default
report QualityReport

Report to render.

required

Returns:

Type Description
dict[str, Figure]

Panel name -> figure, e.g. "header", "spatial_snr",

dict[str, Figure]

"ranked_bar", "noise_hist", "temporal_trend",

dict[str, Figure]

"snr_time_heatmap". The caller owns the figures and is responsible

dict[str, Figure]

for closing them.