a, Distribution of preferred phase of gamma oscillation (30–80 Hz) during maze running (RUN) and REM sleep, shown separately for REM-shifting and non-shifting neurons. Note that both groups fired preferentially at the trough of local gamma waves (~180°) during REM sleep, whereas the majority of REM-shifting neurons were phase-locked to the rising phase (gammaR) of the gamma cycle during RUN. The reference site for LFP gamma was the middle of the pyramidal layer (site 0 in Fig. 1). Two gamma cycles are shown for better visibility. Top gray traces, idealized reference gamma cycle in CA1 pyramidal layer. b, c, Modulation of pyramidal cells by both gamma and theta. Note that most gamma-modulated neurons during REM are non-shifting neurons (b, light blue) and most gammaR neurons during RUN belong to the REM-shifting group (c, magenta). The side histograms in b and c (right) are the same as the plots in a. Only neurons, which were significantly modulated by both theta and gamma oscillations are included in the plots of b and c.