Top, decoded trajectories for 100 example sweeps from one example grid module (same decoding method as in a ), coloured according to whether the previous decoded direction pointed to the right (blue) or left (red). Because spatial representations are decoupled from physical movement during sleep, sweep trajectories are referenced to the low-pass-filtered decoded trajectory (smoothed with a 100 ms gaussian kernel) and aligned to a virtual head direction (low-pass-filtered decoded direction). Individual sweeps are plotted as separate lines. Bottom, averaged sweeps across brain states for all 18 grid modules of all 9 animals. Sweeps were referenced, rotated and sorted as in the top panel, normalized by the spacing of the grid module, and then averaged across all theta cycles. Each pair of red and blue lines corresponds to one module.