Cell-Type-Specific Dynamics of Calcium Activity in Cortical Circuits over the Course of Slow-Wave Sleep and Rapid Eye Movement Sleep

Sleep shapes cortical network activity, fostering global homeostatic downregulation of excitability while maintaining or even upregulating excitability in selected networks in a manner that supports memory consolidation. Here, we used two-photon calcium imaging of cortical layer 2/3 neurons in sleeping male mice to examine how these seemingly opposing dynamics are balanced in cortical networks. During slow-wave sleep (SWS) episodes, mean calcium activity of excitatory pyramidal (Pyr) cells decreased. Simultaneously, however, variance in Pyr population calcium activity increased, contradicting the notion of a homogenous downregulation of network activity. Indeed, we identified a subpopulation of Pyr cells distinctly upregulating calcium activity during SWS, which were highly active during sleep spindles known to support mnemonic processing. Rapid eye movement (REM) episodes following SWS were associated with a general downregulation of Pyr cells, including the subpopulation of Pyr cells active during spindles, which persisted into following stages of sleep and wakefulness. Parvalbumin-positive inhibitory interneurons (PV-In) showed an increase in calcium activity during SWS episodes, while activity remained unchanged during REM sleep episodes. This supports the view that downregulation of Pyr calcium activity during SWS results from increased somatic inhibition via PV-In, whereas downregulation during REM sleep is achieved independently of such inhibitory activity. Overall, our findings show that SWS enables upregulation of select cortical circuits (likely those which were involved in mnemonic processing) through a spindle-related process, whereas REM sleep mediates general downregulation, possibly through synaptic re-normalization. SIGNIFICANCE STATEMENT Sleep is thought to globally downregulate cortical excitability and, concurrently, to upregulate synaptic connections in neuron ensembles with newly encoded memory, with upregulation representing a function of sleep spindles. Using in vivo two-photon calcium imaging in combination with surface EEG recordings, we classified cells based on their calcium activity during sleep spindles. Spindle-active pyramidal (Pyr) cells persistently increased calcium activity during slow-wave sleep (SWS) episodes while spindle-inactive cells decreased calcium activity. Subsequent rapid eye movement (REM) sleep episodes profoundly reduced calcium activity in both cell clusters. Results indicate that SWS allows for a spindle-related differential upregulation of ensembles whereas REM sleep functions to globally downregulate networks.


Introduction
In order to efficiently adapt to environmental conditions, the brain needs to accomplish two seemingly opposing tasks. On the one hand, it needs to encode and store relevant information in a long-lasting and stable way. This is assumed to be achieved by the strengthening of synaptic connections among the neurons representing the encoded information, thus increasing excitability of respective neuron ensembles. On the other hand, persisting encoding and storing of new information would saturate the network's limited capacities of encoding and storing which makes necessary processes that globally downregulate activity levels and synaptic connections in a homeostatic manner Cirelli, 2014, 2020). Sleep has been identified as a brain state that might support these two functions in an integrated manner (Klinzing et al., 2019), although the underlying mechanisms are far from being clear. As to synaptic connections, there is ample evidence supporting that sleep serves a global homeostatic process in cortical networks that down-scales and renormalizes synapses that have been strengthened during prior wake phases (de Vivo et al., 2017;Diering et al., 2017;Spano et al., 2019). Both core sleep stages, slow-wave sleep (SWS) and rapid eye movement (REM) sleep possibly contribute to this downregulation. Initially, it was thought to be particularly promoted by the ,1-Hz slow oscillation (SO) as neuronal substrate underlying EEG slow-wave activity (SWA) that hallmarks SWS (Huber et al., 2004). However, based on multiunit firing activity recent findings (Grosmark et al., 2012) suggest that global down-scaling could also be conveyed by the 5-to 10-Hz theta rhythm that originates from septal-hippocampal circuits (Buzsáki, 2002) and is a hallmark of REM sleep. Beyond downregulating cortical activity, sleep is known to promote long-term memory formation and underlying strengthening of synaptic connections (Yang et al., 2014;Sawangjit et al., 2018;Klinzing et al., 2019;Niethard and Born, 2019). Again, both core sleep stages, SWS and REM sleep appear to be implicated in this process. Enhancing SOs during SWS enhances long-term memory formation (Chauvette et al., 2012;Ngo et al., 2013;Kim et al., 2019), although this effect could primarily reflect the driving force of SOs on thalamic spindles (Latchoumane et al., 2017). Spindles are waxing and waning oscillations in the 10-15 Hz range that often nest into the upstate of the SO (Puentes-Mestril et al., 2019;Fernandez and Lüthi, 2020;Oyanedel et al., 2020), and appear to provide optimal conditions for synaptic plastic processes underlying memory formation in cortical microcircuits (Rosanova and Ulrich, 2005;Seibt et al., 2017;Niethard et al., 2018). Finally, there are also studies indicating that memory formation profits from REM sleep and accompanying theta activity (Rasch and Born, 2013;Boyce et al., 2016;Niethard et al., 2017).
Although SWS and REM sleep have been connected to both processes of global downregulation of cortical activity as well as to the selective upregulation of activity and synapses underlying memory formation, little is known about how these sleep stages and associated oscillatory phenomena concurrently establish the two functions in cortical networks. Here, we used in vivo twophoton calcium imaging in mice to assess the temporal calcium activity dynamics in large populations of cortical layer 2/3 cells across episodes of SWS and REM sleep, with the aim to dissociate neuronal subpopulations whose activity is down-scaled or up-scaled during sleep. Two-photon calcium imaging additionally allowed us to differentiate calcium activity changes in the major population of excitatory cells, i.e., pyramidal (Pyr) cells, and the two major populations of inhibitory interneurons, i.e., parvalbumin-positive interneurons (PV-In) and somatostatinpositive interneurons (SOM-In). We found that Pyr cells representing ;80% of cortical neurons, indeed significantly decreased calcium activity in the course of SWS and REM sleep episodes. The decrease during SWS, but not during REM sleep, was accompanied by an increase in calcium activity of PV-In. Importantly, contrasting with the general downregulation of Pyr calcium activity during SWS, a subpopulation of these cells showing highest calcium activity during spindles, upregulated activity in the course of SWS. Surprisingly, these spindle active cells possibly involved in memory formation, also underwent profound downregulation during succeeding REM sleep.

Animals
For the experiments two different strains of transgenic mice, PV-Cre mice (RRID:IMSR_JAX:008069; n = 4) and SOM-Cre mice (RRID: IMSR_JAX:013044; n = 4) were used. All mice were housed in groups of up to five animals under temperature-controlled and humidity-controlled conditions (22 6 2°C; 45-65%) and a 12/12 h light/dark cycle. All recordings started during the first hour of the light phase and only male mice older than eight weeks were recorded. Procedures were the same as described previously (Niethard et al., 2016, and also datasets were from the same mice used in these previous studies. All experiments were approved by the local institutions in charge of animal welfare (Regierungspräsidium Tübingen, State of Baden-Wuerttemberg, Germany).

Surgery
All animals were anesthetized with 0.1 mg/g ketamine and 0.008 mg/g xylazine with a supplement of isoflurane. For topical anesthesia lidocain was applied. Afterwards the animals were mounted on a stereotaxic frame. Body temperature was continuously monitored and maintained at 37°C. A custom-made headpost was glued to the skull and subsequently cemented with dental acrylic (Kulzer Palapress).
Virus injection and the implantation of the imaging window followed headpost implantation. To this end, a craniotomy above the sensorimotor cortex (1.1 mm caudal and 1-1.3 mm lateral from the bregma) with a size of 1.2 Â 2 mm was made. Afterwards, two viruses (AAV2/1-syn-GCaMP6f 2.96 Â 10 12 genomes/ml and AAV2/1-Flex-tdTomato 1.48 Â 10 11 genomes/ml) were injected into multiple sites of the area of craniotomy (10-20 nl/site; 3-5 min/injection). The injection depth was between 130 and 300 mm. Virus injection was followed by the implantation of the imaging window (1 Â 1.5 mm). The space between the skull and the imaging window was filled with agarose (1.5-2%), and then the imaging window was cemented with dental acrylic.
EEG electrodes were implanted on the cortical surface of the contralateral hemisphere relative to the imaging window (À2.5 mm, lateral 12.5 mm from bregma). The reference electrodes were implanted on the brain surface 1 mm relative to l . Two wire electrodes were implanted into the neck muscle for EMG recordings (Science Products). After the surgery, all animals were brought back to their home cage and were single-housed for the rest of the experiments. They had at least 10 d of recovery from surgery before imaging sessions started.
Head fixation procedure After handling the animals 10 min/d for one week, the animal was habituated to the head fixation. Habituation consisted of four sessions per day for one week with increasing fixation durations (30 s, 3 min, 10 min, and 30 min) interleaved by 10-min rest intervals. Habituation was conducted until 24 h before the first imaging session during the early light phase.

EEG and EMG recordings
Sleep stages were identified based on EEG and EMG recordings during the imaging sessions. EEG and EMG signals were amplified, filtered (EEG: 0.01-300 Hz; EMG: 30-300 Hz), and sampled at a rate of 1000 Hz (amplifier: model 15A54; Grass Technologies). Based on EEG/EMG signals for succeeding 10-s epochs, the brain state of the mouse was classified into wake, SWS, and REM sleep stages. Sleep stage classification was supported using the software SleepSign for animals (Kissei Comtech).

Detection of sleep SOs and spindles
For the detection of discrete SO and spindle events during SWS, algorithms were adopted from previous studies (David et al., 2013). In brief, for the detection of SOs, the EEG was bandpass filtered between 0.1 and 4.5 Hz and then, all positive-to-negative zero crossings of the signal as well as the local minimum and maximum between each two successive crossings were marked. Intervals between two succeeding positive-tonegative zero-crossings were identified as a SO event when the length of this interval was between 0.4 and 2 s and when the minimum amplitude and minimum-to-maximum amplitude was .66.6% of the average of the respective amplitude values across the whole recording. For these remaining events the enclosing zero-crossings represent the onset and end of the corresponding SO cycle.
For the detection of spindles, the EEG signal was band pass filtered between 7 and 15 Hz, rectified and, subsequently, all maxima were interpolated to yield the envelope for this frequency band. A spindle event was identified whenever the envelope exceeded an individual threshold for a duration of 0.5-3.0 s, whereby the threshold was defined by the SD of the filtered signal during all SWS episodes of an individual mouse multiplied by a factor of 1.5. Thus, the positive and subsequent negative threshold crossing represented the onset and end of a spindle event, respectively. Previous studies showed that with this criteria larger spindle events are identified that typically occur in parallel in both hemispheres (Oyanedel et al., 2020).
For calculating correlations between measures of EEG activity (power and energy) in the frequency bands of interest (SWA: 0.1-4 Hz, spindle; 7-15 Hz, theta: 4-10 Hz) and DF/F signals of calcium activity, the EEG signals were filtered in the respective frequency bands using a third order Butterworth filter, and the root mean square of the signal was used as power measure. The energy within the respective frequency band was calculated by integrating the root mean square of the filtered signal over the duration of the sleep episode. Changes during a sleep episode in EEG power and DF/F signals, respectively were calculated by subtracting the mean value during the first of the episode from that during the 3rd third of the episode.
To discriminate spindle-active and spindle-inactive cells during each SWS episode, the difference between the mean DF/F signals during the detected spindle events (i.e., the mean signal between spindle onset and offset) and during the remaining periods of the episode (without the detected spindle events) was calculated for each cell. This difference was separately calculated for each individual SWS episode. The top 20% cells with the largest difference between mean DF/F signal during spindles and the corresponding SWS episode were considered as spindle-active cells, whereas the 20% cells with the smallest difference were considered as spindle-inactive. We decided for the 20% criterion to ensure that effects did not derive from an unlabeled interneuron population expected to represent ,10% of all unlabeled cells (Markram et al., 2004;Jiang et al., 2015). Although the criterion is arbitrary to a certain extent, results did not essentially change with less (e.g., 25%) or more stringent criteria (10%). SO-active and SO-inactive cells were defined in an analogous manner, using the difference between DF/F signals during the SO upstate (defined by a 1-s interval beginning with the SO downstate peak) and during the remaining period of the SWS episode without SOs.
Two-photon imaging In vivo imaging was performed using a two-photon microscope based on the MOM system (Sutter) controlled by ScanImage software (Pologruto et al., 2003). The light source was a pulsed Ti:sapphire laser (l = 980 nm; Chameleon; Coherent). Red and green fluorescence photons were collected with an objective lens [Nikon; 16Â; 0.80 numerical aperture (NA)], separated by a 565 nm dichroic mirror (Chroma; 565dcxr) and barrier filters (green: ET525/70 m-2p; red: ET605/70 m-2p), and measured using photomultiplier tubes (Hamamatsu Photonics; H10770PA-40). Imaging frames were visually inspected to exclude cross talk between green and red channels. The imaging frame consisted of 1024 Â 256 pixels, and the frame rate was 5.92 Hz (169 ms per frame). Images were collected in layer 2/3 at a depth of 150-250 mm. All subsequent analyses were performed on the original data or after high-pass prefiltering at 0.1 Hz to eliminate slower changes possibly originating from metabolic and blood flow changes. As both analyses yielded essentially the same results, and also because of the lower sensitivity to changes in blood flow of two-photon imaging, this report is restricted to analyses based on unfiltered two-photon imaging data.

Two-photon image analysis
Lateral motion was corrected in two steps. A cross-correlation-based image alignment (Turboreg) was performed, followed by a line-by-line correction using an algorithm based on a hidden Markov model (Dombeck et al., 2007). Regions of interest (ROIs) containing individual neurons were drawn manually, and the pixel values within each ROI were summed to estimate the fluorescence of this neuron. PV-INs and SOM-INs were manually detected by red fluorescence signal expressed by AAV2/1-Flex-tdtomato. The individual cell traces were calculated as the average pixel intensity within the ROIs for each frame. The cell traces were transformed into the percent signal change (DF/F), in which the baseline for each cell was defined as the 20th percentile value of all frames. Importantly, rather than extracting calcium spikes, we decided to base our analyses on the original fluorescence signal which represents a standard procedure with the advantage that it also covers subthreshold calcium activity of neurons (Cox et al., 2016;Niethard et al., 2016). To confirm that the neuropil signal did not affect our results and to compensate for background noise we performed a standard neuropil subtraction for each cell's fluorescence trace (Cox et al., 2016;. The neuropil signal was estimated for each ROI as the average pixel value within two pixels around the ROI (excluding adjacent cells). The true signal was estimated as F(t) = FinROI À r Â FaroundROI, where r = 0.7.

Statistics
All analyses referred to differences within episodes of a specific brain state (SWS, REM, wake episodes) or between neighboring episodes. DF/F signals of each detected cell were normalized by dividing the signal value by the cell's mean calcium activity during all episodes scored as wakefulness. (Only cell clustering and comparisons of calcium activity during wake episodes themselves was based on non-normalized DF/F signals.) Based on previous work that, like the present study, aimed at characterizing slow trends across the entire duration of SWS and REM sleep episodes (Grosmark et al., 2012), we divided each episode of SWS, REM sleep, and wakefulness into thirds, and averaged calcium activity for each cell during the 1st, 2nd, and 3rd third of each episode. For analyzing the temporal calcium activity dynamics, ANOVAs were performed including the repeated measures factor "1st/3rd third" (representing calcium activity during the first and last third of an episode), and the group factors "SWS/REM" (representing the different sleep stages) and "active/inactive" (representing the cell clusters formed on the basis of different calcium activity levels). ANOVAs run on neighboring SWS episodes contained a repeated measures factor SWS-1/ SWS-2. Significant ANOVA effects were followed by post hoc (twosided) pairwise comparisons using Student's t test and, to account for non-normal distributions, Wilcoxon's sign-rank test. Since both tests revealed essentially the same results, here, we only report results from Wilcoxon's tests. To account for the hierarchical structure of the data, as recorded cells are clustered within animals, we additionally performed mixed effect modeling with random effects for animals, in R using the lme4 package. Model assumptions, i.e., linearity, homogeneity of variance and homoscedasticity were confirmed, and model testing was done by approximating the likelihood ratio test to compare models with and without interaction term. These hierarchical analyses confirmed essentially all ANOVA results reported here and, hence, will not be separately reported. For correlation analyses, Pearson product-moment correlation coefficients were calculated. Respective p values were Bonferroni corrected.

Results
Sleep reduces calcium activity of Pyr cells and simultaneously widens the activity distribution We used in vivo two-photon calcium imaging of layer 2/3 soma of neurons within sensorimotor cortex in PV-Cre or SOM-Cre transgenic mice. To discriminate calcium activity of PV-In and SOM-In, respectively, we injected two different virus types. First, we injected GCaMP6f to express a genetically encoded calcium indicator. Second, for discriminating the interneurons from other cells, we injected a virus expressing tdTomato Cre-dependently (AAV-FLEX-tdTomato). After 10-14 d, almost all neurons around the injection site (;200 mm) expressed GCaMP6f, whereas tdTomato expression was selective for the specific interneuron type. The majority (;80%) of unlabeled cells in this setup consists of Pyr cells; we, therefore, considered this population as putative Pyr cells. Once the GCaMP6f expression was strong enough for sufficient image quality, the animals were habituated to head fixation and then repeatedly recorded during episodes of wakefulness, SWS, and REM sleep. Extended Data Figs. 1-1, 1-2 summarize the mean duration of sleep stage episodes imaged and the total imaging time per session, respectively.
We characterized the calcium activity dynamics of the neuron populations of interest (Pyr, PV-In, SOM-In) during episodes of SWS and REM sleep, by comparing activity during the first and last third of the individual episodes ( Fig.  1). In these analyses, the mean calcium activity of an individual cell during all wake episodes (set to 100%) was used to normalize calcium activity. Pyr cells showed a decrease in calcium activity during both, SWS and REM sleep, from the first to the last third of an episode (p , 0.05; SWS: z = À2.22; REM: z = À2.45). PV-In cells increased their calcium activity in the course of SWS episodes (p , 0.001; z = 2.976), but significantly decreased calcium activity from the first to the last third of REM sleep episodes (p , 0.01; z = À2.65). SOM-In cells showed, opposite to PV-In, significantly decreasing calcium activity during SWS (p , 0.001; z = À6.2) whereas during . C, Wake normalized DF/F calcium signals of Pyr cells during the first (1st) and last (3rd) third of an example SWS and subsequent REM episode. Increasing or decreasing courses for each recorded cell are color coded from red to blue, respectively. D, Mean difference (6SEM) in calcium activity of Pyr, PV-In, and SOM-In from 1st to last third (3rd-1st third) of SWS (left) and REM sleep (right) episodes (ppp , 0.01, pp , 0.05). E, Mean 6 SEM of SDs of calcium activity during 1st and last third of SWS (left) and REM sleep episodes (right) for Pyr (green), PV-In (blue), and SOM-In (ppp , 0.01, pp , 0.05). In all panels, the wake-normalized DF/F calcium signal is indicated (in %) with the signal across all wake episodes set to 100%. Data were recorded from four PV-cre and four SOM-cre animals (for details, see Extended Data Figures 1-1, 1-3).
REM episodes, calcium activity levels remained unchanged (p . 0.85; Extended Data Fig. 1-1). As previously reported (Niethard et al., 2016), calcium activity of Pyr and SOM-In cells was generally higher during SWS than REM sleep, whereas PV-In calcium activity was distinctly higher during REM sleep than SWS.
Changes in calcium activity during SWS neither correlated with SWS episode duration (p . 0.8) nor with SWA energy (i.e., power integrated over time) or changes in SWA during these episodes for any of the three cell types (p . 0.11). Decreases in Pyr calcium activity during REM sleep were the stronger the higher EEG theta energy was during the REM episode (r , À0.25, p , 0.01), and the same held for decreases in PV-In calcium activity over REM episodes (r , À0.37, p , 0.01). Moreover, decreases in Pyr and PV-In calcium activity were the more pronounced the longer the duration was of a REM episode (Pyr: r = À0.35, p , 0.001; PV-In: r = À0.43, p , 0.001).
That Pyr cells, i.e., the major population of cortical neurons, on average, decrease in calcium activity over SWS and REM sleep episodes is consistent with the view that sleep globally downregulates cortical activity (Niethard et al., 2017;Tononi and Cirelli, 2020). However, given that sleep serves twofold functions, to homeostatically downregulate circuit activity but enhance circuits involved memory formation, we hypothesized, that sleep would not equally affect all cells. To test this hypothesis, in a first approach, we compared the SD of the DF/F calcium signal level for the different cell types between the first and last third of SWS and REM sleep episodes. Contrary to an expected statistical regression to the mean, we found that the variability in calcium activity of the Pyr cell population, indeed, robustly increased from the first to the last third of both, SWS and REM sleep episodes (p , 0.01; SWS: z = 4.83; REM: z = 3.86, Fig. 1C). PV-In populations showed increases in variability of the DF/F calcium signal level only during SWS episodes (p , 0.001; z = 3.45), and SOM-In only during REM episodes (p , 0.001; z = 2.97).
Does prior wake activity predict the cell's activity during subsequent sleep? Which neurons do and which do not downregulate activity during sleep? To answer this question, in a first analysis we correlated calcium activity dynamics during wake episodes with that during succeeding sleep episodes, assuming that cells strongly increasing their calcium activity over a wake episode would be implicated in information encoding. We found, particularly for Pyr and PV-In, positive correlations between the change in calcium activity during a wake episode (DF/F calcium signal level during last third minus level during 1st third of a wake episode) and the calcium activity changes during the subsequent SWS episode (Pyr: r = 0.43, p , 0.001; PV-In: r = 0.52, p , 0.001; SOM-In: r = 0.10, p , 0.001; Fig. 2A). Thus, cells showing pronounced increases in calcium activity over a wake episode tend to increase their activity during subsequent SWS and vice versa.
Of note, different correlations were revealed for the mean calcium activity level the cells showed during the prior wake episode. Here, Pyr cells with higher calcium activity during the wake episode displayed greater decreases during subsequent SWS (r = À0.21; p , 0.001; Fig. 2B). Likewise, the comparison of wake-active cells (i.e., the 20% most active cells during the wake episode preceding the respective SWS episode) with wake-inactive cells (lowest 20% of cells) revealed that wake-active Pyr diminished calcium activity in the course of SWS episodes (p , 0.001; z = À4.97), while wake-inactive Pyr did not change their calcium activity (p . 0.18; F = 28.45, p , 0.001, for 1st/3rd Â active/inactive ANOVA interaction, Extended Data Fig. 3-1).

Spindle-active Pyr cells increase calcium activity during SWS
Spindles are well-known to be involved in sleep-dependent memory formation and underlying cortical synaptic plasticity (Puentes-Mestril et al., 2019). We therefore hypothesized that neurons active during spindles are the ones that are spared from downregulation or even show increasing calcium activity during SWS. To discriminate spindle-active and spindle-inactive cells during each SWS episode, the difference between the mean DF/F signals during the detected spindle events (i.e., the mean signal between spindle onset and offset) and during the remaining periods of the episode (without the detected spindle events) was calculated for each cell. This difference was separately calculated for each individual SWS episode. The top 20% cells with the largest difference between mean DF/F signal during spindles and the corresponding SWS episode were considered as spindle-active cells, whereas cells with small calcium activity differences within the lowest 20% were considered spindle-inactive. We then analyzed calcium activity changes across each SWS episode. Indeed, spindle-active Pyr and also spindle-active PV-In cells increased their calcium activity level from the first to the last third of a SWS episode (p , 0.05; Pyr: z = 2.00; PV-In: z = 3.42), while spindle-active SOM-In decreased calcium activity within SWS episodes (p , 0.05, z = À2.01; Fig. 3). A control analysis on the overall population of Pyr cells confirmed that the majority (70%) of Pyr cells that showed a significant increase in calcium activity during a SWS episode (with significance defined here by an increase .1.96 SDs from the mean change in the population) also belonged to the identified population of "spindle-active" Pyr cells. During REM sleep episodes, spindle-active Pyr and PV-In decreased calcium activity (p , 0.001; Pyr: z = À4.15; PV-In: t = À3.63, df =70), while SOM-In changes remained non-significant.
Spindle-inactive Pyr displayed calcium dynamics opposite to those of spindle-active Pyr cells, i.e., they reduced calcium activity during SWS episodes (p , 0.001, z = À5.30). During REM sleep their calcium activity remained unchanged (p . 0.1, z = 1.63; F = 45.17, p , 0.001, for SWS/REM Â Active/inactive ANOVA interaction). Spindle-inactive PV-In did not change calcium activity during SWS episodes (p . 0.4) and increased activity during REM episodes (p , 0.05, z = À2.07). Spindle-inactive SOM-In followed the same activity pattern as spindle-active SOM-In with decreasing calcium activity during SWS (p , 0.001, z = À5.23), and unchanged calcium activity during REM episodes (F = 5.89, p , 0.05, for SWS/REM ANOVA main effect). Supplementary analyses revealed that the observed Significant changes from 1st to last third of SWS and REM episodes are indicated by asterisks (ppp , 0.01, pp , 0.05). B, As in A, but for spindle-active PV-In (upper lines, blue) and SOM-In (pink) and spindle-inactive PV-In and SOM-In (lower blue and pink lines, respectively). C, Mean difference (6SEM) in calcium activity of spindle active (filled bars) and spindle-inactive (empty bars) Pyr, PV-In, and SOM-In from 1st to last third (3rd-1st third) of SWS (left) and REM sleep (right) episodes (ppp , 0.01, pp , 0.05). Note, spindle-active Pyr and PV-In significantly increase calcium activity over SWS episodes and significant decrease over REM sleep episodes whereas wake-active Pyr cells decrease calcium activity during SWS episodes (Extended Data Figure 3-1). D, Time-frequency plots of EEG power (0.1-20 Hz) across all SWS (top) and REM sleep (bottom) episodes. Color code indicates change (in %) in power with reference to the mean power during an episode in the respective frequency. E, Density plots for correlations between calcium activity changes during SWS (3rd-1st third) and changes in the spindle band (7-15 Hz) power for spindle-active (top) and spindleinactive (bottom); r values and significances are indicated (ppp , 0.01). dynamics remained the same when spindleactive and inactive cells were separately clustered according to whether or not the spindle occurred in the presence of a SO. Moreover, we found for all three cell types that, compared with spindleinactive cells, the spindle-active cells also showed increased calcium activity during the immediately preceding wake episode (p , 0.001, Pyr: z = 47.50; PV-In: z = 34.57; SOM-In: z = 20.85).
Both, spindle density and power in the 7-to 15-Hz spindle frequency band significantly increased from the first to the last third of all SWS episodes (p , 0.001; df = 254; t = À5.45; t = À7.27, respectively; Fig. 3D). The increase in spindle band power during SWS correlated with both the parallel increase in calcium activity of spindle-active Pyr cells (r = 0.48; p , 0.001) and with the decrease in calcium activity of spindle-inactive Pyr cells (r = À0.26; p , 0.001; Fig. 3E).

Pyr cells active during SOs show stable calcium activity during SWS
Like spindles, SOs have also been implicated in memory formation (Ngo et al., 2013). However, SOs are also thought to mediate processes of synaptic down-scaling Cirelli, 2014, 2020;González-Rueda et al., 2018). Often, spindles nest into the excitable upstate of the SO. Therefore, to dissociate regulatory functions of SO from those of spindles, here we concentrated on SOs that did not nest spindles. Analog to our approach to spindles, we clustered cells based on their calcium activity during all SO upstates identified in an SWS episode, subtracted by their calcium activity during the remaining time of the SWS episode. The top 20% cells were considered SOactive cells whereas the lowest 20% were considered SO-inactive cells. SO-active Pyr, but not SO-inactive Pyr, cells showed a slight but significant decrease in calcium activity within SWS episodes (p , 0.05, z = À2.38; Fig. 4). As to the interneuron populations, both SO-active and inactive PV-In increased calcium activity during SWS episodes (p , 0.05; active: z = 2.38; inactive: z = 2.20), while SO-active and inactive SOM-In decreased calcium activity during SWS episodes (p , 0.001; active: z = À6.00; inactive: z = À4.26). Over the course of REM episodes, SO-active Pyr and PV-In decreased calcium activity (Pyr: p , 0.001, z = À3.58; F = 8.72, p , 0.05, for 1st/3rd Â active/inactive ANOVA interaction, PV-In: p , 0.001, z = À3.44, F = 6.61, p , 0.05, for 1st/3rd Â active/inactive interaction), whereas SO-active and inactive SOM-In did not express REM-related modulations.
The density of SOs (not nesting spindles) decreased during SWS episodes (p , 0.001; t = 6.47, df = 254), and there was also a parallel decrease in SWA (power in the 0.1-to 4-Hz band) from the first to the last third of SWS episodes (p , 0.001; t = 3.97; df = 254). These decreases were not significantly correlated with the dynamics of any of SO-active and SO-inactive cell populations during SWS.

REM sleep renormalizes calcium activity of spindle-active cells
We found that during REM sleep episodes, spindle-active Pyr as well as the general population of Pyr cells decreased their calcium activity. However, REM sleep also produced an enhanced variance in calcium activity of the general Pyr cell population (Fig.  1), which led us to suspect that the population of spindle-active Pyr might include a subset of cells that is most strongly implicated in memory formation and would, hence, be spared from downregulation during REM sleep . Overall, our analyses did not support this hypothesis. First, variability of calcium activity among spindle-active Pyr did not change from the first to the last third of REM episodes (p . 0.1) consistent with homogenous temporal dynamics in this cell population. Second, comparing the 20% of spindle-active Pyr cells showing the strongest upregulation of calcium activity during the prior SWS episode with those 20% showing the weakest upregulation, did not reveal a differential downregulation of calcium activity between these cell subsets during subsequent REM sleep (p . 0.4, for 1st/3rd Â active/inactive interaction). Finally, assuming that enhanced involvement in spindle-associated Significant changes from 1st to last third of SWS and REM episodes are indicated by asterisks (ppp , 0.01, pp , 0.05). B, As in A, but for SO-active PV-In (upper lines, blue) and SOM-In (pink) and SO-inactive PV-In and SOM-In (lower blue and pink lines, respectively). C, Mean difference (6SEM) in calcium activity of SO-active (filled bars) and SO-inactive (empty bars) Pyr, PV-In, and SOM-In from 1st to last third (3rd-1st third) of SWS (left) and REM sleep (right) episodes (ppp , 0.01, pp , 0.05). memory processing increases the cell's likelihood to escape downregulation during subsequent REM sleep, we tested whether increases in spindle-active Pyr during SWS were followed by diminished decreases or even increases in calcium activity during subsequent REM episodes. However, the respective correlation for spindle-active Pyr was rather low and non-significant (r = 0.04, p . 0.08).
We finally examined whether the downregulation of calcium activity in spindle-active Pyr during REM sleep episodes represents a persistent change that is carried over to the next SWS episode. To this end, we compared DF/F calcium signals of spindle-active and inactive cells between two consecutive SWS episodes (SWS n vs SWS n11 ) which were interrupted by a REM sleep episode. A comparison of calcium activity during the 1st thirds of respective SWS episodes revealed that spindle-active Pyr cells indeed exhibited a strong decrease in calcium activity between these consecutive SWS episodes (p , 0.001, z = 3.98; Fig. 5). No such decrease was observed for spindle-inactive cells (p . 0.34, F = 17.10, p , 0.001, for SWS-1/SWS-2 Â active/inactive interaction), or in a further control comparison with calcium activity during consecutive SWS episodes interrupted by a single wake rather than REM sleep episode (p . 0.08, F = 6.71, p , 0.01, for SWS-1/SWS-2 Â REM/wake ANOVA interaction). Notably, with a REM sleep episode intervening between the SWS episodes, the DF/F signals from spindle-active cells during the second SWS episode fell on average even below the initial level of calcium activity during the preceding wake episode (Fig. 5C). Exploratory analyses over extended periods of consolidated sleep covering at least five consecutive SWS episodes confirmed that calcium activity of spindle-active Pyr remained downregulated at the late, i.e., fifth SWS episode, when the first SWS episode of the sleep period was followed by REM sleep (Extended Data Fig. 5-1). It fact, in the beginning of this fifth SWS episode, levels of calcium activity in spindle active cells were very comparable with those of spindle inactive cells. PV-In spindle-active and inactive cell clusters showed no difference between two consecutive SWS episodes (p . 0.07 for all analyses). Altogether, these data indicate spindle-active Pyr cells that show unique upregulation of calcium activity during SWS episodes, undergo robust downregulation of calcium activity during subsequent REM sleep.

Discussion
We used in vivo calcium imaging of cortical circuits in naturally sleeping mice to dissociate neuronal populations whose calcium activity undergo downregulation across sleep from those which are either not downregulated or even upregulated. We found that during both episodes of SWS and REM sleep, the variability in calcium activity levels increased in the population of excitatory Pyr cells representing the great majority of cortical neurons. This finding supports the view that sleep does not uniformly regulate calcium activity in this cell population. On average, the increase in variability of calcium activity was accompanied by a decrease in Pyr cell calcium activity over the course of both SWS and REM sleep episodes, confirming that sleep globally downregulates cortical network activity. However, in opposition to the average trend, we also identified Pyr cells that were characterized by high calcium activity during sleep spindles, and whose calcium activity distinctly increased over the course of SWS episodes. Because spindles are known to promote synaptic plasticity underlying memory formation (Steriade and Timofeev, 2003;Rosanova and Ulrich, 2005;Seibt et al., 2017;Niethard et al., 2018;Puentes-Mestril et al., 2019;Fernandez and Lüthi, 2020), this finding concurs with the notion that sleep up-scales subpopulations of Pyr cells involved in memory formation. Surprisingly, the same subpopulation of spindle-active Pyr cells underwent profound downregulation of calcium activity during subsequent REM sleep episodes (for a summary of results, see Fig. 6).
Our finding that both SWS and REM sleep episodes produce a robust increase in the variability of calcium activity levels in the Figure 5. REM sleep downregulates calcium activity of spindle-active Pyr cells. Mean 6 SEM wake-normalized DF/F calcium signals of spindle-active (upper traces) and spindle-inactive (lower traces) Pyr cells (A) during a sequences of sleep episodes comprising a SWS episode (SWS n ) followed by a REM sleep episode and another SWS episode (SWS n11 ) and (B) during a control sequences where the two SWS episodes, SWS n and SWS n11 , are interrupted by a single wake episode. Calcium activity is indicated for thirds of the episodes. C, Mean 6 SEM calcium activity in episode sequences containing two succeeding SWS episodes (SWS n and SWS n11 ) episodes that are either interrupted by a REM sleep episode (black bars) or a wake episode (empty bars). Calcium activity levels for the 1st third of the respective episodes are indicated (normalized by subtracting the level during the prior wake episode, ppp , 0.01, pp , 0.05, for pairwise comparisons between conditions). The mean duration of REM and wake episodes, respectively, between SWS n and SWS n11 episodes was 100.95 6 7.74 and 331.48 6 39.22 s. Note, REM sleep intervening between the SWS episodes induces a persisting downregulation of Pyr cell calcium activity continuing into the next SWS episode (SWS n11 ). For analysis of extended periods of consolidated sleep that covered five consecutive SWS episodes (SWS n and SWS n15 ), see Extended Data Figure 5-1.
Pyr cell population contrasts with electrophysiological findings that demonstrate a shrinking rather than widening of firing rate distributions across sleep (Watson et al., 2016;Clawson et al., 2018). A more recent study (Miyawaki et al., 2019) carefully accounting for regression to the mean of firing rates, showed a widening of firing rate distributions across REM sleep, which is consistent with the present findings, but still a shrinking of firing rate distributions across SWS episodes. Specifically, all these studies found that neurons with high firing rates show a strong decrease in spiking activity over the course of SWS, while neurons with low firing rates slightly increase spiking activity. Indeed, this more nuanced understanding was confirmed in the present study when the wake episode preceding the respective episodes of SWS was considered: Pyr cells showing high calcium activity during this wake episode showed a pronounced decrease in calcium activity during the subsequent SWS episodes whereas the wake-inactive cells tended to increase in calcium activity (Extended Data Fig. 3-1). Notably, correlational analyses also showed that Pyr cells whose calcium activity was upregulated over the course of this wake episode were more likely to have upregulated calcium activity during the succeeding SWS episode. In combination, these results can explain the increase in variance of Pyr cell calcium activity levels over the course of SWS, and are in line with the notion of a twofold function of this sleep stage, i.e., on the one hand to homeostatically downregulates activity in a manner that captures cells that were particularly highly active during prior wakefulness and, on the other hand, to protect or even upregulate the activity of Pyr cells that showed dynamic upregulation during prior wakefulness and whose activity might therefore be linked to information encoding.
However, when comparing the present findings based on calcium imaging of large cell populations with previous electrophysiological findings, further factors need to be considered as well. Imaging of calcium activity also measures neurons with very low spiking activity, which are typically missed in electrophysiological recordings (Brecht et al., 2003). Importantly, rather than extracting calcium spikes, we decided to base our analyses on the original fluorescence signal, thus allowing the inclusion of subthreshold calcium activity in neurons which are likely implicated in sleep-dependent downregulation processes (Bartram et al., 2017). This approach is commonly used for studying brain state-dependent changes of calcium activity that develop at a slow pace over several minutes in distinct cortical cell populations (Cox et al., 2016;Oesch et al., 2020). Extracting calcium spikes would not be an optimal approach in these conditions, as the relatively low temporal resolution of the signal leads to distorted spike detection, especially in the presence of burst-like spike activity which typically accompanies spindles (Peyrache et al., 2011;Fernandez and Lüthi, 2020). Another aspect relevant for the comparison of our findings with electrophysiological studies is that cortical activity dynamics can be layer-specific. Whereas here we focus on the calcium activity of layer 2/3 cells, spiking activity has mainly been studied in layer 5 neurons. Finally, our measurement of calcium activity in the cell soma is not an immediate reflection of the neuron's (electrical) spiking activity in terms of action potentials, but rather reflects the integration of spatially extended activity over time with a lower temporal resolution. While our approach provides insights into slow changes of cortical calcium activity during sleep, we were not able to investigate calcium activity or spikes at defined phases of spindle or theta oscillations as this would require distinctly higher sampling rates and a transformed binary signal that allows the unbiased coding of "spikes" occurring in rapid succession (i.e., during bursts).
The mechanisms underlying the average decrease in Pyr cell calcium activity during SWS and REM episodes are unclear but might differ between these sleep stages. For SWS, previous work has linked SWA to down-scaling of synaptic networks (Gulati et al., 2017;González-Rueda et al., 2018;Tononi and Cirelli, 2020). However, in the present study, no consistent correlations were found between measures of SWA and changes in Pyr cell calcium activity over SWS episodes. Rather than a consequence of weakened and decreased synaptic connections, the decrease in calcium activity of excitatory Pyr cells appeared to be a consequence of increased inhibitory inputs to these cells, as PV-In calcium activity distinctly increased over the course of SWS episodes. The increase in calcium activity of PV-In, which effectively inhibit the soma of Pyr cells, could itself account for the downregulation of Pyr cell calcium activity over the course of SWS, negating the need for synaptic re-normalization. On the other side, the decrease in Pyr cell calcium activity during REM sleep episodes, unlike that during SWS, was not accompanied by any increase in calcium activity of the major inhibitory neurons. In fact, calcium activity of PV-In even significantly decreased from the first to the last third of REM episodes, while SOM-In calcium activity remained unchanged. Notably, the decrease in Pyr calcium activity persisted into subsequent SWS episodes. A supplementary analysis on extended periods of consolidated sleep (covering five consecutive SWS episodes) confirmed that Pyr cells identified as spindle-active cells in the initial SWS episode of the sleep period continued to show downregulated low levels of calcium activity even at the late, i.e., fifth SWS episode of this sleep period. In combination, this pattern is consistent both increase their activity. Subsequent REM sleep is accompanied by reduced activity of all cells, indicating a general network downregulation that is dependent on REM theta energy. Therefore, the downregulation of Pyr cells during SWS potentially derives from increased inhibition via PV-In, whereas during REM sleep, PV-In cells also reduce their activity, and thus, their inhibitory input cannot explain the general down regulation here. Note, we arbitrarily defined spindle-active cells by the 20% of the respective total cell population showing highest activity during spindles, with this approach precluding the specification of exact numbers of spindle-active cells. Moreover, the schema does not integrate our findings regarding the dynamics of calcium activity during longer wake episodes that followed a SWS episode and thereby interrupted the ongoing sleep process.
with the view that decreasing levels of Pyr calcium activity during REM sleep are a consequence of synaptic re-normalization, rather than of sleep stage-specific inhibition. However, given that we assessed calcium activity, any conclusion with respect to synaptic changes remains tentative. The REM-sleep related decrease in Pyr cell calcium activity was also positively correlated with EEG theta energy (i.e., theta power integrated over time). Similar evidence suggesting a contribution of theta activity to downregulating network activity has been derived from correlational analyses of hippocampal spike activity across triplets of SWS-REM-SWS episodes (Grosmark et al., 2012). However, evidence for the involvement of theta activity in synaptic down-scaling processes is otherwise scarce and indirect (Poe et al., 2000). Further studies that manipulate REM sleep while directly measuring synaptic strength are needed to establish a causal role of REM sleep in synaptic re-normalization processes.
We identified a subpopulation of Pyr neurons that showed maximal calcium activity during spindles, and which, opposite to the global deactivation across SWS, displayed a substantial increase in calcium activity during SWS. This is a central finding of our study and it supports the idea that during sleep, and SWS in particular, an upregulation occurs in cell assemblies which were specifically involved in prior encoding of information, while network activity is globally downregulated. The upregulation of calcium activity during SWS was specific to spindle-active Pyr and PV-In. It was not seen in wake-active cells or cells most active during the upstate of SOs, both of which exhibited downregulated calcium activity over the course of SWS. In the latter analyses, only SOs that did not nest a spindle were considered, which allowed clear discrimination between the function of spindles compared with that of SOs. Spindles have been shown to promote the formation of memory and underlying synaptic plastic processes, like long-term potentiation (Rosanova and Ulrich, 2005). At the level of cortical microcircuits, they are characterized by increased activity of Pyr cells in the presence of distinctly enhanced somatic inhibition of these cells via PV-In, i.e., a constellation facilitating plastic synaptic changes in response to afferent inputs to the distal dendrites of these cells (Seibt et al., 2017;Niethard et al., 2018). Fittingly, the present study reveals a parallel increase in the calcium activity of spindle-active PV-In over the course of SWS. Moreover, the increase in Pyr cell calcium activity was paralleled by an increase in spindle density across SWS, a phenomenon well-known from previous studies (Dijk et al., 1993). Spindles generated in thalamic networks with thalamo-cortical projections to both PV-In and Pyr (Porter et al., 2001;Schubert et al., 2003) could represent the driving force responsible for upregulating the activity of these circuits during memory processing (Jiang et al., 2017).
Unexpectedly, during REM sleep calcium activity of spindleactive Pyr cells showed dynamics that were very similar to the overall Pyr cell population, i.e., calcium activity of these cells was uniformly downregulated and this downregulation persistently extended into subsequent SWS episodes. In parallel, spindleactive PV-In neurons were also downregulated during REM sleep episodes, while calcium activity levels of spindle-active SOM-In remained unchanged. This pattern is consistent with synaptic re-scaling processes which mediate the persistent downregulation of Pyr cell activity during REM sleep, and concurs with evidence from structural imaging of mice layer 5 Pyr cells which demonstrated that REM sleep prunes postsynaptic dendritic spines that were newly formed during prior motor learning in these neurons (Li et al., 2017). In light of the present data, the Pyr cells with newly formed synapses following motor learning would be expected to constitute the population of spindle-active cells. However, that study also showed that REM sleep simultaneously maintains and strengthens a fraction of the newly formed synapses, which was critical for motor improvement seen after sleep. Diverging from this finding, we were unable to identify a subgroup of spindle-active cells that did not undergo downregulation during REM sleep. There are two feasible explanations. First, it is possible that REM sleep-associated strengthening of synapses might only occur in neurons with synapses that are simultaneously eliminated. In our method, measurement was focused on the soma of Pyr cells, and therefore, data represent the integrated calcium activity of the entire neuron. Synaptic elimination may therefore mask synaptic strengthening in our data. Second, in our study the mice were not trained on a specific learning task before sleep (though it should be considered that sleeping in head-fixed conditions could be aversive and thereby prompt the mouse to encode information whenever it is awake). While this on the one hand could represent a study limitation, on the other hand, it is specifically this lack of learning that may have led to a uniform down-scaling of all newly formed synapses. The latter option suggests the existence of another mechanism beyond spindles that influences, e.g., based on the novelty of the encoded information, whether a newly formed representation is maintained or eliminated during REM sleep (Poe et al., 2000). This is a promising hypothesis that should be tested in future research.