arista.viz.recording_overview

Plot a multi-cell recording session as a dual-y-axis figure.

One panel per session. The left axis carries temperature (target T solid, sensor T overlaid thin); the right axis carries ΔF/F₀ per cell. Cells are colour-coded by type (CC / HC / WC) and graded by cell number within type, using the colourblind-safe palettes in arista.constants.

The same callable is used by scripts/preprocess_alex_data.py to produce a per-session overview PNG during preprocessing and will be reused by the future database-backed display layer — both consume the same arista.preprocess.Recording dataclass, so any data source that loads into a Recording is plottable through this module.

API:

Functions

plot_session_overview(recordings, *[, ...])

Plot one recording session as a dual-y-axis figure.

Classes

SessionOverview([figsize, ...])

Callable wrapper around plot_session_overview().

class arista.viz.recording_overview.SessionOverview(figsize=(10, 5), use_drift_corrected=True, show_target=True, show_sensor=True, sensor_alpha=0.55, cell_linewidth=1.0, dpi=200)[source]

Bases: object

Callable wrapper around plot_session_overview().

Useful when many sessions are rendered with the same styling (e.g. a batch script or the future DB-backed display layer):

plotter = SessionOverview(figsize=(12, 6), use_drift_corrected=True)
for session_name, cells in sessions.items():
    fig = plotter(cells, title=session_name)
    plotter.save(fig, output_dir / f"{session_name}.png")

Defaults stored on the instance are forwarded to every call unless overridden in the call’s kwargs.

Parameters:
cell_linewidth: float = 1.0
dpi: int = 200
figsize: tuple[float, float] = (10, 5)
plot(recordings, *, title=None, **overrides)[source]

Build the figure. overrides win over instance defaults.

Parameters:
Return type:

Figure

save(fig, path, *, dpi=None, close=True)[source]

Save the figure as a PNG (smallest disk size for a line plot).

Parameters:
  • fig (Figure) – Figure returned by plot().

  • path (Path | str) – Output path (extension forced to .png).

  • dpi (int | None) – Override the instance default DPI for this save.

  • close (bool) – Close the figure after saving to free memory.

Returns:

The resolved output path.

Return type:

Path

sensor_alpha: float = 0.55
show_sensor: bool = True
show_target: bool = True
use_drift_corrected: bool = True
arista.viz.recording_overview.plot_session_overview(recordings, *, title=None, figsize=(10, 5), use_drift_corrected=True, show_target=True, show_sensor=True, sensor_alpha=0.55, cell_linewidth=1.0)[source]

Plot one recording session as a dual-y-axis figure.

Parameters:
  • recordings (dict[str, Recording]) – Mapping cell_label Recording. The label is the Fiji ROI filename stem (e.g. "l_CC01", "HC02"), used both for the legend and for inferring the cell type via arista.constants.infer_cell_type_from_filename().

  • title (str | None) – Figure suptitle. Typically the recording-directory path.

  • figsize (tuple[float, float]) – (width, height) in inches.

  • use_drift_corrected (bool) – If True (default) and a recording carries dfbf_drift_corrected, plot that; otherwise fall back to the raw dfbf.

  • show_target (bool) – Plot the target (set-point) temperature trace.

  • show_sensor (bool) – Overlay the measured sensor temperature trace.

  • sensor_alpha (float) – Opacity of the sensor overlay.

  • cell_linewidth (float) – Stroke width of each cell’s ΔF/F trace.

Returns:

The matplotlib.figure.Figure. The caller is responsible for savefig / plt.close — keeping I/O out of this function lets the same code run in batch scripts, notebooks, and the future GUI layer.

Raises:

ValueError – If recordings is empty.

Return type:

Figure