a, Schematic of the experimental paradigm. Top, mice were trained to run for water rewards that were randomly delivered on each lap. Bottom, CA3/CA2 interneurons were simultaneously recorded with 3D 2p imaging. b, Top left, representative example heat map of the lap-by-lap activity for an interneuron with positive spatial tuning. Top right, the same interneuron’s average tuning curve over all laps compared to a shuffle distribution (Methods). Bottom, summary of the fraction of positively tuned interneurons broken down by both region and CA3 subtypes (PVBC: 0.294 ± 0.304; AAC: 0.323 ± 0.348; SOM: 0.352 ± 0.309; CCK: 0.362 ± 0.291; CB: 0.568 ± 0.311; CA2 average: 0 353 ± 0.283; CA3 average: 0.328 ± 0.237). No significant differences in the fraction of spatially tuned cells were found between CA3 subtypes (one-way ANOVA, P = 0.18) or between the CA2 and CA3 regions (two-sided Mann–Whitney U-test, P = 0.37). The CB subtype represents only CB+SATB1+ neurons; immobility-active CB+SATB1− neurons were silenced during locomotion and were thus not considered in this analysis. Each data point represents an imaging session. PVBC data from 33 imaging sessions, AAC data from 35 sessions, SOM data from 25 sessions, CCK data from 30 sessions and CB+SATB1+ data from 11 sessions were included. CA2 data are from 34 sessions, and CA3 data are from 39 sessions (n = 9 mice). Data are reported as mean ± s.d.; NS, not significant. C, Top left, representative example heat map of the lap-by-lap activity for an interneuron with negative spatial tuning. Top right, the same interneuron’s average tuning curve over all laps compared to a shuffle distribution (Methods). Bottom, summary of the fraction of negatively tuned interneurons broken down by both region and CA3 subtypes (PVBC: 0.379 ± 0.273; AAC: 0.258 ± 0.331; SOM: 0.400 ± 0.290; CCK: 0.357 ± 0.286; CB: 0.341 ± 0.358; CA2 average: 0.423 ± 0.249; CA3 average: 0.384 ± 0.226). No significant differences in the fraction of spatially tuned cells were found between CA3 subtypes (one-way ANOVA, P = 0.41) or between the CA2 and CA3 regions (two-sided Mann–Whitney U-test, P = 0.24). The CB subtype represents only CB+SATB1+ neurons; immobility-active CB+SATB1− neurons were silenced during locomotion and were thus not considered in this analysis. Each data point represents an imaging session. Data are from the same number of sessions and the same number of mice as described earlier and are reported as mean ± s.d. d, Schematic of the imaging paradigm for CA3 pyramidal cells (left) and representative in vivo time average of the CA3 pyramidal cell field of view (right) using the Grik4-Cre transgenic line. CA3 pyramidal cells were imaged during the same random foraging paradigm. e, Left, representative example heat map of the lap-by-lap activity of a spatially tuned CA3 pyramidal cell (from a total of 139 cells from n = 5 mice). Right, the same pyramidal cell’s average spatial tuning curve over all laps compared to a shuffle distribution (Methods). f, Summary data of CA3PC spatial tuning. Left, heat map of the spatial tuning curves of all cells sorted by the location of each cell’s maximum activity (139 cells from n = 5 mice). Right, the fraction of spatially tuned cells during each imaging session; 33.7% ± 12.5% neurons were spatially selective during each imaging session (data are from ten sessions over n = 5 mice, with two sessions per mouse). Each dot represents an imaging session. Data are reported as mean ± s.e.m.; *P < 0.05, **P < 0.01, ***P < 0.001.