Skip to main content

Data for: Dorsal premammillary projection to periaqueductal gray controls escape vigor from innate and conditioned threats

Cite this dataset

Schuette, Peter et al. (2021). Data for: Dorsal premammillary projection to periaqueductal gray controls escape vigor from innate and conditioned threats [Dataset]. Dryad.


Escape from threats has paramount importance for survival. However, it is unknown if a single circuit controls escape from innate and conditioned threats. The hypothalamic dorsal premammillary nucleus (PMd) may control escape, as it is strongly activated by escape-inducing threats and projects to the region most implicated in escape, the dorsolateral periaqueductal gray (dlPAG). We show that in mice cholecystokinin (cck)-expressing PMd cells are activated during escape, but not other defensive behaviors. PMd-cck ensemble activity can also predict future escape. Furthermore, PMd inhibition decreases escape speed from both innate and conditioned threats. Inhibition of the PMd-cck projection to the dlPAG also decreased escape speed. Lastly, human fMRI data show that a posterior hypothalamic-to-dlPAG pathway increases activity during exposure to aversive images, indicating that a similar pathway may possibly have a related role in humans. Our data identify the PMd as a central node of the escape network.


All procedures conformed to guidelines established by the National Institutes of Health and have been approved by the University of California, Los Angeles Institutional Animal Care and Use Committee or by the University of Sao Paulo Animal Bioethics committee.

Mice. Cck-IRES-Cre mice (Jackson Laboratory stock No. 012706) and wild type C57BL/6J mice (Jackson Laboratory stock No. 000664) were used for all experiments. Male and female mice between 2 and 6 months of age were used in all experiments. Mice were maintained on a 12-hour reverse light-dark cycle with food and water ad libitum. Sample sizes were chosen based on previous behavioral optogenetics studies on defensive behaviors, which typically use 6-15 mice per group. All mice were handled for a minimum of 5 days prior to any behavioral task.

Rats. Male Long-Evans rats (250-400 grams) were obtained from Charles River Laboratories and were individually housed on a standard 12-hour light-dark cycle and given food and water ad libitum. Rats were only used as a predatory stimulus. Rats were handled for several weeks prior to being used and were screened for low aggression to avoid attacks on mice. No attacks on mice were observed in this experiment.

Viral Vectors. All vectors were purchased from Addgene.

Optogenetics:   AAV9.EF1a.DIO.hChR2(H134R)-eYFP.WPRE.hGH, AAV9-EF1a-DIO-eYFP and AAV9-Ef1a-DIO-Arch-GFP.

Chemogenetics: pAAV8-hSyn-DIO-hM4D(Gi)-mCherry and AAV8.Syn.DIO. mCherry

Fiber Photometry AAV9.Syn.GCaMP6s.WPRE.SV40 and AAV9.Syn.FLEX.GCaMP6s.WPRE.SV40

Surgeries. Surgeries were performed as described previously (Adhikari et al., 2015). Eight-week-old mice were anaesthetized with 1.5-3.0% isoflurane and placed in a stereotaxic apparatus (Kopf Instruments). A scalpel was used to open an incision along the midline to expose the skull. After performing a craniotomy, 40 nl of one of the viral vectors listed above at a titer of 2*1012 particles/ml was injected per site (PMd, amv dlPAG) using a 10 μl nanofil syringe (World Precision Instruments) at 0.08 μl/min. The syringe was coupled to a 33-gauge beveled needle, and the bevel was placed to face the anterior side of the animal. The syringe was slowly retracted 20 minutes after the start of the infusion. Mice received unilateral viral infusion and fiber optic cannula implantation. Infusion locations measured as anterior-posterior, medial-lateral and dorso-ventral coordinates from bregma were: dorsolateral periaqueductal gray (dlPAG) (-4.75, -0.45, -1.9), dorsal premammillary nucleus (PMd) (-2.46, -0.5, -5.35) and anteromedial ventral thalamus (amv) (-0.85, -0.5, -3.9). For optogenetic experiments, fiber optic cannula (0.22 NA, 200 μm diameter; Newdoon) were implanted bilaterally 0.15 mm above the viral infusion sites. Only mice with viral expression restricted to the intended targets were used for behavioral assays.

For photometry experiments mice were injected with 0.16 uL at a titer of 3*1012 of AAV9.Syn.Flex.GCaMP6s.WPRE.SV40 in the PMd of cck-cre mice. The same volume and titer of AAV9.Syn.GCaMP6s.WPRE.SV40 was injected into the dlPAG or amv.  Mice were implanted unilaterally with fiberoptic cannulae in the PMd, amv dlPAG. A 400 μm diameter, 0.48 NA optical fiber (Neurophotometrics) was used for photometry experiments. Adhesive cement (C&B metabond; Parkell, Edgewood, NY, USA) and dental cement (Stoelting, Wood Dale, IL, USA) were used to securely attach the fiber optic cannula to the skull. For miniaturized microscope experiments 40 nL of AAV9-DIO-GCaMP6s was injected in the PMd of cck-cre mice and a 7mm GRIN lens was implanted 200 uM above the infusion site. Three weeks following surgery animals were base-plated.

Rat Exposure Assay. Mice were accustomed to handling prior to any behavioral assay. On day 1, mice were habituated to a white rectangular box (70 cm length, 26 cm width, 44 cm height) for 20 minutes. Twenty-four hours later, mice were exposed to the same environment but in the presence of a toy rat for 20 minutes. Mice were then exposed to an adult rat or a toy rat in this environment on the two following days. The rat was secured by a harness tied to one of the walls and could freely ambulate only within a short radius of approximately 20 cm. The mouse was placed near the wall opposite to the rat and freely explored the context for 20 minutes. No separating barrier was placed between the mouse and the rat, allowing for close naturalistic encounters that can induce a variety of robust defensive behaviors.

Contextual Fear Conditioning Test. To better evaluate a broader species-specific defense repertoire in face of a conditioned stimulus, we used a modified version of the standard contextual fear conditioning method (Schuette et al., 2020). Pre-shock, fear conditioning and retrieval sessions were performed in a context (70 cm x 17 cm x 40 cm) with an evenly distributed light intensity of 40 lux and a Coulbourn shock grid (19.5 cm x 17 cm) set at the extreme end of the enclosure. Forty-eight hours after rat exposure, mice were habituated to this context and could freely explore the whole environment for 20 minutes. On the following day, the grid was activated, such that a single 0.7 mA foot shock was delivered for 2 seconds only on the first time the mouse fully entered the grid zone. Twenty-four hours later, retrieval sessions were performed in the same enclosure but without shock. Mice could freely explore the context for 20 minutes during pre-shock habituation, fear conditioning and retrieval sessions.

Behavioral quantification. To extract the pose of freely-behaving mice in the described assays, we implemented DeepLabCut (Nath et al., 2019), an open-source convolutional neural network-based toolbox, to identify mouse nose, ear and tailbase xy-coordinates in each recorded video frame. These coordinates were then used to calculate velocity and position at each timepoint, as well as classify behaviors such as escape runs and freezes in an automated manner using custom Matlab scripts. Specifically:

'Escapes' were defined as epochs for which (1) the mouse speed away from the rat or toy rat exceeded 2 cm/s. As there was little room for acceleration between the rat and opposite wall, the speed threshold was set to this relatively low value.

'Stretch-attend postures' were defined as epochs for which (1) the distance between mouse nose and tailbase exceeded a distance of approximately 1.2 mouse body lengths and (2) mouse tailbase speed fell below 1 cm/s.

'Freezes' were defined as periods for which mouse nose and tailbase speed fell below 0.25 cm/s for at least 0.33s (Schuette et al., 2020).

All behaviors were manually checked by the experimenters for error.

Fiber photometry. Photometry was performed as described in detail previously (Kim et al., 2016). Briefly, we used a 405-nm LED and a 470-nm LED (Thorlabs, M405F1 and M470F1) for the Ca2+-dependent and Ca2+independent isosbestic control measurements. The two LEDs were bandpass filtered (Thorlabs, FB410-10 and FB470-10) and then combined with a 425-nm longpass dichroic mirror (Thorlabs, DMLP425R) and coupled into the microscope using a 495-nm longpass dichroic mirror (Semrock, FF495-Di02-25 ×36). Mice were connected with a branched patch cord (400 μm, Doric Lenses, Quebec, Canada) using a zirconia sleeve to the optical system. The signal was captured at 20 Hz (alternating 405-nm LED and 470-nm LED). To correct for signal artifacts of a non biological origin (i.e. photobleaching and movement artifacts), custom Matlab scripts leveraged the reference signal (405-nm), unaffected by calcium saturation, to isolate and remove these effects from the calcium signal (470-nm).

Fiber Photometry behavior-triggered averaging. To plot the behavior-triggered averages, only mice that displayed a minimum of three behavioral instances were included in the corresponding behavioral figure.

Miniscope video capture. All videos were recorded at 30 frames/sec using a Logitech HD C310 webcam and custom-built head-mounted UCLA miniscope (Cai et al., 2016). Open-source UCLA Miniscope software and hardware ( were used to capture and synchronize neural and behavioral video (Cai et al., 2016).

Miniscope postprocessing. The open-source UCLA miniscope analysis package ( (Aharoni and Hoogland, 2019) was used to motion correct miniscope videos. They were then temporally downsampled by a factor of four and spatially downsampled by a factor of two. The cell activity and footprints were extracted using the open-source package Constrained Nonnegative Matrix Factorization for microEndoscopic data (CNMF-E; (Schuette et al., 2020; Zhou et al., 2018). Only cells whose variance was greater than or equal to 25% of the maximum variance among non-outliers were used in the analysis.

Behavior decoding using PMd neural data. Discrete classification of escape behavior was performed using multinomial logistic regression. Timepoints following escape by 2 seconds were labelled 'escape,' and a matched number of non-escape timepoints were randomly selected for training and validation. Each time point was treated as an individual data point. Training and validation were performed using 5-fold cross-validation, with a minimum of 10 seconds between training and validation sets. As equal numbers of escape and non-escape samples were used to build the training and validation sets, chance accuracy was 50%. Sessions with less than 5 escapes were excluded from the analysis. The same analysis was performed for approach, stretch-attend postures, and freeze. To predict escape at negative time lags from behavior onset, the same analysis procedure was implemented, using 2-second epochs preceding escape by 2, 4, 6, 8 and 10 seconds.

Behavior cell classification. We used a generalized linear model (GLM) to identify cells that showed increased calcium activity during approach, stretch-attend, escape and freeze behaviors. We fit this model to each cell's activity, with behavior indices as the predictor variable and behavior coefficients as the measure of fit. Behavior onset times were then randomized 100 times and a bootstrap distribution built from the resulting GLM coefficients. A cell was considered a behavior-categorized cell if its coefficient exceeded 95% of the bootstrap coefficient values.

Position and speed decoding. To predict position and speed from neural data, these data had their dimensionality reduced by principal component analysis, such that the top principal components, representing at least 80% of the total variance, were used in the following decoding analysis. This output and the related position/speed data were then separated into alternating 60s training and testing blocks, with 10s of separation between blocks. Even blocks were used to train a generalized linear regression model (GLM; Matlab function ‘glmfit’) and withheld odd blocks were used to test the resulting model.  Accuracies of this withheld testing block were reported as mean squared error.

Chemogenetics. Mice used for chemogenetic experiments were exposed to each threat and control stimuli twice, once following treatment with saline and once following treatment with CNO (5 mg/kg, injected intraperitoneally) 40 minutes prior to the experiment. Only one control or threat-exposure assay was performed per day with each mouse.

Behavior video capture. All behavior videos were captured at 30 frames/sec in standard definition (640x480) using a Logitech HD C310 webcam. To capture fiber-photometry synchronized videos, both the calcium signal and behavior were recorded by the same computer using custom Matlab scripts that also collected timestamp values for each calcium sample/behavioral frame. These timestamps were used to precisely align neural activity and behavior.

Light Delivery for optogenetics. For PMd-cck ChR2 mice, blue light was generated by a 473 nm laser (Dragon Lasers, Changchun Jilin, China) at 4.5 mW unless otherwise indicated. Green light was generated by a 532 nm laser (Dragon Lasers), and bilaterally delivered to mice at 10 mW. A Master-8 pulse generator (A.M.P.I., Jerusalem, Israel) was used to drive the blue laser at 20 Hz. This stimulation pattern was used for all ChR2 experiments. The laser output was delivered to the animal via an optical fiber (200 μm core, 0.22 numerical aperture, Doric Lenses, Canada) coupled to the fiberoptic implanted on the animals through a zirconia sleeve.

Immunostaining for cfos. Fixed brains were kept in 30% sucrose at 4oC overnight, and then sectioned on a cryostat (40 µm) slices. Sections were washed in PBS and incubated in a blocking solution (3% normal donkey serum and 0.3% triton-x in PBS) for 1 hour at room temperature. Sections were then incubated at 4oC for 12 hours with polyclonal anti-fos antibody made in rabbit (1/500 dilution) (c-Fos (9F6) Rabbit mAb CAT#2250, Cell Signalling Technology) in blocking solution. Following primary antibody incubation sections were washed in PBS 3 times for 10 minutes, and then incubated with anti-rabbit IgG (H+L) antibody (1/500 dilution) conjugated to Alexa Fluor 594 (red) (CAT# 8889S, for 1 hour at room temperature. Sections were washed in PBS 3 times for 10 minutes, incubated with DAPI (1/50000 dilution in PBS), washed again in PBS and mounted in glass slides using PVA-DABCO (Sigma).

Perfusion and histological verification. Mice were anesthetized with Fatal-Plus and transcardially perfused with phosphate buffered saline followed by a solution of 4% paraformaldehyde. Extracted brains were stored for 12 hs at 4°C in 4% paraformaldehyde. Brains were then placed in sucrose for a minimum of 24 hs. Brains were sectioned in the coronal plane in a cryostat, washed in phosphate buffered saline and mounted on glass slides using PVA-DABCO. Images were acquired using a Keyence BZ-X fluorescence microscope with a 10 or 20X air objective.

Acute brain slice preparation and electrophysiological recordings. Cck-cre driver line mice were injected with AAV9-FLEX-ChR2-YFP in the PMd. Acute slices were prepared from these mie. For electrophysiological measurements, slices were transferred as needed to the recording chamber, where they were perfused with oxygenated aCSF at 32°C. The slices were held in place using a nylon net stretched within a U-shaped platinum wire. Visually-guided whole cell patch clamp recordings were made using infrared differential interference contrast optics. We also verified the identity of PMD neurons by only recording from YFP-positive neurons. All recordings were obtained using a MultiClamp 700B amplifier system (Molecular Devices, Union City, CA). Experiments were controlled by PClamp 10 software running on a PC, and the data were acquired using the Digidata 1440A acquisition system. All recording electrodes (3-8 MΩ) were pulled from thin-walled capillary glass (A-M Systems, Carlsborg, WA) using a Sutter Instruments P97 puller. The patch pipettes were filled with internal solution containing (in mM) 100 K- gluconate, 20 KCl, 4 ATP-Mg, 10 phospho-creatine, 0.3 GTP-Na, and 10 HEPES (in mM) with a pH of 7.3 and osmolarity of 300 mOsm. Only cells with a stable, uncorrected resting membrane potential (RMP) between -50 to -80 mV, overshooting action potentials, and an input resistance (RN) > 100 MW were used. To minimize the influence of voltage-dependent changes on membrane conductances, all cells were studied at a membrane potential near -60 mV (using constant current injection under current clamp mode). To study intrinsic firing properties of PMD neurons, WCRs were conducted under current clamp using the following protocol: (1) Voltage–current (V-I) relations were obtained using 400 ms current steps (range -50 pA to rheobase) and by plotting the plateau voltage deflection against current amplitude. Neuronal input resistance (RN) was determined from the slope of the linear fit of that portion of the V-I plot where the voltage sweeps did not exhibit sags or active conductance. (2) Intrinsic excitability measurements were obtained using 1s current steps (range 0 to 500 pA) and by plotting the number of action potentials fired against current amplitude. (3) Resting membrane potential (RMP) was calculated as the difference between mean membrane potential during the first minute immediately after obtaining whole cell configuration and after withdrawing the electrode from the neuron.

For validating hM4Di in PMd-cck cells, acute brain slices preparation and electrophysiological recordings were performed using standard methods as previously described (Nagai et al., 2019). Briefly, Cck-Cre+ mice that had received AAV microinjections into PMd were deeply anesthetized with isoflurane and decapitated with sharp shears. The brains were placed and sliced in ice-cold modified artificial CSF (aCSF) containing the following (in mM): 194 sucrose, 30 NaCl, 4.5 KCl, 1 MgCl2, 26 NaHCO3, 1.2 NaH2PO4, and 10 D-glucose, saturated with 95% O2 and 5% CO2. A vibratome (DSK-Zero1) was used to cut 300 μm brain sections. The slices were allowed to equilibrate for 30 minutes at 32-34°C in normal aCSF containing (in mM); 124 NaCl, 4.5 KCl, 2 CaCl2, 1 MgCl2, 26 NaHCO3, 1.2 NaH2PO4, and 10 D-glucose continuously bubbled with 95% O2 and 5% CO2. Slices were then stored at 21–23°C in the same buffer until use. All slices were used within 2-6 hours of slicing.

Slices were placed in the recording chamber and continuously perfused with 95% O2 and 5% CO2 bubbled normal aCSF. pCLAMP10.4 software and a Multi-Clamp 700B amplifier was used for electrophysiology (Molecular Devices). Whole-cell patch-clamp recordings were made from neurons in the PMd or dorsolateral PAG (dlPAG) using patch pipettes with a typical resistance of 4–5 MΩ. Neurons were selected based on reporter fluorescence,(mCherry for hM4Di-mCherry). The intracellular solution for recordings comprised the following (in mM) : 135 potassium gluconate, 5 KCl, 0.5 CaCl2, 5 HEPES, 5 EGTA, 2 Mg-ATP and 0.3 Na-GTP, pH 7.3 adjusted with KOH. The initial access resistance values were < 20 MΩ for all cells; if this changed by > 20% the cell was discarded. Light flashes (0.2 mW/mm2) from a blue LED light source (Sutter Instruments) were delivered via the microscope optics and a 40x water immersion objective lens and controlled remotely using TTL pulses from Clampex. Cell responses were recorded in whole-cell mode and recorded using an Axopatch 700B amplifier connected via a digitizer to a computer with pCLAMP10 software. To stimulate ChR2 expressed in PMd neurons or axons, 5 ms pulses were delivered at inter-pulse intervals of 200 ms, 50 ms or 25 ms for 5, 20 or 40 Hz optical stimulations, respectively.

Functional Magnetic Resonance Imaging (fMRI) methods

Participants. This study included 48 adult participants (mean ± SD age: 25.1 ± 7.1; 27 male, 21 female; 7 left-handed; 40 white and 8 non-white (1 Hispanic, 5 Asian, 1 Black and 1 American Indian)). All participants were healthy, with normal or corrected to normal vision and normal hearing, and with no history of psychiatric, physiological or pain disorders and neurological conditions, no current pain symptoms and no MRI contraindications. Eligibility was assessed with a general health questionnaire, a pain safety screening form and an MRI safety screening form. Participants were recruited from the Boulder/Denver Metro Area. The institutional review board of the University of Colorado Boulder approved the study, and all participants provided written informed consent.

Experimental Paradigm. Participants received five different types of aversive stimulation (mechanical pain, thermal pain, aversive auditory, aversive visual, and pleasant visual), each at four stimulus intensities. 24 stimuli of each type (6 per intensity) were presented over six fMRI runs in random order. Following stimulation on each trial, participants made behavioral ratings of their subjective experience. Participants were instructed to answer the question ‘How much do you want to avoid this experience in the future?’. Ratings were made with a non-linear visual analog rating scale, with anchors ‘Not at all’ and ‘Most’ displayed at the ends of the scale.

Stimuli. Visual stimulation was administered on the MRI screen and included normed images from the International Affective Picture System (IAPS) database (Lang et al., 2008). To induce four ‘stimulus intensity levels’ we selected four groups of 7 images based on their   normed aversiveness ratings (averaged across male and female raters) available in the IAPS database and confirmed by N = 10 lab members (5 male, 5 female) in response to ‘How aversive is this image? 1-100’. Selected images included photographs of animals (n=7), bodily illness and injury (n=12), industrial and human waste (n=9). Four stimulus levels were delivered to participants for 10 sec each.

MRI data acquisition and preprocessing.

Whole-brain fMRI data were acquired on a 3T Siemens MAGNETOM Prisma Fit MRI scanner at the Intermountain Neuroimaging Consortium facility at the University of Colorado, Boulder. Structural images were acquired using high-resolution T1 spoiled gradient recall images (SPGR) for anatomical localization and warping to standard MNI space. Functional images were acquired with a multiband EPI sequence (TR = 460 ms, TE = 27.2 ms, field of view = 220 mm, multiband acceleration factor = 8, flip angle = 44°, 64 × 64 image matrix, 2.7 mm isotropic voxels, 56 interleaved slices, phase encoding posterior >> anterior). Six runs of 7.17 mins duration (934 total measurements) were acquired. Stimulus presentation and behavioral data acquisition were controlled using Psychtoolbox.

FMRI data were preprocessed using an automated pipeline implemented by the Mind Research Network, Albuquerque, NM. Briefly, the preprocessing steps included: distortion correction using FSL’s top-up tool (, motion correction (affine alignment of first EPI volume (reference image) to T1, followed by affine alignment of all EPI volumes to the reference image and estimation of the motion parameter file (sepi_vr_motion.1D, AFNI,, spatial normalization via subject’s T1 image (T1 normalization to MNI space (nonlinear transform), normalization of EPI image to MNI space (3dNWarpApply, AFNI,, interpolation to 2 mm isotropic voxels and smoothing with a 6 mm FWHM kernel (SPM 8,

Prior to first level (within-subject) analysis, we removed the first four volumes to allow for image intensity stabilization. We also identified image-wise outliers by computing both the mean and the standard deviation (across voxels) of intensity values for each image for all slices to remove intermittent gradient and severe motion-related artifacts (spikes) that are present to some degree in all fMRI data.

fMRI data analysis. Data were analyzed using SPM12 ( and custom MATLAB (The MathWorks, Inc., Natick, MA) code available from the authors’ website ( First-level general linear model (GLM) analyses were conducted in SPM12. The six runs were concatenated for each subject. Boxcar regressors, convolved with the canonical hemodynamic response function, were constructed to model periods for the 10-second stimulation and 4-7 second rating periods. The fixation cross epoch was used as an implicit baseline. A high-pass filter of 0.008 Hz was applied. Nuisance variables included (a) “dummy” regressors coding for each run (intercept for each run); (b) linear drift across time within each run; (c) the six estimated head movement parameters (x, y, z, roll, pitch, and yaw), their mean-centered squares, their derivatives, and squared derivative for each run (total 24 columns); and (d) motion outliers (spikes) identified in the previous step. A “single-trial model” was used to uniquely estimate the response to every stimulus in order to assess functional connectivity.

Functional connectivity analysis. Functional connectivity between the hypothalamus and PAG was estimated using Partial Least Squares (PLS) (Wold et al., 2001) regression, which identifies latent multivariate patterns that maximize the covariance between two blocks of data (i.e., BOLD activity in hypothalamus and PAG voxels). Here, data comprised single trial estimates of brain activation in response to aversive thermal, mechanical, auditory, and visual stimuli, in addition to a set of pleasant visual stimuli which were used as a control. For the PLS model, the predictor block of variables included all voxels in an anatomically defined mask of the hypothalamus (Pauli et al., 2018) (337 voxels) and the outcome block included all voxels in the PAG (Kragel et al., 2019) (42 voxels). Localization of the hypothalamus signal that covaries with the PAG responses was performed by bootstrapping the PLS regression and examining the distribution of PLS regression coefficients and their deviation from zero (using normal approximation for inference). Hyperalignment of fMRI data (Haxby et al., 2011) was conducted separately for each region as a preprocessing step, and leave-one-subject-out cross-validation was performed to estimate the strength of functional connections (i.e., the Pearson correlation between the first ‘X score’ and ‘Y score’ estimated by PLS, similar to the canonical correlation (Hardoon et al., 2004).

A benefit of the pathway-identification model we employed is that it can, in principle, identify HTH and PAG patterns that distinctly participate in the HTH-PAG pathway. For example, the central nucleus of the amygdala (CeA) projects to both the hypothalamus and the PAG (Kim et al., 2013), and could indirectly explain variation in BOLD signals in the PAG. To test pathway specificity, we separately modeled a pathway between the CeA and the PAG using the approach described above. This allowed us to evaluate how much variation in PAG activity the HTH-PAG pathway explained above and beyond the CeA-PAG pathway. To evaluate this, we computed the partial correlation between latent sources in the hypothalamus and PAG, controlling for the latent source in the CeA.

Statistics. Nonparametric Wilcoxon signed-rank or rank-sum tests were used, unless otherwise stated. Two-tailed tests were used throughout with α=0.05. Asterisks in the Figures indicate the p values. Standard error of the mean was plotted in each Figure as an estimate of variation. Multiple comparisons were adjusted with the false discovery rate (FDR) method.

Usage notes

Explanation of variables used:

'Tracking.mat' is a struct containing the DeepLabCut output and related behavioral metrics.  

'good_neurons.mat' is a logical vector indicating which neurons were used in the analysis, based on variance thresholding (see Methods > Miniscope postprocessing).

Fiber photometry-specific

The workspace entitled "Tracking_Behavior_Synced_x.mat" contains the synchronized fiber photometry signal and related tracking and behavioral output:

"sig_norm_sync" is the neural data.

All variables followed by "...TS" have been synced with this neural data, including tracking and categorized behaviors.


'BehaviorMS.mat' is a workspace that contains all the categorized behaviors for miniscope datasets:

'behaviorNameFrameMS' is a # behaviors x 2 matrix.  Column 1 is the in point and column 2 is the out point.

'behaviorNameIndicesMS' is a logical vector whose length matches the number of neural samples. '1' = behavior detected, '0' = behavior not detected.

'output_CNMF-E.mat' is a workspace containing the CNMF-E output. Most important is:

'neuron.C_raw' is the struct field containing the extracted putative neural traces used in the analysis.

When a field from the Tracking.mat file ends in "...MS", it has been synchronized with the miniscope neural output.


'Behavior.mat' workspaces contain all classified behaviors:

'behaviorStart' is all the start points for a given behavior. Likewise, 'behaviorEnd' is all the end points for a given behavior.

'behaviorIndices' is a logical vector of whether or not a behavior was categorized for a given sample.


The data file 'MPA_data_pHythal_PAG.mat' contains the following variables:
CeM: a mask of the central amygdala from the SPM Anatomy toolbox -
PAG: a mask of the PAG from Kragel et al. 2019 -
hythal: a mask of the hypothalamus from the CIT168 Atlas -
mask: a combined mask of these regions
masked_dat: a CANLab data object for the single-trial estimates of fMRI activation within the above regions
S: a vector denoting subject number for each trial
VAL: a vector denoting the valence of the stimulus for each trial
COND: a vector denoting the condition (stimulus modality) for each trial