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
|
Circular network plot with nodes colored by cartography role. |
|
Circular network plot with nodes colored by module (Ci) and sized by node degree (ND). |
|
Port of |
|
Half-violin panel for all node-level graph metrics. |
|
Node cartography scatter, port of the top panel of |
|
Spatial network plot, port of the base |
|
Side-by-side "combined" network plot, port of the |
|
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.mwithplotType='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.mwithplotType='circular'andz2name='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×7tiledlayout:Row 0: schematic PNG icons (ND / EW / NS / WMZ / Eloc / PC / BC) loaded from
images_dir(defaults toImages/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 fromParams).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.pngfromStandardisedNetworkPlot.m(reusesnetwork_plot.py’splot_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_namematters, not just cosmetically: it also tellsplot_networkwhetherzis 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"wheneverzisn’t literally node degree (seenetwork_plot.py’splot_networkdocstring).- 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_NetworkPlotfigure fromPlotIndvNetMet.m.Left panel is scaled to this recording’s own range; right panel is scaled to the whole data batch (via the
*_overridebounds). Same two-scale comparison MATLAB builds bycopyobj-ing its individual and scaled figures into one two-subplot figure — here we just renderplot_networkonto 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