sda.analysis.viz#

Shared Plotly building-blocks for SDA analysis dashboards.

Provides two reusable figure components:

Functions#

iso_power_traces(x_min, x_max, y_min, y_max[, ...])

Return (traces, annotations) for iso-power hyperbolas.

background_heatmap_trace(x_pts, y_pts, z_pts, x_range, ...)

Return a griddata-interpolated go.Heatmap trace, or None.

Module Contents#

sda.analysis.viz.iso_power_traces(x_min, x_max, y_min, y_max, power_candidates=None)#

Return (traces, annotations) for iso-power hyperbolas.

Each power level P (watts, since kHz·mJ = W) is drawn as a faint dotted line with a semi-transparent annotation label. A wide transparent overlay trace carries a detailed hover tooltip without affecting visuals.

Parameters:
  • x_min (Data range for the x-axis (Energy per pulse, mJ).)

  • x_max (Data range for the x-axis (Energy per pulse, mJ).)

  • y_min (Data range for the y-axis (Frequency, kHz).)

  • y_max (Data range for the y-axis (Frequency, kHz).)

  • power_candidates (Power levels in W to consider.  Levels outside the data) – range are skipped automatically.

Returns:

  • traces (List of go.Scatter traces to extend into the figure.)

  • annotations (List of annotation dicts to pass to fig.update_layout.)

sda.analysis.viz.background_heatmap_trace(x_pts, y_pts, z_pts, x_range, y_range, colorscale='RdYlGn', zmin=None, zmax=None, grid_size=80, opacity=0.4)#

Return a griddata-interpolated go.Heatmap trace, or None.

Requires at least 3 data points to interpolate; returns None when that threshold is not met.

Parameters:
  • x_pts (Scatter coordinates and values.)

  • y_pts (Scatter coordinates and values.)

  • z_pts (Scatter coordinates and values.)

  • x_range (:py:class:`(min`, :py:class:`max) tuples that define the grid extent.`)

  • y_range (:py:class:`(min`, :py:class:`max) tuples that define the grid extent.`)

  • colorscale (Plotly colorscale name (default ````”RdYlGn”:py:class:`).`)

  • zmin (Color axis limits.  Inferred from *z_pts* when ``None`.`)

  • zmax (Color axis limits.  Inferred from *z_pts* when ``None`.`)

  • grid_size (Number of grid points per axis (default 80).)

  • opacity (Heatmap opacity (default 0.40).)

Return type:

go.Heatmap or None.