meanap.pipeline.plotting_step4

Step 4 check plots: plotConnectivityProperties.m, StandardisedNetworkPlot.m (base + betweenness-centrality-colored variants), NodeCartography.m, StandardisedNetworkPlotNodeColourMap.m (circular/module variant), electrodeSpecificMetrics.m (half-violin panel of all node metrics), and StandardisedNetworkPlotNodeCartography.m (circular/cartography variant).

Not ported: null-model panels (small-worldness — stochastic, see network_metrics.py’s docstring).

Functions

plot_circular_cartography_network(adj_m_sub, ...)

Circular network plot with nodes colored by cartography role.

plot_circular_module_network(adj_m_sub, ci, ...)

Circular network plot with nodes colored by module (Ci) and sized by node degree (ND).

plot_connectivity_stats(adj_m, nd, ns, ...)

Port of plotConnectivityProperties.m's single saved figure.

plot_graph_metrics_by_node(nd, mew, ns, z, ...)

Half-violin panel for all node-level graph metrics.

plot_node_cartography(pc, z, params, lag_ms, ...)

Node cartography scatter, port of the top panel of NodeCartography.m (participation coefficient vs.

plot_spatial_network(adj_m_sub, ...[, ...])

Spatial network plot, port of the base 2_MEA_NetworkPlot.png from StandardisedNetworkPlot.m (reuses network_plot.py's plot_network, built for the Network Viewer GUI tab, since it's already a generic MEA-plot renderer).

plot_spatial_network_combined(adj_m_sub, ...)

Side-by-side "combined" network plot, port of the N_combined_MEA_NetworkPlot figure from PlotIndvNetMet.m.

plot_step4_group_comparisons(recordings, ...)

Generate group comparison plots for step 4.

meanap.pipeline.plotting_step4.plot_circular_cartography_network(adj_m_sub, nd_cart_div, lag_ms, recording_name, out_path, edge_thresh=0.0)[source]

Circular network plot with nodes colored by cartography role.

Port of StandardisedNetworkPlotNodeCartography.m with plotType='circular'.

Parameters:
  • adj_m_sub (ndarray)

  • nd_cart_div (ndarray)

  • lag_ms (float)

  • recording_name (str)

  • out_path (Path)

  • edge_thresh (float)

Return type:

None

meanap.pipeline.plotting_step4.plot_circular_module_network(adj_m_sub, ci, nd, lag_ms, recording_name, out_path, edge_thresh=0.0)[source]

Circular network plot with nodes colored by module (Ci) and sized by node degree (ND).

Port of StandardisedNetworkPlotNodeColourMap.m with plotType='circular' and z2name='Module'. Nodes are arranged at equal angles around a unit circle in index order (t = linspace(-pi, pi, N+1)), exactly as MATLAB does. Edges are circular-arc chords drawn weakest-first so stronger edges appear on top. The legend shows three node-degree reference circles, three edge-weight line samples, and coloured module swatches with integer labels — matching MATLAB’s legend layout.

Parameters:
  • adj_m_sub ((N, N) active-node adjacency matrix)

  • ci ((N,) integer module assignments (1-indexed, from) – mod_consensus_cluster_iterate)

  • nd ((N,) node degree for each active node)

  • lag_ms (lag in milliseconds (display only))

  • recording_name (recording filename (display only))

  • out_path (full path for the saved PNG)

  • edge_thresh (minimum edge weight to draw (default 0 = all edges))

Return type:

None

meanap.pipeline.plotting_step4.plot_connectivity_stats(adj_m, nd, ns, lag_ms, recording_name, out_path, exclude_edges_below_threshold=True)[source]

Port of plotConnectivityProperties.m’s single saved figure.

Layout mirrors the MATLAB 6x6 tiledlayout: adjacency matrix heatmap (top-left block) + max/mean STTC bars (bottom-left) + ND/NS/edge-weight histograms (right column).

Parameters:
  • adj_m (ndarray)

  • nd (ndarray)

  • ns (ndarray)

  • lag_ms (float)

  • recording_name (str)

  • out_path (Path)

  • exclude_edges_below_threshold (bool)

Return type:

None

meanap.pipeline.plotting_step4.plot_graph_metrics_by_node(nd, mew, ns, z, eloc, pc, bc, lag_ms, recording_name, out_path, images_dir=None, rng=None)[source]

Half-violin panel for all node-level graph metrics.

Port of electrodeSpecificMetrics.m. Layout mirrors MATLAB’s 4×7 tiledlayout:

  • Row 0: schematic PNG icons (ND / EW / NS / WMZ / Eloc / PC / BC) loaded from images_dir (defaults to Images/ at the repo root relative to the package install). Missing images are silently skipped.

  • Rows 1–3: half-violin plots (KDE + jitter + mean±SEM) for each metric.

Parameters:
  • nd (node degree, mean edge weight, node strength (always plotted))

  • mew (node degree, mean edge weight, node strength (always plotted))

  • ns (node degree, mean edge weight, node strength (always plotted))

  • z (within-module degree z-score (skipped if None / all-NaN))

  • eloc (local efficiency (skipped if None / all-NaN / all-zero))

  • pc (participation coefficient (skipped if None / all-NaN))

  • bc (betweenness centrality (skipped if None / all-NaN))

  • lag_ms (lag in milliseconds (title only))

  • recording_name (recording filename (title only))

  • out_path (where to save the PNG)

  • images_dir (directory containing ND.png, EW.png … BC.png; if None,) – the function looks for Images/ three levels above this file (i.e. the MEA-NAP repo root).

  • rng (optional seeded RNG (for reproducible jitter in tests))

Return type:

None

meanap.pipeline.plotting_step4.plot_node_cartography(pc, z, params, lag_ms, recording_name, out_path)[source]

Node cartography scatter, port of the top panel of NodeCartography.m (participation coefficient vs. within-module degree z-score, colored by role, with the 5 fixed decision-boundary lines from Params).

The bottom panel in MATLAB’s version is a static reference diagram image (NodeCartographyDiagram.jpg) explaining the 6 roles — not reproduced here since it’s not derived from any data.

Parameters:
  • pc (ndarray)

  • z (ndarray)

  • params (Params)

  • lag_ms (float)

  • recording_name (str)

  • out_path (Path)

Return type:

None

meanap.pipeline.plotting_step4.plot_spatial_network(adj_m_sub, channels_active, channel_layout, z, z2, z2_name, lag_ms, recording_name, out_path, edge_thresh=0.0, z_name='node degree', z_scale_override=None, z2_bounds_override=None, edge_bounds_override=None)[source]

Spatial network plot, port of the base 2_MEA_NetworkPlot.png from StandardisedNetworkPlot.m (reuses network_plot.py’s plot_network, built for the Network Viewer GUI tab, since it’s already a generic MEA-plot renderer).

Electrode coordinates come from channel_layout.get_coords_from_layout. Active channels without a coordinate entry (e.g. grounded corner electrodes on MCS-family layouts) are silently dropped from the plot — they still contribute to the underlying metrics, just not this figure.

z_name matters, not just cosmetically: it also tells plot_network whether z is degree-like (small integers) or a continuous metric like node strength — sizing a continuous metric with the integer-degree scaling logic renders every node far too small. Pass e.g. "node strength" whenever z isn’t literally node degree (see network_plot.py’s plot_network docstring).

Parameters:
  • adj_m_sub (ndarray)

  • channels_active (ndarray)

  • channel_layout (str)

  • z (ndarray)

  • z2 (ndarray | None)

  • z2_name (str)

  • lag_ms (float)

  • recording_name (str)

  • out_path (Path)

  • edge_thresh (float)

  • z_name (str)

  • z_scale_override (float | None)

  • z2_bounds_override (tuple[float, float] | None)

  • edge_bounds_override (tuple[float, float] | None)

Return type:

None

meanap.pipeline.plotting_step4.plot_spatial_network_combined(adj_m_sub, channels_active, channel_layout, z, z2, z2_name, lag_ms, recording_name, out_path, z_scale_override, z2_bounds_override, edge_bounds_override, edge_thresh=0.0, z_name='node degree')[source]

Side-by-side “combined” network plot, port of the N_combined_MEA_NetworkPlot figure from PlotIndvNetMet.m.

Left panel is scaled to this recording’s own range; right panel is scaled to the whole data batch (via the *_override bounds). Same two-scale comparison MATLAB builds by copyobj-ing its individual and scaled figures into one two-subplot figure — here we just render plot_network onto two axes of a single wide figure, each with its own inline legend/colorbar.

Parameters:
  • adj_m_sub (ndarray)

  • channels_active (ndarray)

  • channel_layout (str)

  • z (ndarray)

  • z2 (ndarray | None)

  • z2_name (str)

  • lag_ms (float)

  • recording_name (str)

  • out_path (Path)

  • z_scale_override (float)

  • z2_bounds_override (tuple[float, float] | None)

  • edge_bounds_override (tuple[float, float] | None)

  • edge_thresh (float)

  • z_name (str)

Return type:

None

meanap.pipeline.plotting_step4.plot_step4_group_comparisons(recordings, all_results, out_dir, custom_grp_order=None)[source]

Generate group comparison plots for step 4.

Parameters:
  • recordings (list)

  • all_results (dict)

  • out_dir (Path)

  • custom_grp_order (list[str] | None)

Return type:

None