Introduction

Survival in novel environments is contingent on the acquisition of spatial knowledge and updating behavioral actions based on learned spatial relationships. This learning process engages numerous brain regions and circuits, with the hippocampus playing a critical role in memory-guided spatial navigation, particularly during initial learning in novel environments. Historically, foundational insights into the hippocampus’ role were gained from experiments involving its complete removal or inactivation (S. M. Kim and Frank 2009; Morris et al. 1982; Scoville and Milner 1957; J. J. Kim and Fanselow 1992). These and many other studies established a critical role for the hippocampus in learning but could not explain why disrupting the hippocampus had such profound effects.

Many efforts to address that question have focused on the population activity patterns thought to mediate hippocampal function. Individual hippocampal pyramidal neurons are active in specific locations (‘place cells’ firing in ‘place fields’) (O’Keefe 1976). Place firing during movement is also closely associated with ∼8 Hz theta oscillations: pyramidal cells tend to fire most during the descending phases of theta and least during the ascending phases (Mizuseki et al. 2009). Furthermore, at a population level, each cycle of the theta rhythm typically engages a sequence of place cell firing (a ‘theta sequence’) (Skaggs et al. 1996; Foster and Wilson 2007; Burgess, Recce and O’Keefe 1994). This sequence relates theta to the content of spatial representations, such that positions just behind and at the current position of the animal are represented along the descending phases of theta, while alternative “non-local” positions, such as those further ahead, are regularly expressed during ascending phases (Foster and Wilson 2007; Kay et al. 2020; Joshi et al. 2023; Gupta et al. 2012).

Subsequently, during periods of awake immobility and sleep, the hippocampus frequently reactivates patterns associated with awake experience (Diba and Buzsáki 2007; Joo and Frank 2018; G. Buzsáki, Leung, and Vanderwolf 1983; Panoz-Brown et al. 2018; Karlsson and Frank 2009). Such reactivation events, which often occur during a bout of high frequency oscillatory activity called sharp-wave ripples (SWRs), can include sequential replay of multiple place cells that together represent coherent spatial trajectories through an environment (Diba and Buzsáki 2007; Pfeiffer and Foster 2013; Kay et al. 2016; Karlsson and Frank 2009; Davidson, Kloosterman, and Wilson 2009).

Theta- and SWR-related sequences are well suited to contribute to learning and memory-guided spatial navigation, both through the potential induction of plasticity in downstream structures as well as through the activation of spatially remote representations that could support flexible decision-making (G. Buzsáki 1989; Hasselmo 2025; Skaggs et al. 1996; Foster and Wilson 2007; Jadhav et al. 2012; Gillespie et al. 2021; Denovellis et al. 2021; Johnson and Redish 2007; Kay et al. 2020; Pastalkova et al. 2008; Comrie et al. 2024). At the same time, the precise role of these sequences in learning and decision-making remains unclear.

Previous work has established that manipulations targeting local field potential (LFP) patterns related to these sequences can disrupt navigational behaviors. Studies related to theta have used manipulations of neurons in the medial septum (MS), a brain region critical for learning and regulating the hippocampal theta rhythm. (Mizumori et al. 1990; J. C. Robinson, Wilmot, and Hasselmo 2023). Specifically, disruptions of normal theta oscillatory activity, either through cooling of the MS and reducing theta frequency (Petersen and Buzsáki 2020), entrainment of the endogenous LFP during movement at a frequency well above the normal ∼8 Hz (Zutshi et al. 2018; Quirk et al. 2021), or scrambling of theta (Etter et al. 2023), impairs performance of a previously learned task.

Disrupting SWR activity or elongating SWR duration during awake immobility also affects behavior, impairing or improving learning in a spatial alternation task respectively (Jadhav et al. 2012; Fernández-Ruiz et al. 2019). Effects on theta sequences were not reported in these studies, but these results are broadly consistent with a role for replay and reactivation in learning. Most recently, optogenetic activation of medial entorhinal inhibitory neurons at gamma frequencies during locomotion was shown to disrupt theta sequences, subsequent sequential replay, and the ability of rats to learn to navigate efficiently among rewarded locations in a maze (Liu et al. 2023). The study suggested that theta sequences are necessary to establish replay sequences, raising the possibility that disruptions of theta may affect learning through an impact on replay.

Whether it is possible to disrupt theta sequences without affecting replay, and whether such a disruption would be sufficient to impair learning, remains unknown. Addressing this question is of particular interest because hippocampal activity in the theta state, during locomotion, has been hypothesized to directly support plasticity for learning and memory (G. Buzsáki 1989; Skaggs et al. 1996; Jensen and Lisman 1996; Wang et al. 2015; Mizuseki et al. 2009; O’Keefe and Recce 1993; Hasselmo, Bodelón, and Wyble 2002; Comrie, Frank, and Kay 2022; Foster and Wilson 2007). An understanding of how individual physiological features, such as these locomotion-associated theta dynamics, contribute to learning may also enable identification of therapeutic strategies for improving memory in the setting of hippocampal dysfunction (Gillespie et al. 2024; Atherton, Dupret, and Mellor 2015; Fernández-Ruiz et al. 2019; Martorell et al. 2019).

We therefore developed a closed-loop approach to reliably manipulate hippocampal theta and associated activity during locomotion. Our approach leveraged a specific MS parvalbumin-expressing GABAergic projection, which in turn targets GABAergic neurons in the hippocampal formation (Zutshi et al. 2018; Quirk et al. 2021; Joshi et al. 2017; Wang et al. 2015; Fuhrmann et al. 2015; J. Robinson et al. 2016; Kloc et al. 2020; Mouchati et al. 2020; Lepperød et al. 2021; Etter et al. 2023; Király et al. 2023; Gemzik, Donahue, and Griffin 2021; Yong, Chang, and Brandon 2022; J. C. Robinson et al. 2023). Using this approach, we were able to selectively suppress theta power and disrupt the sequential firing of place cells without affecting average place field activity. This manipulation, when applied in ∼2/3rds of trials, was sufficient to profoundly impair learning when choices depended on memory for specific past experiences. Learning of simpler spatial trajectories remained intact, as did the expression of replay sequences. These results establish that manipulation of theta oscillatory activity and the associated temporal order of spiking is sufficient to impair learning.

Results

Medial septal (MS) parvalbumin (PV)-expressing neurons coordinate theta rhythmic activity across the hippocampal formation (Petsche, Stumpf, and Gogolak 1962; Freund and Antal 1988; Tim James Viney et al. 2018; Joshi et al. 2017). Previous optogenetic manipulations in mice (Bender et al. 2015; Zutshi et al. 2018; Quirk et al. 2021; Etter et al. 2023) have used optogenetic manipulations of this circuit to entrain hippocampal local field potential at experimenter-requested frequencies between 4 and 20 Hz. We similarly used a viral strategy to express a light-activated channel (ChR2) in PV+ neurons within the MS of PV-Cre transgenic rats. We also implanted an optic fiber targeting the MS as well as either silicon electrodes or multi-tetrode arrays targeting the hippocampus in n = 10 rats.

Each of these animals received optical stimulation restricted to periods of locomotion on either a linear track, a W-shaped track, or both (see methods). The stimulation pattern was governed by a protocol that either activated MS PV neurons at a wide range of requested frequencies (“rhythmic stimulation”) or at specific phases of the ongoing theta rhythm (“phase-specific stimulation”) recorded in the hippocampus (Figure 1A). To enable us to assess whether the effects of the manipulation were restricted to stimulation intervals, each behavioral epoch was divided into three approximately equal periods, an initial and final stimulation interval (henceforth “stimulation-on”) and a middle no-stimulation control interval (henceforth “stimulation-off”), during which animals ran for rewards without optical stimulation (Figure 1B).

Reliable and reversible manipulation of hippocampal theta oscillations on a linear track.

A, Schematic of experimental approach. Rats implanted with electrodes targeted to hippocampal region CA1 and a tapered optic fiber targeted to the dorso-ventral extent of the medial septum. Optogenetic stimulation was applied only when the rats were locomoting on a behavioural arena (a linear track shown), using a real-time closed-loop system. B, Two types of optogenetic stimulation protocols, either rhythmic stimulation (defined by period and pulse length), or a theta phase-specific stimulation (90 degree targeting shown), was applied in each session (upper grey boxes). A day consisted of interleaved run and rest epochs of 15–20 minutes each. Run epochs included ‘test’ intervals (purple, “ stimulation-on”), where the optogenetic stimulation would be applied during locomotion, and “control” intervals (blue, “ stimulation-off “), where no optogenetic manipulation was applied during locomotion. C, Virus (AAV5 Ef1a DIO-hChR2(H134R), labeled with eYFP) targeted the medial septum (left) and long-range projecting axon fibers in the hippocampus (right). D, Individual examples (upper two) and epoch-averaged (lower) hippocampal CA1 LFP traces during 10 Hz rhythmic stimulation in one control animal (grey) and one targeted animal (orange) triggered by stimulation onset. Error bars show 95% confidence intervals (CI). E, Power spectral density of hippocampal LFP during 10Hz stimulations during stimulation-on and stimulation-off intervals in one control animal (upper) and one targeted animal (lower). F, Entrainment scores distributions across sessions for n = 3 control animals (grey) and n = 5 targeted animals (orange). Targeted animals show significant entrainment compared to controls (mixed effect linear model (animal, transfection state), effect of transfection; p = 0.0015, targeted n = 19816 interval pairs, control n = 8517 interval pairs). G, Individual examples (upper two) and epoch-averaged (lower) hippocampal CA1 LFP traces during theta phase-specific stimulation in one control animal (grey) and one targeted animal (orange) over time since stimulation onset. Error bars show 95% CI. H, Power spectral density of hippocampal LFP during theta-phase specific manipulation during stimulation-on and stimulation-off intervals in one control animal (upper) and one targeted animal (lower). I, Suppression score distributions across sessions for n = 3 control animals (grey) and n = 5 targeted animals (orange). Targeted animals show significant suppression compared to controls (mixed effect LM (animal, transfection state), effect of transfection p = 2.6 × 10−27, targeted n = 34268 intervals, control n = 14250 intervals). Note, one control animal (Rat I) lacked sufficient runs, and one targeted animal (Rat D) was not tested at the highest laser power during locomotion. Hence these animals could not be included in the entrainment and suppression score calculations.

We confirmed that the PV cells transfected in the MS projected to the hippocampus as expected (Figure 1C). Histological analysis also revealed accurate targeting of both virus and optic fiber to the MS in n=6 animals (hereafter the “targeted” group) and inaccurate targeting of either virus or optic fiber in n=4 animals (hereafter the “control” group). Thus, with this experimental approach, for each experiment, we had both within-animal controls (stimulation-on versus stimulation-off intervals) and across-animal controls (targeted versus control). In a subset of animals (n=3), we also determined the laser power and pulse durations required to reliably entrain hippocampal LFP during locomotion and rest (see Methods). For each analysis, we included all animals in which the relevant manipulation was tested and that met the predefined inclusion criteria (see Methods).

Reliable and reversible manipulation of hippocampal theta oscillations on linear track

In targeted but not control animals, rhythmic optogenetic stimulation of MS PV neurons reliably entrained hippocampal LFP oscillations during stimulation-on intervals without any detectable effect on endogenous theta activity during stimulation-off intervals (Figure 1D, example of 10 Hz stimulation). Correspondingly, the power spectrum of the LFP during stimulation-on intervals (Figure 1E) showed a marked peak at the targeted frequency. To quantify the degree of entrainment, we computed an entrainment score, which was defined as the excess LFP power observed at the requested frequency during stimulation periods compared to control periods (see Methods). We found a robust entrainment of the LFP at requested frequencies for targeted animals and no detectable change in control animals (Figure 1F, example of 10 Hz). These observations were consistent across stimulation frequencies (Supplementary Figure 1). These experiments replicate results from previous work in transgenic mice (Zutshi et al. 2018; Quirk et al. 2021; Etter et al. 2023) and helped us optimize the optic fiber, laser power, and pulse widths required for effectively driving MS neurons in transgenic rats (see Methods).

Closed-loop theta phase-specific manipulation results in a rapid reduction of theta power on linear track

Spiking activity in the hippocampus is closely associated with ongoing theta oscillations, with pyramidal cells tending to fire least during the ascending phases of theta and most during the descending phases (Mizuseki et al. 2009). This temporal structure is coordinated by a network of local and long-range GABAergic inputs from cortical and subcortical regions (Joshi et al. 2017; Varga, Golshani, and Soltesz 2012; Viney et al. 2018; Salib et al. 2019; Király et al. 2023), each precisely timed and phase-coupled to endogenous theta oscillatory activity. A subset of rhythmic MS PV neurons, in particular, project to hippocampal axo-axonic cells (Tim J. Viney et al. 2013; Joshi et al. 2017), and thus activation of MS PV neurons should have a disinhibitory effect on hippocampal pyramidal cells. We therefore reasoned that closed-loop activation of MS PV neurons during the ascending phase of ongoing theta (Supplementary Figure 2A) would introduce additional pyramidal cell spikes and disrupt normal hippocampal theta dynamics.

Consistent with this prediction, we found optogenetically activating MS PV neurons at the ascending phase of theta resulted in a marked reduction of theta power beginning approximately 200 ms after initial stimulation onset (Figure 1G). To quantify this relationship, we computed a suppression score, defined as the decrease in LFP power observed at the peak frequency during stimulation-off periods compared to that observed during stimulation-on periods (see methods). This measure confirmed the prominent reduction in theta power (Figure 1H) in targeted animals compared to control animals (Figure 1I). As in the rhythmic stimulation condition, these changes were restricted to stimulation times, and endogenous theta dynamics were unaffected during stimulation-off run periods.

This manipulation did not affect running velocity between stimulation-on intervals compared to stimulation-off intervals (t-test between the distribution of average velocities per-trial within each animal group; targeted animals: p =0.8; control animals: p =0.5). Thus, this theta-phase-specific manipulation selectively suppresses the extracellularly measured theta rhythm while leaving gross locomotor behavior intact.

Theta disruption alters temporal spiking of pyramidal cells, but preserves place fields

The disruption of theta oscillations could potentially affect both temporal and spatial properties of individual hippocampal pyramidal cells. Previous studies have yielded varied results, with some dissociating spatial and temporal properties through specific optogenetic manipulations (Liu et al. 2023), and others reporting mixed effects (Etter et al. 2023). To examine the effects on temporal and spatial coding we first verified that putative pyramidal cells in control animals were unaffected by the light pulses while cells in targeted animals showed short latency (5–10 ms), robust responses (Figure 2A-C). This effect is consistent with the strong disinhibitory input from the medial septum to the hippocampus (Joshi et al. 2017) and the expected synaptic delays by strongly myelinated GABAergic neurons (Jones, Norris, and Henderson 1999).

Theta disruption impairs temporal coding of pyramidal cells, but preserves place code on linear track.

A, Raster plots of simultaneously recorded hippocampal neurons ordered by the peak of their place fields with MS optogenetic theta phase-specific stimulation pulses highlighted (purple) in one control (top) and one targeted (bottom) animal. Note that in control rats, endogenous theta sequences are apparent. B, Stimulation-triggered averages of simultaneously recorded hippocampal neurons show the absence of consistent stimulation-triggered organization in control animal (top) and entrainment of spiking by optogenetic activation in targeted animal (bottom). Vertical dashed lines indicate stimulation time. Firing rates (normalized) shown in heatmap. C, Stimulation-triggered MUA across all control (n = 499 units, 4815 pulses, top) and targeted (n = 583 units, 5143 pulses, bottom) animals shows distinct MUA spiking structure during stimulation. In control animals, the expected relationship is observed, with spiking probability decreasing during stimulation times that occur in the ascending theta phases, whereas in targeted animals spiking probability increases ∼10 ms after stimulation onset. Shaded regions are 95% CI of the mean. D, Pairwise temporal offsets between cross-correlograms computed in stimulation-on versus stimulation-off intervals in control (n = 3674 pairs, top) and targeted (n = 2375 pairs, bottom). Note, a strong diagonal indicates that the cross-correlation structure is maintained in control animals (as expected). Control vs. targeted p < 10−4 for pooled data; hierarchical bootstrap p = 0.15. E, Examples of three place cells’ spatial selectivity in targeted animals during stimulation-off (blue) versus stimulation-on (purple) intervals. Note similar spatial tuning patterns. F, Spatial stability across all identified place cells in one targeted animal during stimulation-off (left, blue box) and stimulation-on (right, purple box) periods in one targeted animal. Note similar spatial tuning patterns. G, Place field stability is measured for all units as the KL divergence (see Methods) of their spatial firing selectivity between stimulation-on and stimulation-off intervals (t-test of distributions of KL divergence between targeted (n = 35 units satisfying inclusion criteria across n = 3 animals) and control (n = 43 satisfying inclusion criteria across n = 4 animals) animals, p = 0.8).

To examine the impact of our manipulation on the sequential temporal relationships between principal cells, we constructed cross-correlation histograms for pairs of putative place neurons (i.e., units with localized place fields; see Methods) during both stimulation-on and stimulation-off intervals. These histograms typically exhibit strong theta modulation, with peaks at the theta timescale; the offset of these peaks from zero reflects longer timescale differences in firing related to spatial firing fields (Dragoi and Buzsáki 2006; Skaggs et al. 1996). For each cross-correlation, we identified the highest peak value within ±100 ms of zero. We then pooled data across all animals and run sessions and plotted the location of each cell pair’s peak during stimulation-on versus stimulation-off intervals (Figure 2D).

These plots revealed the expected diagonal of peak offset for control animals, reflecting consistent cross-correlation structure with or without stimulation. Consistent structure was less readily visible in targeted animals, with many cell pairs showing more synchronous activity during stimulation-on periods (R2 = 0.10, control vs. targeted p < 10−4 for pooled data; more conservative hierarchical bootstrap p = 0.15, reflecting low sample count for some animals).

By contrast, we did not detect any changes in the spatial tuning of putative pyramidal neurons. Specifically, the increased spiking during stimulation-on intervals respected place field boundaries (Supplementary Figure 2B) and the place fields of single cells were not detectably affected by theta disruption (Figure 2E-F, single cell place fields, pooled for G). These results are consistent with previous studies that performed MS manipulations (Zutshi et al. 2018; Etter et al. 2023). Thus, our manipulation protocol provides an opportunity to ask specifically how temporal coding contributes to behavior.

Theta disruption impairs learning in a novel spatial environment

We next investigated the effects of disruption of locomotion-associated hippocampal temporal dynamics on learning. Specifically, we focus on the initial learning of a hippocampal-dependent spatial alternation task in a W-track environment (S. M. Kim and Frank 2009). As in previous experiments on the linear track, we maintained the stimulation-on, stimulation-off, stimulation-on structure (Figure 1B) to assess the impact of stimulation on single-cell and population-level activity. In contrast to the linear track experiments, theta-disruption was begun as soon as animals were first put on the maze, allowing us to assess the importance of theta-timescale structure for learning. Here the control group was expanded to include data from our prior work (Joshi et al. 2023) that used the same training protocol.

Despite the interleaved stimulation-off periods, targeted animals had pronounced deficits in learning the spatial alternation task. We first examined the more cognitively challenging outbound trials in which animals must remember their previous outer arm visit to make the next correct choice. While control animals readily learned to alternate correctly, targeted animals were profoundly impaired (Figure 3A, 3B, t-test performance accuracy, p=0.01). By contrast, we did not observe any significant differences in learning across groups on the interleaved inbound trials, where a simpler place–action association is sufficient to enable learning (Figure 3C, 3D, t-test, performance accuracy, p =0.126).

Theta disruption impairs learning of outbound trial structure in a novel W-track environment.

A, W-track schematic for Outbound trials (left). Learning curve for control animals (n = 4, middle, grey) and targeted animals (n = 4, right, red) on Outbound trials. B, Performance accuracy (left) and learning trial (right) for Outbound trials (n = 8 control animals, grey; n = 4 targeted animals, red; 4 control animals from this study, 4 control animals from Joshi et al., 2023). Performance accuracy t-test p = 0.010. C, W-track schematic for Inbound trials (left). Learning curve for control animals (n = 4, middle, grey) and targeted animals (n = 4, right, red) on Inbound trials. D, Performance accuracy (left) and learning trial (right) for Inbound trials (n = 8 control animals, grey; n = 4 targeted animals, red; n = 4 control animals from this study; n = 4 control animals from Joshi et al., 2023). Performance accuracy p = 0.126. E, Probability of “repeat” error trials (re-visiting a reward port on outbound trials) in control animals (grey solid line, left, n = 1160 trials) and targeted animals (right, red solid line, n = 1233 trials) compared to the 95% CI (grey shaded region) of an analytical chance distribution. Targeted animals’ choices are not different from the chance distribution. F, Left: Distribution of running speeds in control (grey) and targeted (red) animals on inbound and outbound trials (linear mixed effects model: effect of targeting, p = 0.61; interaction (targeting × trial type), p = 6.52 × 10−4) during time spent outside reward ports. Right: Distribution of occupancy times around the choice point (right) in control (grey) and targeted (red) animals on inbound and outbound trials (linear mixed effects model: effect of targeting, p = 0.94; interaction (targeting × trial type), p = 1.39 × 10−4).

To further characterize the selective deficit on outbound trials we calculated the probability that animals revisited the same reward port on consecutive trials (“repeats,” Figure 3E), which reflects a violation of the task rules and never results in reward. Control animals showed a strong bias to avoid visits to the immediately previously visited arm and thus had a distribution of repeated visits very different than random. By contrast, the targeted animals’ outbound choices were not distinguishable from random, and thus showed no overall history dependence.

This learning disruption on the W-track could not be explained by consistent changes in motivation: both targeted and control animals completed >300 trials, sufficient to measure learning (Jadhav et al. 2012; Joshi et al. 2023). There were similarly no significant differences in average running speed or choice point occupancy during locomotion, but targeted animals did move more slowly and spend more time near the choice point on outbound trials (Figure 3F, Video 1, Speed targeted: median: 38.5 cm/s (IQR 25.8–47.1); control: median 46.44 cm/s (IQR 32.8–55.1), linear mixed effects model: effect of transfection; p =0.68; interaction (transfection x trial type; p<0.05); occupancy targeted: median: 1.5 s (IQR 1–2.5), control: 0.7 s (IQR 1–1.7), linear mixed effects model: effect of transfection: p =0.94, interaction (transfection x trial type; p<0.05)). This pattern is consistent with the targeted animals having greater choice uncertainty on outbound trials.

Disruption of theta sequences in the W-track

We then asked how our manipulation affected the structure of the spiking activity on the W-track. We first verified that, as for the linear track (Figure 2C), stimulation drove an increase in spiking in the targeted, but not the control group (Supplementary Figure 3A). We next examined the consistency of pairwise cross-correlation peaks between stimulation-on and stimulation-off periods as we did for the linear track (Figure 2D).

Here again we observed more consistent cross-correlation structure in control animals (linear fit R2 = 0.09), and less consistent structure in targeted animals (R2 = 0.005; Supplementary Figure 3B). These differences were highly significant when data were pooled across animals and run epochs (control vs. targeted p < 10−4) and were also significant with the more conservative hierarchical bootstrap (p < 10−3; Supplementary Figure 3C).

The presence of a persistent learning deficit on outbound trials despite stimulation-off periods suggested the possibility that the suppression of theta in the W-track led to persistent deficits in the temporal structure of hippocampal activity. We therefore compared the structure of activity across control and targeted animals for both stimulation-on and stimulation-off periods. We plotted, for each cell pair, the peak of the theta time-scale cross-correlation on the y-axis and the peak of the behavioral (∼1 second) time-scale cross-correlation on the x-axis (see Methods).

These plots revealed a persistent deficit in the temporal organization of spiking in targeted animals present in both stimulation-on and stimulation-off periods (Supplementary Figure 3D). In control animals, these plots showed the expected correlation between short- and long-timescale peaks consistent with theta sequences (R2 = 0.077) but this correlation was largely absent in the targeted animals (R2 = 0.007; pooled comparison p < 10−4, hierarchical bootstrap p < 0.05, Supplementary Figure 3E). Thus, disruption of theta during stimulation periods was sufficient to disrupt sequential spiking activity even after stimulation was turned off.

Finally, we also verified that, as in the linear track (Figure 2G), this disruption was confined to fine timescale activity: as for the linear track, place fields remained similar across stimulation-on and stimulation-off periods in both control and targeted animals (Supplementary Figure 3F). Thus, the disruption of theta during stimulation-on periods leads to disruptions of the fine-timescale temporal structure throughout the W-track experiences while leaving place fields unaffected.

These findings motivated a population-level approach to better understand the impact of theta disruption on representations of position on the W-track. We used a clusterless state-space decoding algorithm to estimate, for each 2 ms bin, the probability distribution of represented locations on the track (Denovellis et al. 2021).

Typical patterns of spatial representation were readily visible in control animals. There was pronounced rhythmicity reflecting theta sequences: each theta cycle typically begins with a representation close to the animal which then sweeps forward, resetting once the next theta cycle begins (Figure 4A) (Johnson and Redish 2007; Foster and Wilson 2007; Kay et al. 2020; Joshi et al. 2023). We quantified the prevalence of theta-timescale position sweeps by first calculating the distance (in 2 ms bins) between the peak of the posterior of the decoded representation and the animal’s actual position (ahead/behind distance). We then computed the power spectrum of this distance separately for outbound and inbound trials, given the distinct cognitive demands associated with each trial type. In the control animals, this power spectrum shows the expected pronounced peak around 8 Hz in both stimulation-on and stimulation-off periods (Figure 4B). We also quantified the changes in the probability of observing continuous decodes relative to stimulation times during stimulation-on periods. These probabilities showed the expected decrease in continuity associated with late phase theta, where the representation can jump back to a location at/or behind the actual location of the animal (Figure 4C). Similarly, the peri-stimulation patterns of change in entropy, which measures the concentration of the decoded distribution, showed the expected increase seen during late phase theta where spatial representations are less concentrated (Figure 4D).

Theta disruption suppresses fast timescale sequential position representations.

A, Examples of decoding position from population spiking on outbound trials in control animals. From top to bottom: actual linearized position (red) and estimated position posterior (greyscale); multiunit spike rate (spikes/s); ahead/behind distance of decoded position to animal’s actual position (cm); probability of a spatially continuous decoding state; and entropy of posterior over space. B, Power spectrum of the ahead/behind distance for stimulation-on and stimulation-off intervals across all trials in control animals, separated by trial type (top: outbound; bottom: inbound). Note the clear peak near 8 Hz reflecting the presence of robust theta sequences. C, Quantification of stimulus-triggered probability of the posterior to be continuous during stimulation-on trials for control animals. Note prominent theta-timescale structure reflecting more continuous representations in early phases of theta. D, Quantification of stimulus-triggered posterior entropy across all trials in control animals. Note increases in entropy toward later phases of theta corresponding to stimulation times. E, Examples of decoding position from population spiking on outbound trials in targeted animals; plot elements as in A. Note the disruption in theta-timescale structure. F, Power spectrum as in B for targeted animals. Note suppression of theta-timescale peak on outbound trials (top) and absence of obvious structure on inbound trials. G, Probability of continuous state as in C for targeted animals. Note altered distribution as compared to C. H, Entropy of posterior as in D for targeted animals. Note altered distribution as compared to D. I, Quantification of relative power in the power spectrum of the ahead/behind distance in the 8–12 Hz band relative to the mean of the 4–8 and 12–15 Hz bands. All comparisons were significant (all pooled data pairwise t-tests: p < 10−4; all hierarchical bootstrap tests: p < 0.05).

The theta-time scale rhythmic features of the population representation of space were disrupted in targeted animals, even as the decode remained on average close to the animal (reflecting the preservation of place field structure) (Figure 4E). Moreover, the rhythmic features were disrupted during both stimulation-on and stimulation-off periods. The ∼8 Hz peak in the power spectrum of the ahead/behind distance was much less visible on outbound trials and was absent on inbound trials (Figure 4F). Further, the consistent modulation of both the probability of a continuous decode state and of the entropy of the posterior distribution around stimulation times was also much less prevalent in targeted animals (Figure 4G, H).

We focused on the power spectrum to quantify these differences across control and targeted animals, across outbound and inbound trials, and across stimulation-on and stimulation-off periods. Consistent with the pairwise analyses (Supplementary Figure 3B-D), the ∼8 Hz peak in the power spectrum of the ahead/behind distance was significantly larger in control animals than in targeted animals across all conditions (Figure 4I; pooled comparison p’s < 10−4, hierarchical bootstrap p’s < 0.05). At the same time, the maximal ahead/behind distances near the choice point, where choices must be made on outbound and inbound trials, did not differ between control and targeted animals (Supplementary Figure 3G). Thus, our findings indicate that the precise timing of non-local representations during theta was disrupted, but the spatial extent was not.

Finally, the differences in the power spectrum also motivated us to return to the linear track data and examine the impact of rhythmic frequency stimulation on decoded representations. To our surprise, the peak of the power spectrum of the ahead/behind distance appeared to shift systematically with the applied stimulation frequency (Supplementary Figure 4). This suggests a surprising level of preserved representational movement across frequencies ranging from 6 to 12 Hz.

Theta disruption spares replay during sharp wave ripples

A previous study that used an optogenetic intervention in the Entorhinal Cortex to disrupt hippocampal theta sequences reported that doing so also disrupted the sequential structure of replay events seen during subsequent offline periods (Liu et al. 2023). We therefore asked whether our manipulation could provide a dissociation between theta sequences and subsequent replay, or whether both were affected.

We focused on replays seen during pauses in behavior on the track and found that despite the temporal disruption of spiking in the hippocampus during locomotion, SWRs and associated replays were not detectably affected. Replay events in both control and targeted animals showed the expected continuous progression of positions over time, along with increases in multiunit firing rates and power in the ripple band (Figure 5A). Moreover, we were able to identify clear replay events during the stimulation period within the first exposure to the track in both control and targeted animals (Figure 5A bottom row).

Theta disruption does not impact sharp-wave ripples (SWRs) or replay.

A, Examples of decoding position from population spiking in control (left) and targeted (right) animals during SWR events. Bottom row shows events occurring during the first five minutes of experience on the track (a stimulation-on period). Each panel: Top: actual linearized position (red) and estimated position posterior (greyscale). Middle: multiunit spike rate (spikes/s). Bottom: bandpass-filtered ripple events. SWR events highlighted in light pink. B, SWR rates (top) and length (bottom) do not differ significantly between stimulation-on and stimulation-off intervals in targeted (shades of orange) and control (shades of grey) animals (paired t-test for each animal, p values reported in the figure; comparison of groups not significant, mixed effects linear model p = 0.929 for rates, p = 0.426 for lengths). C, Fractions of non-local SWRs that are spatially continuous, fragmented, or a mix of continuous and fragmented states, in targeted (orange) and control (grey) animals. Note overlapping distributions for each ripple content category. D, Average movement speed of the peak of the posterior distribution for continuous decodes (duration > 50 ms, probability of the event being continuous > 90)%. Distributions of speeds were very similar across control and targeted animals (mixed effects linear model, p = 0.253). Note, Rat B had a 32Ch linear probe and hence could not be used for SWR-associated content analysis. Rat L did not have enough continuous replay qualifying the inclusion criteria, but relaxing the inclusion criteria yielded similar results. We noted that there were some very high speed values. A visual inspection of those events suggested that they arose from cases where the posterior distribution was bimodal, and the peak of the distribution transitioned from one mode to the other over a single timestep, thus suggesting high speed movement even though each mode of the distribution was evolving much more slowly.

We then quantified SWR and replay properties based on three parameters that have been linked with hippocampal-dependent learning: SWR rate (Ego-Stengel and Wilson 2010), duration (Fernández-Ruiz et al. 2019; Vancura et al. 2023), and content (Pfeiffer and Foster 2013). There were no consistent changes in the SWR rate and length between control and targeted animals (Figure 5B). Next, we evaluated whether the content of the replay of neural activity may be altered in targeted animals. Here again, we found no evidence that theta disruption affected replay structure: sequential replays reflecting non-local spatial locations were observed during awake immobility with similar frequency across control and targeted animals (“continuous state,” Figure 5C). Finally, we measured the speed of representation movement across >50 ms long continuous periods (Figure 5D). These speeds showed the expected concentration around 10 m/s (Davidson, Kloosterman, and Wilson 2009) and were not different across control and targeted animals. Thus, our manipulation specifically disrupted the temporal order of neural activity in single CA1 cells and their sequential population representations during locomotion.

Discussion

We developed a targeted theta-phase-specific manipulation of hippocampal neural dynamics that selectively impacted sequential activity during locomotion while preserving immobility-related neural dynamics. We found that activating medial septal PV+ neurons at the ascending phase of theta during locomotion disrupted pairwise temporal properties and population-level spatial representations in the hippocampus, yet maintained the individual cell place code. This manipulation, applied during the first and final third of each run epoch, led to a profound impairment in learning the more cognitively demanding trials of a hippocampal-dependent task while sparing learning on the interleaved trials where a less cognitively demanding choice was required. Population neural activity patterns during immobility remained intact, indicating that locomotion-associated theta oscillations and immobility-associated replay mechanisms are functionally separable. Notably, despite this preservation of replay, learning deficits were as severe as those observed in a complete hippocampal lesion (S. M. Kim and Frank 2009).

Our results extend findings from prior manipulations of hippocampal neural activity via medial septal manipulation (Wang et al. 2015; Fuhrmann et al. 2015; J. Robinson et al. 2016; Zutshi et al. 2018; Kloc et al. 2020; Mouchati et al. 2020; Quirk et al. 2021; Etter et al. 2023; Gemzik, Donahue, and Griffin 2021). While previous studies measured the impact of septal manipulation on theta, these studies did not systematically examine the fine timescale structure of population representations. Here we find clear evidence that driving the septal parvalbumin neurons at requested frequencies (rhythmic stimulation condition) drives hippocampal spatiotemporal sequences at that requested frequency. This finding is broadly consistent with the results of medial septum cooling, which slows both theta and the speed of progression of spatial representations in each theta cycle (Petersen and Buzsáki 2020).

We also found a profound learning impairment for the outbound trials of our alternation task in an initially novel environment. This complements the demonstrations of impairment in performance of a previously learned task in previous studies (Zutshi et al. 2018; Quirk et al. 2021; Etter et al. 2023; Petersen and Buzsáki 2020). In our work, we extend those studies to show that SWR rate, length and content are not impacted by theta disruption.

The importance of precise temporal organization of spiking during theta for learning is consistent with the hypothesis that this organization facilitates synaptic plasticity (Skaggs et al. 1996; Lisman and Jensen 2013; Buzsáki 2002). Our results provide strong support for this hypothesis: disruption of the precise sequential activity during theta was sufficient to profoundly impair learning on outbound trials while having no detectable effect on average place field properties or on learning on the interleaved inbound trials.

The dissociation between outbound and inbound learning mirrors patterns seen with awake SWR disruption (Jadhav et al. 2012) and indicates that disrupting either pattern is sufficient to lead to a learning deficit, although theta disruption appears to generate a more profound effect. The selectivity to outbound trials also offers clues as to the computations that may be disrupted. Outbound trials require that animals remember the outer arm they came from on the previous inbound trial such that they can use that information to choose to go to the opposite outer arm. This requires associations across locations, and correctly timed theta sequences may be critical for learning and retrieving these associations. Specifically, Hasselmo et al. (Hasselmo 2025) proposed that early phases of theta support information encoding, while later phases support retrieval (Hasselmo, Bodelón, and Wyble 2002; Hasselmo 2025; Mizuseki et al. 2009). Consistent with this hypothesis, hippocampal theta sequences typically represent locations close to the animal during early phases of theta and can represent hypotheticals, including possible futures and alternative pasts, during later phases (Comrie, Frank, and Kay 2022). The possibility that the timing of these representations is critical for normal brain function is consistent with our observation that representations of locations more distant from the animal were preserved during theta disruption, but the timing of these representations was no longer regular. Thus, the reliability and rhythmicity of septal input to the hippocampal formation are likely critical for providing temporal windows in which relevant behavior-related patterns can be organized into learning and action for outbound trials.

By contrast, a simple location-action association is sufficient for inbound trials, where animals could learn to execute a left or right turn when coming from the right or left outer arms, respectively. Thus, preserved place field activity in targeted animals could enable normal inbound learning.

Critically, the behavioral effects in targeted animals were seen even though stimulation was off during the middle third of each exposure to the W-track. Consistent with this behavioral result, sequential firing during locomotion (at both the pairwise and population level) was disrupted during stimulation-on periods and remained disrupted in stimulation-off periods. This surprising result indicates that the disruption of theta sequences during the initial experience in an environment is sufficient to have lasting effects, potentially as a result of the rapid plasticity engaged during early learning.

Understanding precisely why this temporal organization is critical will require more distributed measurements. Notably, MS targets include multiple cortical and subcortical targets (Joshi 2017), and our manipulation may have disrupted precise spike timing throughout these regions. Additionally, monitoring regions beyond the temporal cortex would be informative given the broad coordination between hippocampal theta and other systems (Joshi et al. 2023; Eichenbaum 2017; Buño and Velluti 1977; Berg, Whitmer, and Kleinfeld 2006; Ledberg and Robbe 2011).

Our results also demonstrate that theta sequences and replay sequences are dissociable. While our manipulation disrupted theta sequences on the track, we saw no effect on replay during periods of immobility on the track. Instead, we observed very similar patterns of activation of sequential representations during SWR events in targeted and control animals. This result contrasts with the conclusion of a previous paper (Liu et al. 2023) that showed the disruption of hippocampal theta sequences and subsequent replay during rest using an optogenetic manipulation of the entorhinal cortex (EC). While our study and the previous study both employed disruptions limited to locomotion, one possible explanation for the different outcomes is the site of the disruption (MS vs. EC). Previous work has shown that the EC can influence replay (Yamamoto and Tonegawa 2017), and thus, the EC manipulation may have additionally impacted EC neural activity, which in turn may have impacted subsequent replay. That said, both our MS manipulation and the previous EC manipulation could have an impact in sites other than hippocampal area CA1 where spatial firing, theta sequences, and replay were assessed. Nevertheless, our results show that disrupting theta sequences is not sufficient to disrupt hippocampal replay, and that replay alone is not sufficient to enable learning. Replay was intact while neural dynamics during locomotion were impaired, and this manipulation was accompanied by a critical impairment in learning the more cognitively challenging outbound component of the W-track.

Our findings, and previous dissociations between precise timescale and place field properties (Petersen and Buzsáki 2020; Liu et al. 2023; Wang, Roth, and Pastalkova 2016) further suggest that different circuits with different time constants are responsible for processing spatial and temporal information in the hippocampal circuit. Spatial/contextual information may arrive from regions with slower timescales (such as the cortex), making them less susceptible to sub-second brief disruptions, while precisely timed inputs from the medial septum coordinate the tightly controlled timing offsets between hippocampal neurons. We hypothesize that learning requires the intersection of these two streams of information in the hippocampal network, and is impaired by the disorganization of the precise temporal templates in which internal plans can be matched to external inputs.

Gaining a deeper understanding of the roles of these inputs will depend on manipulations that target specific patterns of organization of neural activity. This work will build on a wide array of previous studies that developed approaches to disrupt or alter pattern-specific firing (e.g., in medial septum (Wang et al. 2015; Fuhrmann et al. 2015; J. Robinson et al. 2016; Zutshi et al. 2018; Kloc et al. 2020; Mouchati et al. 2020; Quirk et al. 2021; Etter et al. 2023; Gemzik, Donahue, and Griffin 2021), entorhinal cortex (Liu et al. 2023; Lepperød et al. 2021), nucleus reuniens (Ito et al. 2015), supramammillary nucleus (Farrell et al. 2021), and pedunculopontine nucleus (Kaur et al. 2025)). We suggest that greater incorporation of open and closed-loop feedback paradigms will enable a better dissection of the roles of specific patterns of input and information flow in these circuits.

In summary, our results establish a dissociation between locomotion-related theta sequences and offline replay during learning, and indicate that disrupting neural activity patterns during locomotion is sufficient to drive a profound and specific learning deficit. This points toward a critical role of theta-sequences in building and accessing representations that enable choices that depend on integrating past and potential future locations.

Materials and Methods

Experimental model and animals

Neural activity (cellular firing and local field potential) was recorded from the CA1 region of the dorsal hippocampus while simultaneously performing optogenetic stimulation of parvalbumin (PV) neurons in the medial septum in ten PV-Cre Long Evans male rats (6–10 months old, 500–650 g) (Yu et al. 2018). All experimental procedures were in accordance with the University of California San Francisco Institutional Animal Care and Use Committee and US National Institutes of Health guidelines.

Surgery, virus injection, array insertion, and electrophysiological recordings

Prior to surgical procedures, animals were maintained on full food (ad libitum) for one week. Surgery involved injection of a Cre-dependent virus (AAV5-Ef1a-DIO-hChR2(H134R)-eYFP, UNC Vector Core) into the medial septum (ML –0.15 mm, AP +0.904 mm, DV –6.94 mm) and implantation of a multi-electrode recording array in hippocampal area CA1 (AP –3.8 mm, ML +2.8 mm, DV set by tetrode adjustment). Virus (450 nL, 4 × 1012 viral particles/mL) was injected at 0.05 µL min−1 using a Hamilton Nanofil 10 µL syringe with a beveled 33G needle, mounted on a stereotaxic syringe pump (KD Scientific). After each injection, the needle was left in place for 5–10 minutes before retraction to ensure diffusion. Next, we inserted a tapered optic fiber (Optogenix, Lambda-B, NA = 0.39; core/cladding diameters = 200 µm/225 µm; emitting length = 2 mm; implant length = 6 mm; connector: 2.5 mm ceramic ferrule) following the same path as the injection needle. The optic fiber was inserted 200 µm deeper than the injection location to maximize lateral spread of the laser beam in the injection zone. After virus injection, rats were implanted either with 32-channel silicon probes (n = 3; NeuroNexus, 1 shank, 32 electrode sites, shank length = 6 mm, spacing = 50 µm, electrode surface area 177 µm2) or with a 128-channel tetrode drive (v4.6). Animals were allowed 2–3 weeks for viral expression before experiments began. For the animals implanted with 32-channel silicon probes (n = 3), we tested the laser power and pulse durations required to entrain theta oscillations. All three animals were targeted as expected; however, for one animal, the maximum laser power tested was 50 mW, which was not sufficient to induce theta oscillatory activity during the run (only during rest periods). Hence, that animal was not included in the rhythmic stimulation analysis.

Behavioural arenas

Rats were pre-trained on a linear track (125 cm long) to alternate between reward wells on either end. Prior to training, animals were food restricted to 85% of their starting body weight. Nose pokes at the wells were detected by an infrared beam, and upon a successful visit 200 µL of sweetened milk was delivered. Pre-training included two 30 min sessions interleaved with an hour of rest in the rest box.

Linear track

Animals implanted with the recording drives/probes were made to run on the linear track for sweetened milk reward while the electrophysiological signals were recorded using SpikeGadgets hardware and software (v.1.8.0). The animals implanted with the 128 Ch tetrode drives had to undergo a series of tetrode adjusting steps over 10–14 days to lower the tetrodes to the hippocampal cell layer before we started behavioral protocols. The recording setup involved multiple independently moving pulley systems running on carbon fiber tracks hanging from the ceiling, which supported the cables running from the animal’s head allowing the animals to move freely on the 2-D linear track plane. The connection from the drive was passed on through a rotating commutator before connecting to the computer allowing the animals to freely rotate their heads without putting rotational strain on the cables. The medial septal parvalbumin neurons were stimulated using an optic fiber from the laser connected to the optic fiber ferrule on the head of the animal. The animals underwent a stimulation with spatial constraint where the laser was ON only when the animals were away from the reward wells, thereby stimulating primarily during running times. The stimulation protocol (described below) involved pulses of varying width (pulse width values), intervals (interval values) and numbers (number of pulses).

W-Track

After linear track running sessions, animals ran on a W-shaped track to test spatial learning and memory-guided decision making. The track involved 3 arms with the sidearms connected to the base of the center arm forming a W-shape. The rule for this task was that the animals were rewarded when they alternate between the two side arms of the track while visiting the center arm in between each alternation. 0.2 mL sweetened milk was administered at the end of each arm for every correct visit. Electrophysiological data from dCA1 was recorded while the animals underwent a closed loop stimulation of the medial septal parvalbumin neurons. The closed loop stimulation involved both spatial constraint where the laser was ON only when the animals were away from the reward wells and theta phase constraint where the stimulation was tuned to the ascending phase of theta (90 degrees).

Optogenetic manipulation setup

Optogenetic stimulation was achieved through an Omicron LuxX Plus laser (488 nm, 100 mW maximum output) connected to implanted optic fiber cannulae. The cannulae were purchased from Optogenix (Lambda-B, numerical aperture: 0.39, core/cladding diameter: 200 µm /225 µm, emitting length: 2 mm, implant length: 6 mm, ceramic ferrule connector: 2.5 mm). Laser power was initially titrated, beginning at 5 mW and increasing gradually until reaching 77 mW, which was used for all subsequent experiments.

In the probe-only animals (n = 3), we tested the ability to entrain hippocampal LFP during the interleaving rest box periods, by varying laser power (from 5 mW to 77 mW at source) and pulse width (1–60 ms). We found that with a pulse width of 1–5 ms at laser powers greater than 25 mW, we could could completely entrain hippocampal LFP in the rest box (when the animals are predominantly immobile), while higher laser powers (77 mW) and longer pulse widths (> 20 ms) were required for entrainment on the linear track (when the animals are engaged in the movement) (Supplementary Figure 5). Thus, for the rhythmic and phase-specific manipulation, we used 77 mW laser power at source and pulse widths greater than 20 ms. Note that while this is a high overall light power, the use of a tapered fiber substantially lowers the power density in the tissue as compared to a blunt fiber.

Optogenetic stimulation protocols

Optogenetic stimulation protocols were delivered using a custom adaptation of the FSGui module of SpikeGadgets Trodes software. Publicly available code can be found at https://bitbucket.org/mkarlsso/trodes/branch/fsgui_theta2. This module enables two relevant modes of stimulation: rhythmic stimulation at a certain frequency, and theta-phase specific stimulation at the requested phase of the recorded theta rhythm. To limit stimulation to behavioral periods associated with locomotion and the associated hippocampal theta rhythm, we restricted use of these stimulation modes to periods in which the animal occupied a user-defined spatial area of the maze. Spatial filters were set to only permit stimulation when animals were locomoting on the maze, and to prevent stimulation when animals occupied reward port locations.

Open loop stimulation was delivered using the following parameters: Spatial lockout period in samples (set to 7500); Pulses per pulse (set to one for data presented in this paper); Period (ms): 50, 80, 100, 125, 165, 250; Pulse length (ms): 1, 5, 27, 40 (we resorted to using > 20 ms as it provided us with the best entrainment response as compared to 1 and 5 ms).

Closed loop theta phase-specific stimulation parameters enabled specification of a target theta phase. Briefly, one channel of 30 kHz of LFP data recorded from corpus callosum was downsampled to 1500 Hz. A second-order Butterworth filter with a short group delay was applied to the LFP data in the 4–12 Hz frequency band (similar to (Siegle and Wilson 2014)). Upward- and downward-going zero-crossings were detected in the filtered data, and were used to estimate the period of the prior cycle. The period of the prior cycle and zero crossing times were then used to estimate the sample at which the incoming data would reach the target theta phase. A lockout period was specified to prevent excess stimulus triggers. This enabled stimulation at the target phase (Sup. Figure 3). The closed loop stimulation parameters used in these experiments were: Target theta phase (90 degrees); Spatial lockout period in samples (7500); Theta lockout period (2400 samples); Pulses per pulse train (1); Pulse length (ms): either 27 (n = 3 probe animals) or 40 (n = 5 animals).

Behavior analysis

A state space algorithm (Smith et al. 2004) was used to estimate the probability of a correct choice and accompanying 90% confidence interval on inbound, outbound, or all trials. The “learning trial” was defined as the first trial on which the lower bound of the 90% confidence interval was above chance (50%) (Smith et al. 2004). For each animal, we compute related behavioral metrics: the learning trial, the slope of the regression of performance on evenly spaced numbers from 0 to 1 equal to the total number of trials, and the number of trials performed correctly. We also computed average learning curves across animals within each group, and for each trial type, by finding the mean fraction of trials performed correctly in consecutive spans of 20 trials. We show these averages and accompanying 95% confidence intervals.

Data analysis

Codebase and statistical approach

We prepared this dataset in a commonly accessible and reusable format, meeting the Neurodata Without Borders (NWB) standard (Rübel et al., 2023). This data was then ingested into the spyglass framework (Lee KY, Denovellis EL, et al., 2024), which allowed for centralized data management, ensuring all intermediary steps from the raw NWB file to various analysis files were logged. Complete code for data processing and figure generation is available at: https://github.com/LorenFrankLab/ms_stim_analysis.

Across all experiments, an epoch is defined as a single period of time in the task arena, and is typically ∼20 min. At most, one setting of the optogenetic stimulation protocol was run per epoch. Within each epoch, the ∼5–7 min “stimulation-off “ period during the middle of the epoch served as a control for within-epoch comparison of the effect of the driving stimulus. For most analysis, we restrict the data to the trial intervals, defined as the time between leaving a reward port to entering the next. Reward port occupancy was determined as the tracked head position being within 20 cm of the end of the track. For analysis of features specific to animal movement, these intervals were further restricted to times where the animal head speed exceeded 10 cm s−1.

Bootstrap confidence intervals were performed by resampling the observed distribution of events 1000 times and calculating the summary statistics for each. For hierarchical bootstrapping, both the animals within treatment groups and the events within animals were resampled for each calculation. t-test statistics were run using the scipy implementation. Mixed linear regression models were run using the statsmodels python package.

LFP analysis

LFP data was generated from the original 30 kHz electrophysiology recordings by filtering the data with a 0–400 Hz low-pass filter and downsampling to 1 kHz. Results were generated by analyzing the data from a reference electrode above the CA1 layer. Artifacts in the data were defined as periods where the amplitude of the filtered data exceeded 2 mV and were excluded from analysis.

LFP power spectrums were calculated from intervals when animals were outside the reward ports and traveling with a speed of at least 10 cm s−1. Power density spectrums and related scores described below were calculated for each continuous interval meeting these criteria using the scipy implementation of Welch’s method. These were then weighted by duration of the interval and averaged to produce the results shown. [Full analysis: func: Analysis/lfp_analysis/opto_spectrum_analysis ()]

Entrainment score

Entrainment scores were calculated for open-loop fixed-frequency stimulations based on the power of the LFP spectrum at the target frequency during stimulus on (ptest) and stimulus off (pcontrol) intervals. [Full analysis func: Analysis/lfp_analysis/calculate_entrainment_score ().]

Suppression score

Suppression scores were calculated by first identifying the frequency with maximum power in the theta band (4 < f < 12 Hz) in the control power spectrum, then measuring power at that frequency in the control (ppeak_control) and test (ppeak_test) intervals. [Full analysis func: Analysis/lfp_analysis/calculate_suppression_score().]

Spike Sorting

Spike sorting was performed in the spyglass.spikesorting.v0 pipeline. Raw recording files were referenced and bandpass filtered from 600–6000 Hz. Artifacts in the recording were identified as periods where at least 75% of the filtered channel recordings exceeded 2000 µV with 500 ms padding on each side of the event. These were excluded from sorting. Spike sorting was run on each epoch through the spikeinterface package using mountainsort4 sorter with; signal whitening, adjacency_radius 100, clip_size 30, detect_threshold 3, and detect_interval 10. After sorting we computed quality metrics on the identified units using spikeinterface. We then excluded units with a nearest neighbors noise overlap greater than 0.03, a peak offset greater than 2, or an inter-spike interval violation greater than 0.0025.

Event-triggered firing rates for individual cells

For each sorted unit, spike events were binned based on time delay to the nearest stimulus onset. We then calculated the KL divergence between this distribution of spike delays and a null uniform distribution in the same interval. To determine if this represented a significant divergence from the null distribution, we performed circular shuffling of the stimulus times by offsetting each stimulus onset time by an independently chosen value from a range of ± the stimulus period. The KL divergence between the shuffled delay distribution and the uniform distribution was calculated. This process was repeated 1000 times to form a null distribution of KL divergences for each unit. A unit was determined to be significantly modulated if the observed KL divergence was above the 99.5 percentile of the null KL distribution.

Event triggered MUA analysis

Multiunit firing rates were calculated by summing the total number of firing events from sorted units within 2 ms time windows, and then smoothing with a gaussian filter with standard deviation of 5 ms. The mean of this value at each timepoint across trials was estimated using bootstrap sampling techniques described above.

Place fields

Place fields were calculated by fitting a SortedSpikesDetector decoding model from the non_local_detector package (GitHub). Positions were first projected to the linear track skeleton to allow for 1D decoding. Decoding was performed using the packaged sorted spikes kernel density estimation algorithm with sampling rate of 500 Hz, position standard deviation of 6 cm, and discrete position binning of 2 cm. For comparisons of the place coding of cells between the optogenetic test and control intervals, we fit separate models using each of these segments as the encoding interval.

Unit place field coverage

For much of our analysis, we wanted to restrict to units which displayed spatially-localized distributions of firing activity. To do so, we calculated the highest posterior density of the place field distribution to determine the minimum spatial area required to capture 50% of this firing distribution. Thresholding an upper limit for this value allowed us to select cells with well-localized firing patterns.

Temporal offset of cross-correlation

Cross correlograms were calculated for intervals when the animal was continuously running outside of the reward port (speed > 10 cm s−1 for at least 500 ms). Histograms for all spike pairs were calculated over 1 ms time bins.

To calculate fast, theta-timescale delay times, the cross correlograms were then smoothed with a gaussian kernel with standard deviation σ =3 ms. Cells pairs were included for further analyses if they had at least 50 pairs of spike events co-occurring within a ±100 ms window. To define the delay of peak cross-correlation times, we used the scipy function find_peaks with a distance equivalent to 80 ms and selected the delay peak with the largest magnitude.

For slow, positional timescale delay times, the cross correlograms were smoothed with a gaussian kernel with standard deviation σ =500 ms. Cell pairs were included if they had at least 100 pairs of spike events co-occurring within a ±1000 ms window. Peaks were identified with a distance equivalent of 2 s, and the peak closest to zero taken as the delay time.

Place Field Similarity

Consistency of place field coding under the stimulus protocol was quantified by the KL divergence between the place distribution of each neuron’s firing during the control versus the test interval. Units were included in the KL-based place-field stability analyses only if they satisfied both of the following: (i) Spike-count criterion: at least 100 spikes in each interval type used for the comparison—stimulation-off, stimulation-on, and the stimulus sub-interval. (ii) Coverage criterion: the 50% highest posterior density (HPD) region of the unit’s spatial firing distribution was contained within 40 cm on the linear track or within 100 cm on the W-track.

Outbound repeat probability

Outbound repeat sequences are defined as the number of visits to the same outer arm without visiting the alternate arm within an epoch. Note that these sequences are typically interleaved with rewarded visits to the center arm. We show the distribution of sequences of length greater than x in Figure 3E. This distribution under random choice of outer arm at each trial is given as

We sampled this random binomial choice process for the observed number of trials 1000 times for each animal group to get the 95% confidence interval of a random choice process in each case. Values for long repeat sequences below this interval indicate learning of the outbound task.

Clusterless Decoding

Clusterless waveform features were extracted from the same filtered recording used for spike sorting. Event times were identified using spikeinterface.DetectPeakByChannel, with an amplitude threshold of 100 µV and a local exclusion radius of 100 µm. Waveforms of each event were featurized by the peak amplitude within ±500 µs of the event on each channel of the tetrode on which the event was detected. Clusterless position decoding was performed using the ClusterlessDetector algorithm from the non_local_detector package (GitHub). Positions were first projected to the linear track skeleton to enable 1D decoding. Decoding was then performed with the package’s clusterless kernel density estimation algorithm, using a sampling rate of 500 Hz, waveform feature standard deviation of 24 µV, position standard deviation of 6 cm, and discrete position binning of 2 cm.

As some animals had fewer detectable cells on later days of experiments, we restricted our subsequent decoding analysis to positions on the track with sufficient place cell coverage for reliable decoding. We defined this as track regions that fell in the 50% credible interval of at least two well-localized cells’ firing fields (95% of the units place field distribution localized to <50 cm of the track, see Unit place field coverage). From this we defined time intervals where the animal was physically located in these positions to use in decoding analysis below.

Ahead-Behind Distance

Orientation of the animals during movement was estimated using the arc tangent of the animal’s velocity. This value is reasonably well-defined during run intervals analyzed here. Distances between the position and decode along the track path are calculated using the get_ahead_behind_distance function in the non_local_detector package.

Decoding Stimulus Response

Analysis was restricted to stimuli that occurred while the animal was running outside of the reward ports (speed > 10 cm s−1). Furthermore we excluded stimulus times with poor decoding (more than 10 ms of the ±50 ms window surrounding a stimulus containing decodes >50 cm from the animal’s position).

Decode Coverage

Decode coverage is calculated as the area of the linearized track (in cm) spanned by the 95% credible interval of the position posterior from the decoding results.

Posterior entropy

Entropy of the posterior distribution over discrete position bins is defined as:

Ahead-behind distance

see above. Values are clipped to a range of 20 cm around the animal to prevent infrequent large events from skewing distribution.

Multi Unit Activity

Rate of spike events from all sorted neurons is calculated in 500 µs time bins and smoothed with a gaussian kernel of σ =1 ms.

Decoding Distance Power Spectrum

Intervals were identified where the animal was continuously running (>10 cm s−1) for at least 1 s outside of the reward port. Power spectrums were calculated for each of these intervals using the scipy implementation of Welch’s method with a 1 s window. The mean was taken as an average weighted by the length of each interval.

Decoding Distance Power Spectrum Theta Peak

For each spectrum calculated above, the average power in the theta range (6–10 Hz) was normalized by the average power in a reference frequency range (union of 2–6 Hz and 10–14 Hz). The theta peak of the spectrum was defined as the log of this ratio.

Decoding Ahead/Behind Maximum Distance

Intervals were identified where the animal was within a 20 cm radius of the choice point center. For each stimulus within these intervals we identified the maximum decode to animal distance with ±65 ms of stimulus onset.

Sharp Wave Ripples

Sharp wave ripples were identified using the spyglass.ripple.v1 pipeline. LFP data was first bandpass filtered in the range 150–250 Hz. Ripple times were then identified using the z-score threshold method (Kay et al. 2016) implemented in ripple_detection (https://github.com/Eden-Kramer-Lab/ripple_detection). The algorithm was run with a speed threshold of 4 cm s−1, z-score threshold of 2, smoothing σ =4 ms, and minimum ripple duration of 15 ms.

Ripple rates were calculated on a per-epoch basis as the number of ripple events during the optogenetic test and control intervals divided by the duration of stationary times in the corresponding interval.

Sharp Wave Ripple Content

As sharp wave ripples frequently decode to non-local positions, we cannot simply filter times when the animal’s physical location is in a region of the track with sufficient place field coverage. For this analysis, we exclude epochs where at least half of the timepoints cannot be reliably decoded.

A ripple event was classified as non-local if the average decode to animal distance during the interval was greater than 20 cm. Each of these non-local ripples was further classified as continuous/fragmented if the decoding transition state probability was >80% weight toward the corresponding state for at least 80% of the ripple duration. It was otherwise labeled as a ‘mixed’ ripple event.

Supplementary Information

Entrainment of theta at different stimulation frequencies.

A, Entrainment scores distributions across sessions for control (n = 3, grey) and targetd (n = 3, grey) animals at 6 Hz entrainment frequency. Targeted animals show significant entrainment compared to controls (mixed effects linear model (animal, targeted state), effect of targeting; p = 3.3 × 10−7, control n = 17492 interval pairs, targeted n = 21040 interval pairs). B, Entrainment scores distributions across sessions for control (n = 3, grey) and targeted (n = 5, orange) animals at 8 Hz entrainment frequency (control n = 8012 interval pairs, targeted n = 34184 interval pairs). C, Entrainment scores distributions across sessions for targeted (n = 5, orange) and control (n = 3, grey) animals at 12.5 Hz entrainment frequency. Targeted animals show significant entrainment compared to controls (mixed effects linear model (animal, targeted state), effect of targeting; p = 1.4 × 10−6, control n = 20152 interval pairs, targeted n = 30655 interval pairs). D, Entrainment scores distributions across sessions for control (n = 3, grey) and targeted (n = 2, orange) animals at 20 Hz entrainment frequency. Targeted animals show significant entrainment compared to controls (mixed effects linear model (animal, targeted state), effect of targeting; p = 4.3 × 10−84, control n = 10315 interval pairs, targeted n = 12863 interval pairs).

Accuracy and effects of theta phase–specific stimulation.

A, Stimulus-triggered phase histogram for all linear track targeted animals (mean vector length = 0.4; p < 0.005; target phase = 90; pulse length > 20 ms; number of pulses = 9275). B, Normalized spike rate during optical stimulation in targeted (red, n = 307 neurons) and control (grey, n = 295 neurons) animals during theta phase–specific stimulation (theta phase = 90). For each neuron, spikes were collected within each stimulus event and binned by distance of the animal from the neuron’s place field peak defined from whole-epoch data. Shaded regions are the 95% CI with neuron resampling (see Methods). Note that extra spikes from stimulation are strongly localized to the place field center in targeted animals.

Disruption of short-timescale sequential spiking with preserved place fields in targeted animals.

A, Quantification of normalized multi-unit activity triggered by onset of stimulation pulses shows an increase in spiking ∼10 ms after stimulation onset on the W-track (as in the linear track) in targeted animals. As expected, control animals show a decrease in spiking (stimulation is phase-specific to the ascending phase of theta). Shaded areas are the 95% CI of the mean normalized firing rates in each condition. B, Pairwise temporal offsets between cross-correlograms of putative pyramidal neurons computed in stimulation-on versus stimulation-off intervals in control (n = 9582 pairs, left) and targeted animals (n = 17285 pairs, right). Note, a strong diagonal indicates that the cross-correlation structure is maintained in control animals (as expected). This structure is much less apparent in transfected animals during both stimulation-on and stimulation-off periods. C, Hierarchical bootstrap comparison of R2 values of linear fit, p = 8.6 × 10−4. D, Density plots of short-vs. long-timescale peaks for stimulation-on and stimulation-off periods for all cell pairs pooled across animals and run epochs. Top row: control animals; bottom row: targeted animals. The larger number of pairs for stimulation-on periods in targeted animals reflects a longer experimental period and stimulation driving larger numbers of short-timescale coincident firing events in cell pairs where too few events were detected for inclusion in the stimulation-off periods. E, Hierarchical bootstrap comparisons of R2 values across conditions demonstrating significant differences during both stimulation-on and stimulation-off periods. F, Place field stability for all units across control and targeted animals, measured as the KL divergence of their spatial firing selectivity between stimulation-on and stimulation-off intervals (t-test of distributions of KL divergence between targeted and control animals, p = 0.5). G, Quantification of the spatial extent of non-local representations at the choice point (maximum distance of the posterior ±65 ms around the stimulus) during inbound (IN) and outbound (OUT) task phases on the W-track for targeted (red) and control (grey) animals. Note that both targeted and control animals have a similar extent of non-local spatial representations.

Effects of rhythmic vs. phase-specific stimulation on decoded representations.

A, Power spectrum of the decode-to-animal distance trace for control (left) and targeted (right) animals in stimulation-on (purple) versus stimulation-off (blue) trials during rhythmic stimulation condition on the linear track. Note that the posterior rhythmically represents current and non-local positions at the targeted frequency of 6 Hz. Control animals continue to represent positions at 8 Hz despite the stimulation. This rules out that light flickering has an impact on the hippocampal representation. B, Power spectrum of the decode-to-animal distance trace for control (left) and targeted (right) animals in stimulation-on (purple) versus stimulation-off (blue) trials during rhythmic stimulation condition on the linear track. Note that the posterior rhythmically represents current and non-local positions at the targeted frequency of 8 Hz. C, Power spectrum of the decode-to-animal distance trace for control (left) and targeted (right) animals in stimulation-on (purple) versus stimulation-off (blue) trials during rhythmic stimulation condition on the linear track. Note that the posterior rhythmically represents current and non-local positions at the targeted frequency of 10 Hz. D, Power spectrum of the decode-to-animal distance trace for control (left) and targeted (right) animals in stimulation-on (purple) versus stimulation-off (blue) trials during rhythmic stimulation condition on the linear track. Note that the posterior rhythmically represents current and non-local positions at the targeted frequency of 12.5 Hz. E, Power spectrum of the decode-to-animal distance trace for control (left) and targeted (right) animals in stimulation-on (purple) versus stimulation-off (blue) trials during theta-phase–specific stimulation targeted at the ascending phase of theta (90) on the linear track. Note that the posterior rhythmicity is markedly reduced in targeted animals compared to control animals. F, Power spectrum of the decode-to-animal distance trace for control (left) and targeted (right) animals in stimulation-on (purple) versus stimulation-off (blue) trials during theta-phase–specific stimulation targeted at the ascending phase of theta (90) on the W-track. Note that the posterior rhythmicity is markedly reduced compared to control animals. We also note that the posterior rhythmicity does not recover during control periods on the W-track.

Laser-power dependence of LFP entrainment.

A, Stimulus-triggered LFP in one targeted animal shows a laser power–dependent response during REST periods at 5, 25, 50, and 77 mW laser powers and 1 ms pulse width. B, Stimulus-triggered LFP in one targeted animal shows a laser power–dependent response during RUN periods at 5, 25, 50, and 77 mW laser powers and 1 ms pulse width. C, Stimulus-triggered LFP in one targeted animal at 77 mW laser power and 40 ms pulse width shows complete entrainment during RUN periods.

Data availability

Data will be made publicly available via the Distributed Archives for Neurophysiology Data Integration (DANDI) archive upon publication, and a complete and fully reproducible pipeline for all analyses will also be shared. Code repositories developed in this work are cited throughout the corresponding methods sections for replicability. We prepared this dataset in a commonly accessible and reusable format, meeting the Neurodata Without Borders (NWB) standard (Rübel et al., 2023). In this process, we developed an NWB extension to store metadata for optogenetics experiments, such as virus, fiber, and stimulation protocol details. This extension is designed for public use and is available at https://github.com/rly/ndx-optogenetics. We built upon this extension in our lab’s custom extension (https://github.com/LorenFrankLab/ndx-franklab-novela) to capture additional metadata specific to our lab’s stimulation protocols.

1. We have shared all of the code required to replicate the results and provided a figure panel replication key on the home page [code: https://github.com/LorenFrankLab/ms_stim_analysis/].

2. We will shortly post a link to all of the raw and intermediate data results, as well as a Docker container that permits full replication using Spyglass [https://github.com/LorenFrankLab/spyglass].

Acknowledgements

This work was supported by grants from the Simons Foundation 1189761, 1283731 (Joshi), 542981 (Frank), Life Sciences Research Foundation Fellowship to Joshi, NSF GRFP 1650113 (Comrie), NIH F31MH124366 (Comrie), UCSF Jonas Cohler Discovery Fellowship (Comrie), National Institute of Mental Health grant F30MH126483 (Guidera), National Institutes of Health grant T32GM007618 (Guidera), UCSF Discovery Fellowship (Guidera), and Phi Beta Kappa Graduate Award (Guidera), and funding from the Howard Hughes Medical Institute (Frank). We would like to thank Megan Carey and lab members for fruitful discussions and hosting Joshi during the analysis tenure of the project. We would also like to thank Anna Gillespie for comments on a previous version of the manuscript, Daniel G. for assisting in multi-electrode implant building, Erik H. for assisting in DLC model labeling, Trevor N. for assiting in data collection.

Additional information

Author Contributions Matrix

Funding

Simons Foundation (1189761)

  • Abhilasha Joshi

Simons Foundation (1283731)

  • Abhilasha Joshi

Simons Foundation (542981)

  • Loren M Frank

Life Sciences Research Foundation

  • Abhilasha Joshi

NSF GRFP (1650113)

  • Alison E Comrie

NIH (F31MH124366)

  • Alison E Comrie

UCSF (Jonas Cohler Discovery Fellowship)

  • Alison E Comrie

National Institute of Mental Health (F30MH126483)

  • Jennifer A Guidera

UCSF (Discovery 411 Fellowship)

  • Jennifer A Guidera

Phi Beta Kappa (Graduate Award)

  • Jennifer A Guidera

Howard Hughes Medical Institute

  • Loren M Frank