CoMPASS Level 2 - Plotting¶
Visualization functions for Level 2 results and analysis.
Overview¶
This module provides functions to visualize:
- KDE-based proximity distributions
- Spatial embeddings of behavioral states
- State-specific measures and bout analysis
- Composite visualizations
Functions¶
compass_labyrinth.compass.level_2.plots
¶
plot_kde_per_session
¶
Source code in src/compass_labyrinth/compass/level_2/plots.py
compute_spatial_embedding
¶
Source code in src/compass_labyrinth/compass/level_2/plots.py
create_embedding_grid
¶
Source code in src/compass_labyrinth/compass/level_2/plots.py
plot_spatial_embedding
¶
plot_spatial_embedding(
config: dict,
embedding_grid: ndarray,
title: str = "Spatial Embedding Heatmap",
save_fig: bool = True,
show_fig: bool = True,
return_fig: bool = False,
) -> None | plt.Figure
Plot a heatmap of the spatial embedding grid.
Parameters:
-
config(dict) –Configuration dictionary for this project.
-
embedding_grid(ndarray) –2D array representing the spatial embedding values.
-
title(str, default:'Spatial Embedding Heatmap') –Title of the heatmap.
-
save_fig(bool, default:True) –Whether to save the figure to disk.
-
show_fig(bool, default:True) –Whether to display the figure.
-
return_fig(bool, default:False) –Whether to return the figure object.
Returns:
-
Figure or None–The matplotlib Figure object if return_fig is True, else None.
Source code in src/compass_labyrinth/compass/level_2/plots.py
normalize_features
¶
Normalize specified feature columns to [0, 1] range.
Source code in src/compass_labyrinth/compass/level_2/plots.py
compute_detailed_bout_summary
¶
compute_detailed_bout_summary(
df: DataFrame,
feature_cols: list[str],
node_filter: str = "Decision (Reward)",
state_col: str = "HMM State",
target_zone: str = "Target Zone",
valid_bout_threshold: int = 10,
bout_col: str = "Bout_ID",
)
Compute per-bout median values of features and success/validity flags.
Source code in src/compass_labyrinth/compass/level_2/plots.py
plot_measures_by_bout_type
¶
Plot violin + box + swarm plots for angular measures by bout type.