a, Steps for computing CP, a measurement of the discriminability of two conditions, given the Δ F( t)/ F 0 of a single cell. Given a pair of behaviours (here, male-directed attack and sniffing), we computed the distribution of Δ F( t)/ F 0 values for this cell for each behaviour, and then integrated each distribution to produce a pair of cumulative distribution functions (cdfs). The area under the ROC curve formed from these two distributions is defined as the cell’s CP; CP of this example cell was 0.69. Right-most panel shows CP for all cells (arrow indicates CP of the example cell); outlined bars denote cells for which CP was significantly higher than chance. b, ∆ F/ F traces and corresponding behaviour rasters from example cells that showed significant CPs for the specified behaviour, illustrating the relative changes in ∆ F/ F and behaviour. Three representative trials are shown (same examples as in Fig. 2 d–g). c, Proportion of cells significantly tuned for each examined behaviour. Overlap between blocks reflects the proportion of cells that were significantly tuned for both behaviours. Note that by this metric, cells cannot be tuned for both attack and male-directed sniffing, nor for both mounting and female-directed sniffing, because the CP of a cell is defined by comparing Δ F( t)/ F 0 values under these paired conditions. All cells significantly tuned for attack, mount or sniff also showed a significant CP for periods of close social interactions (including sniffing and/or mount or attack) versus periods of non-social interactions, by construction. However, some cells that showed a significant CP for close social interactions versus non-social periods did not show a significant CP for a specific behaviour (see Fig. 2h). d, Separate precision (true positives / (true positives + false positives)) and recall (true positives / (true positives + false negatives)) scores for the behaviour decoders presented in Fig. 2b, c. The F1 score (presented in Fig. 2c) is defined as 2(precision × recall) / (precision + recall).