a Top, a virgin male fly with P1a-Gal4, UAS-GCaMP6s, and UAS-myr-tdTomato transgenes. Middle, the same male fly courting a female fly. Bottom, the male fly copulating with the female fly. From left to right; arena-view, fly-view, fluo-view tdTomato channel, fluo-view GCaMP6s channel, and fluo-view tdTomato channel with a pseudocolor Fratio = FGCaMP6s/FtdTomato representation of the GCaMP6s signal. Yellow boxes indicate the areas shown in the fluo-view. Orange arrows indicate P1 neurons. b Top, dFratio/Fratio raw values for regions of interest encompassing both hemispheres of P1 neurons (black scatter), left hemisphere (blue scatter), and right hemisphere (red scatter), with corresponding LOESS (local polynomial regression) curve fits. Blue and red boxes indicate an extension of the left-wing and right-wing, respectively. The gray arrowhead indicates the time point at which the images in (a) the middle row were captured. Middle, angular difference of male fly’s heading relative to female fly. A positive (red region) or a negative (blue region) angular difference indicates the female fly is on the right-hand or left-hand side of the male, respectively. Bottom, euclidean distance between the flies. Dashed line at 5 mm indicates the upper distance threshold for interaction and contact events. c Top row, dFratio/Fratio values showing individual trial LOESS curve fits (gray), with mean curve (red) (n = 8). Middle row, angular difference (gray), with mean curve (red). Bottom row, euclidean distance between the male and female flies (gray), with mean curve (red). Traces in top and middle rows are time-locked to the bottom row, where flies are at their minimum distance less than 5 mm away from each other (dashed vertical line), with the additional criterion that prior to dropping below the distance threshold of 5 mm, they are at least 7 mm apart. d Activity of P1 neurons in naive males (n = 16), during courtship (n = 55), during copulation (n = 18), and during courtship after copulation (n = 6). **p < 0.001, Mann–Whitney U test. Scale bars, 10 mm for arena view, 200 μm for fly view, and 100 μm for fluo-view. Boxplot whiskers are 1.5× interquartile range.