CoMPASS Level 2 - Data Streams¶
Functions for computing reward-contextual features for Level 2 cognitive state inference.
Overview¶
This module provides utilities to compute:
- KDE-based proximity to target zone
- Angular deviation from reward path
- Euclidean distance to target
- Value-based distance measures
- Reference orientation information
These features are combined with Level 1 states to infer goal-directed cognitive states.
Functions¶
compass_labyrinth.compass.level_2.datastreams
¶
CLOSE_REF
module-attribute
¶
CLOSE_REF = {
11: 10,
47: [11, 23, 35],
46: 47,
22: [34, 46],
20: [22, 21, 8, 32, 44, 56, 68],
32: [20, 33, 71, 44, 56, 68],
8: 9,
33: [45, 57],
57: [58, 59],
59: [83, 95],
68: [69, 70],
29: [30, 31, 32],
5: [17, 29],
7: 6,
19: 7,
17: [18, 19],
2: [3, 4, 5],
26: [2, 14],
16: [28, 40],
14: [15, 16, 12, 13, 24],
0: 1,
12: [36, 0],
39: [27, 37, 38, 25],
27: 26,
51: [27, 39, 52, 53, 42],
63: [51, 64, 65, 66, 54],
53: 41,
41: 43,
43: [55, 67],
60: [61, 62, 63],
72: [48, 60],
48: [49, 50],
77: [72, 73, 74, 75, 76, 78, 79, 80, 81, 82],
101: [77, 89],
89: [90, 91, 92, 93, 94, 106],
92: [104, 116],
116: 117,
93: 105,
106: 118,
118: 119,
119: [107, 131, 143],
103: [101, 102],
115: [103, 127, 139],
139: [140, 141, 142],
142: 130,
130: [128, 129],
113: [114, 115],
114: [126, 138],
137: [113, 125],
135: [136, 137],
111: [123, 135],
108: [111, 110, 109],
110: [122, 134],
132: 120,
133: 132,
109: [121, 133],
96: 108,
98: [96, 97, 99, 100],
88: 87,
100: [88, 112, 124],
86: 98,
84: [85, 86, 84],
}
X_Y_MAPPING
module-attribute
¶
loso_kde_cv
¶
Source code in src/compass_labyrinth/compass/level_2/datastreams.py
compute_kde_scaled
¶
Source code in src/compass_labyrinth/compass/level_2/datastreams.py
plot_kde_per_session
¶
Source code in src/compass_labyrinth/compass/level_2/datastreams.py
map_category
¶
get_reference_vector
¶
calculate_deviation
¶
Source code in src/compass_labyrinth/compass/level_2/datastreams.py
compute_angle_deviation
¶
Source code in src/compass_labyrinth/compass/level_2/datastreams.py
assign_reference_info
¶
Source code in src/compass_labyrinth/compass/level_2/datastreams.py
compute_center_coordinates
¶
Compute the mean (x, y) position of specified grid nodes.
Source code in src/compass_labyrinth/compass/level_2/datastreams.py
compute_euclidean_distance
¶
Compute Euclidean distance from each (x, y) to a center (x_mean, y_mean).
Source code in src/compass_labyrinth/compass/level_2/datastreams.py
merge_value_map
¶
Source code in src/compass_labyrinth/compass/level_2/datastreams.py
compute_weighted_and_normalized_distance
¶
compute_weighted_and_normalized_distance(
df: DataFrame,
distance_col: str = "Targeted_Distance",
value_col: str = "Value",
out_col: str = "VB_Distance",
norm_range: tuple = (0, 3),
) -> pd.DataFrame
Compute weighted distance and normalize it using MinMaxScaler.
Source code in src/compass_labyrinth/compass/level_2/datastreams.py
compute_value_distance
¶
Full pipeline for value-based distance computation: 1. Compute center of target grid(s) 2. Compute Euclidean distance to center 3. Merge with value map 4. Compute weighted and normalized distances