Strange IndiaStrange India


Experiments involved a total of 20 adult male Egyptian fruit bats (Rousettus aegyptiacus; weight, around 150–190 g), in eight of which neural data were collected. The bats were distributed as follows: behaviour, five bats (social group 1), five bats (social group 2), two bats (object experiments); and neural recordings, five bats were implanted with a four-tetrode microdrive (three took part in foraging with social groups 1 and 2; two involved in the object experiment) and three additional bats were implanted with a miniaturized microscope (foraging with social groups 1 and 2). Experiments comprised 10–20 daily foraging sessions involving a group of 5–7 bats (social groups plus one or two implanted animals; the composition of the main electrophysiology datasets is shown in Extended Data Fig. 2a) or a group of three bats and a moving object. All of the animals were housed in humidity- and temperature-controlled rooms. Before the start of the experiments and between experimental epochs, the non-implanted animals were housed in a communal laboratory male colony. During the experimental period, the animals were housed in a separate housing room together with other bats. Non-implanted animals were housed in large cages, one for each social group. Implanted animals were initially single housed and subsequently, after recovery from surgery, co-housed in the large cages with the other bats. The lights in the housing room were maintained on a 12 h–12 h reverse light cycle (lights off–lights on, 07:00–19:00). All experiments were performed at the same time of day during their awake hours (dark cycle). All experimental procedures were approved by the Institutional Animal Care and Use Committee of the University of California, Berkeley.

Collective behavioural set-up

All of the experiments were performed in an acoustically, electrically and radio-frequency-shielded room (5.6 m × 5.2 m × 2.5 m) with high-precision lighting control48, under uniform illumination (luminance level 5 lux), allowing animals to use both proximal (touch, olfaction) as well as distal (vision, audition) sensory cues. To minimize acoustic reverberation and dampen noise from the outside, the flight room ceiling and walls were covered with acoustic foam. An additional layer of acoustically absorbing black felt was used to protect the acoustic foam from being damaged by the bats while maintaining the intended acoustic environment. The flight room floor was also covered with the same acoustically absorbing black felt. The 3D spatial position of all of the animals was recorded using a modified version of a commercial RTLS (Ciholas). The system was composed of mobile tags (DWTAG100) that were identified and localized at a 100 Hz sampling rate by 16 static anchors (DWETH101), providing reference locations for the system (the arrangement of the anchors is shown in Extended Data Fig. 1b). Anchors and tags communicated through ultra-wideband pulses. One additional anchor (custom DWETH101) was used to record an external synchronization signal (see below). Tags were made of a lightweight (~2.9 g) transceiver and a LiPo battery, mounted onto custom made collars (~15 g total). A 16-bit three-axis accelerometer was included in the tag and could provide acceleration data at 100 Hz. The system communicated with a computer located outside the room through User Datagram Protocol (UDP) and was configured and operated through a web-based user interface running on Ubuntu v.18.04 Bionic. Data were recorded and saved using custom written scripts in Python v.3.9. The spatial resolution of the system was measured on a subset of the experiments by simultaneously tracking one or two bats with the RTLS, together with a highly precise camera-based system (Motion Analysis24,25,48) and was in the range of 10–20 cm (Extended Data Fig. 1c,d). For both electrophysiology and imaging, collective spatial experiments consisted of one of two types, each one permanently associated with a separate baseline group of five bats (social group 1 or 2) and differing only by the food source (bowl or feeders, see below). Implanted bats were added to the baseline groups after recovery from surgery. All of the bats were mildly food-restricted (>85% of their baseline weight) before the group sessions and often actively participated in the foraging experiment even when at their full weight, suggesting that food was not the main driver behind the active participation. In the case of bowl foraging (social group 1), a bowl or a plate of banana pieces was located close to the centre of the room, around 0.5 m from the ground, and the bats could spontaneously collect banana pieces from it. The bowl was typically filled with 60–100 g of banana and was occasionally replenished in the middle of a session. In the case of feeder-foraging (social group 2), four automated feeders placed on the wall at one end of the room dispensed a pureed fruit reward, as described previously24,25,48. A reward was triggered when a bat landed on the feeding platform and interrupted an infrared beam break sensor mounted in front on the reward port. Feeders were all independently controlled by an Arduino (Uno Rev3) and Adafruit Motorshield (1438; Adafruit) interfaced with a computer outside the experimental room. To encourage the bats to leave the feeders after the collection of food, we disabled a feeder after a bat triggered it. The next feed could be triggered by a different bat landing on the same feeder or by the same bat, after leaving the feeder and coming back (crossing a virtual barrier located 0.7 m from the feeders). We also carried out experiments involving a moving object that were similar to those described above with two main differences: (1) they involved three bats foraging from one single feeder (two of which were implanted with a tetrode microdrive); (2) they involved an object (a Styrofoam ball, 20 cm diameter; Extended Data Fig. 8a) that could be moved from outside the room using a cableway system and a pulley. The object was moved between two locations that the bats most often occupied: one close to a resting site (perch) and the other close to the feeder. To create a dynamic context, the ball was moved every 10–15 min between these two locations and some false starts and sudden movements of it were occasionally presented. Bats sporadically landed on the ball and often touched it around landing with the tip of their wings. The position and identity of each bat (and also of the object) were constantly monitored through the RTLS, interfacing with custom MATLAB scripts controlling the feeders. Foraging sessions lasted between 60 and 150 min and started with all of the non-implanted bats released from a small cage close to the entrance of the flight room. When implanted bats participated in the experiment, the group foraging session was flanked by two rest sessions, lasting 5–10 min, in which the implanted bats were kept—each one isolated—in a small cage (25 cm × 32 cm × 46 cm) within an opaque enclosure (40 cm × 46 cm × 65 cm) inside the flight room. Implanted bats were released from the small cage at the beginning of the foraging session, immediately after releasing the non-implanted bats. Neural activity was recorded during both group behaviour and rest sessions. Periodic clock pulses generated by a Master-9 device (A.M.P.I.) were used to create a timing signature that served as a common frame of reference for all of the recording systems (tracking, neural recordings and audio, see below).

Microdrive implant procedure

Surgical procedures for electrophysiology implants were performed similarly to those described previously for Egyptian fruit bats23,24,49. A lightweight four-tetrode microdrive (Harlan 4 drive; Neuralynx) was implanted over the right hemisphere of each bat. Tetrodes were made of four strands of platinum-iridium wire (17.8 µm diameter, HML-insulated) and assembled as described previously24. Each of the four tetrodes was loaded into a telescoped assembly of polyamide tubes mounted into the microdrive and was individually moveable (~5 mm travel). On the day before surgery, the tip of each tetrode was cut flat and plated with Gold Plating Solution (Neuralynx) to reduce the impedance of individual wires to 0.2–0.5 MΩ. On the day of the surgery, anaesthesia was induced using an injectable cocktail of ketamine, dexmedetomidine and midazolam. The bat was then placed in a stereotaxic apparatus (Model 942; Kopf) and anaesthesia was maintained throughout surgery by injections (around once per hour) of an anaesthesia maintenance cocktail of dexmedetomidine, midazolam and fentanyl. The depth of anaesthesia was continuously monitored by testing toe pinch reflexes and measuring the bat’s breathing rate. The bat’s body temperature was measured using a rectal temperature probe and kept at approximately 35 °C through a regulated heating pad. After verification of effective anaesthesia, the skull was exposed, cleaned and the surrounding skin and tissue were retracted. During surgery, before placing the microdrive, the skull was scored to improve adhesion and mechanical stability. A bone screw (19010-00; FST), with a short piece of stainless-steel wire (0.008 inch, PFA-coated; A-M Systems) soldered to the screw head, was inserted into the skull in the frontal plate, and served as ground. Four additional bone screws (M1.59 × 2 mm, stainless steel) were placed into the skull for mechanical stability of the implant. A circular craniotomy of 2 mm was made in the skull above the hippocampus over the right hemisphere at 7 mm anterior to the transverse sinus that runs between the posterior part of the cortex and the cerebellum and 3.2 mm lateral to the midline. The craniotomy was covered with a biocompatible elastomer (Kwik-Sil; World Precision Instruments) until the microdrive was implanted. The skull and the base of the screws were covered with a thin layer of bone cement (C&B Metabond). Next, after removing the Kwik-Sil from the craniotomy and performing a durotomy, the microdrive was slowly lowered, with fully retracted tetrodes, to create a tight seal and the remaining exposed brain was covered with Kwik-Sil. Dental acrylic was applied to secure the microdrive to the screws and the skull. A ground wire from the microdrive was connected to the wire from the ground screw and covered with dental acrylic as well. All four tetrodes were initially positioned at approximately 800 µm below the cortical surface at the end of the surgery. Finally, the analgesic meloxicam (Metacam; Boehringer Ingelheim) was administered to the bat after surgery. Analgesics (3 days) and antibiotics (7 days) were administered daily after surgery, until complete recovery.

Electrophysiology data acquisition, preprocessing and spike sorting

After surgery, tetrodes were lowered in small daily increments over a period of 1–2 weeks towards the pyramidal layer of the dorsal hippocampus (CA1 and CA2). The pyramidal cell layer was tentatively determined by the presence of high frequency ripples in the local field potential, concomitant with a transient (50–100 ms) increase in multiunit activity. All adjustments of the tetrodes were done while the bat was swaddled in a small fabric bag: neural activity from the tetrodes was monitored daily by connecting the bats’ microdrive to a wired recording system (Digital Lynx; Neuralynx) before the beginning of the experiments and after their completion. At the end of each recording session, one or more tetrodes were typically moved (20–160 µm) to sample—on the next day—from a different group of neurons, while ensuring maximal time for stabilization of the tissue. Tetrode positions were later verified histologically (see below). To record neural activity in freely flying bats, we used a wireless neural data-logging system (neural-logger; MouseLog16, vertical version, Deuteron Technologies). The logger was housed in a custom-designed 3D-printed case, together with the RTLS tag and two LiPo batteries (one for the logger and one for the RTLS tag; minimal duration, 150 min) and connected to the electrical interface board of the microdrive at the beginning of each recording. The whole system weighed around 15–17 g. Implanted bats used in our experiment weighed more than 150 g and could fly normally while equipped with the neural-loggers, as expected from previous experiments using wireless recording systems9. Electrical signals from the four tetrodes (16 channels) were amplified (200×), bandpass filtered (1–7,000 Hz), sampled continuously at a frequency of 29.34 kHz and stored on a SD card memory on the logger, with a voltage resolution of 3.3 µV. Wireless communication between the neural-logger and a static transceiver ensured proper synchronization and allowed basic monitoring and configuration through software (Deuteron Technologies). At the end of the recording session, data were extracted from the logger and saved. Spike sorting was performed as described previously9,24. In brief, recorded voltage traces were filtered (600–6,000 Hz) and putative spikes were detected by thresholding (3 s.d.) the filtered trace. Putative spike waveforms (32 samples, peak at the eighth sample) were used as input for the cluster sorting software (SpikeSort 3D, Neuralynx). Spike amplitude and energy were used as features for manual sorting. Unstable units, with visible drift in spike amplitude, and units coming from tetrodes that did not exhibit ripples in the local field potential, after careful evaluation of the whole session voltage traces, were discarded from the analysis. Only for the comparison between CA1 and CA2 (ref. 50) (Extended Data Table 1), units were classified as putative principal cells and putative interneurons based on spike width and average firing frequency, using similar criteria adopted from the hippocampus of rodents and bats34,51 (putative interneurons: average spike width < 0.4 ms or average firing frequency > 5 Hz, 11% of the recorded cells). Consistent with similar recordings from the hippocampus of rodents and bats, putative principal cells typically corresponded to elongated clusters in feature space and bimodal inter-spike-interval distributions, whereas putative interneurons corresponded to more symmetric clusters and unimodal inter-spike-interval distributions. A total of 373 well-isolated single units were recorded from the dorsal hippocampus of five bats (177 from experiments involving social group 1, and 77 from experiments involving social group 2 and 119 from the object experiment).

Microscope description and implant procedure

The microscope used for wireless calcium imaging was similar to those described previously for Egyptian fruit bats25. In brief, the microscope is made of 3D-printed material (black resin; Formlabs) combined with commercially available optical and electrical components52 and assembled in our laboratory. Design files, part numbers and software are publicly available at GitHub ( and Excitation light is emitted by a blue LED (470 nm peak; LUXEON Rebel) and collimated by a drum lens (45-549, Edmund Optics), before passing through the excitation filter (3.5 mm × 4 mm × 1 mm, ET470/40x; Chroma) and a dichroic mirror (4 mm × 6 mm × 1 mm, T495lpxr, Chroma). A gradient refractive index (GRIN) objective lens (GT-IFRL-200-inf-50-NC, GRINTECH) focuses the excitation light on the sample (0.5 NA). Fluorescence collected by the objective is transmitted through the dichroic mirror, an emission filter (4 mm × 4 mm × 1 mm, ET525/50m, Chroma) and focused by an achromatic doublet lens (45-206, Edmund Optics) onto an analogue CMOS sensor (MB001; 3rd Eye CCTV), acquiring at 30 Hz frame rate and 640 × 480 pixels. Frames can be streamed through a wireless transmitter–receiver couple (TX24019, 100 mW) and the entire system (LED, CMOS and transmitter) is powered by a lightweight consumer-grade 3.7 V, 300 mAh lithium polymer battery, which provided stable recording for about an hour at average imaging LED intensities (less than 100 µW post-objective power). The system is compatible with simultaneous streaming from multiple microscopes by using different carrier frequencies. The NTSC video and a synchronization signal (generated by the Master9, see above) were both digitized through a USB frame grabber and acquired using custom software52. The USB frame grabber was enclosed within a custom-made data acquisition box (DAQ) that could be connected to the receiver or directly to the microscope through a cable.

Surgical procedures were performed similarly to those described previously for Egyptian fruit bats25 and involved injection and implant surgery. Expression of the Ca-indicator GCaMP6f was mediated by pAAV9.hSyn.GCaMP6f.WPRE.SV40 (Addgene), injected into the dorsal hippocampus. In brief, following the same procedures for anaesthesia, analgesia and skull preparation described in the ‘Microdrive implant procedure’ section above, 1.25 μl of virus was injected at a rate of 4 nl s−1 above the desired coordinates (5.8, 2.8 and 2.6 mm in one bat (CA1) or 6.8, 3.2 and 2.8 mm in two bats (CA1–CA2), anterior to the transverse sinus, lateral to the midline and depth). The injection opening in the skull was filled with Kwik-Sil and the tissue was closed with sutures. Then, 4 weeks after the injection, implant surgery of a 1.8 mm diameter GRIN relay lens (130-004836, Inscopix) was performed according to the procedure described previously for Egyptian fruit bats25. The cortex above the dorsal hippocampus was aspirated using a vacuum pump attached to a 30 GA blunt needle. Sterile lactated ringer solution along with pressure from an absorbable sponge (Gelfoam, Pfizer) was applied to the brain to prevent bleeding during the aspiration. Aspiration continued slowly until the parallel fibres of the hippocampal oriens were visually identified. Before surgery, the relay lens was glued to the microscope through small bridges of light-cured flowable composite (Flow-It ALC, Pentron). The lens + microscope system was then slowly lowered, while imaging from it, until clear evidence of fluorescence from the target hippocampal region was observed, typically at about 100–200 µm from the tip of the lens to the dorsal surface of the hippocampus. Kwik-Sil was applied to seal the space between the lens and the edges of the craniotomy and carbon powder mixed with dental acrylic was applied around the surface of the skull and above the bone screws to hold the implanted lens in place. The glue bridges were carefully broken to separate the relay lens from the microscope, and the exposed surface of the relay lens was covered with Kwik-Sil while the bat recovered. Next, 2–3 weeks after lens implantation, the miniaturized microscope was aligned with the relay lens under anaesthesia as described previously25 and cemented in place. A custom 3D-printed protective housing case ensured protection from damage.

Imaging data acquisition and ROI extraction

Wireless imaging videos were acquired through a custom made DAQ connected to a wireless receiver, communicating with a transmitter on the bat’s microscope. The transmitter, battery and tracking tag (see above) were all enclosed in a custom 3D-printed flight case. For each imaged bat, two DAQs simultaneously acquired the streamed frames to minimize streaming artifacts that depend on the relative position between transmitter and receiver. Artifacts typically impacted a small fraction of the frames of one receiver (mean, 1.43%) and rarely affected both receivers, provided that they were located in different positions. We recovered most of the artefactual frames by substituting them with their intact counterpart from the alternative receiver (see below). Raw videos (640 × 480 pixels) were acquired at 30 Hz and then spatially downsampled by a factor of two and temporally downsampled at 10 Hz. Preprocessing was performed using custom scripts in ImageJ (v.1.53c)53 and involved artifact detection and recovery, background compensation, motion correction, median filtering and spatial downsampling. In brief, one of the two acquired videos was selected as main (always from the same default DAQ) and the other as a backup; streaming artifacts from the main video were detected by a threshold criterion and impacted frames were substituted with the corresponding frames from the backup video. Next, large-scale background fluctuations were compensated by subtracting to each frame its gaussian filtered version (σ = 80 pixels) and rigid motion correction was performed (MOCO54). Temporal median filtering was applied (3 frames) and residual artifacts (mean, 0.13%), typically happening during rest, were treated as dropped frames and their fluorescence was interpolated. Finally, the videos were spatially downsampled by a factor of two, corresponding to about 2 µm per pixel. ROI segmentation and extraction of the fluorescence traces were performed similarly to previously published approaches25,55 and are therefore described in brief below. ROIs (putative neurons) were detected using an adaptation of a constrained non-negative matrix factorization approach designed for single-photon calcium imaging data (CNMF-E)55 and implemented in MATLAB. The following parameters were used for all extracted FOVs (gSig = 3, gSiz = 13, min_corr = 0.9, min_PNR = 50, ring_radius = 10, background_to_neuron_factor = 1.5, no spatial or temporal downsampling). Fluorescence traces were deconvolved using an autoregressive model (OASIS) with order p = 1 and using the ‘constrained foopsi’ method. Finally, identified ROIs were manually inspected to remove duplicates, inappropriate merges and non-cell-like ROIs. All of the subsequent analyses were performed on the inferred spike rate traces, normalized between 0 and 1 and smoothed with a 1 s moving average (normalized rate). ΔF/F0 traces shown in Fig. 4c were obtained by multiplying each raw temporal trace (C_raw) by a scaling factor proportional to the inverse sum of each ROI’s spatial footprint. Intensity correlation images (Fig. 4b and Extended Data Fig. 14a) were generated as part of the CNMF-E pipeline and show the local pixel correlations, reflecting correlated fluorescence emission by cell bodies and uncorrelated background.


At the end of the electrophysiology experiments, bats were given a lethal overdose of sodium pentobarbital and perfused transcardially with 200 ml PBS (0.025 M, pH 7.4) followed by 200 ml of fixative (3.7% formaldehyde in PBS). During perfusion, the microdrive was left in place. Then, after a few minutes, the tetrodes were carefully retracted, the microdrive was removed and the brain was dissected and stored in the fixative solution for 1–2 days. The fixed brain was subsequently moved to a 30% sucrose solution in PBS overnight for cryoprotection. Coronal sections (thickness, 40 μm) were cut using a microtome (HM450, Thermo Fisher Scientific) with a freezing stage. Slices around the dorsal hippocampus and including the implant were stained for DAPI, the CA2-enriched protein PCP4 (for rodents see refs. 56,57,58,59,60,61) and the microglial marker IBA1 (to highlight tetrode tracks). In brief, slices were permeabilized in PBS + 0.3% Triton X-100 (PBS-X), followed by incubation in blocking solution (PBS-X + 10% donkey serum). After overnight incubation at 4 °C with primary antibodies (goat anti-IBA1, 1:500, ab5076, Abcam; and rabbit anti-PCP4, 1:200, HPA005792, Sigma-Aldrich), the slices were washed in PBS-X and incubated for 120 min at room temperature with secondary antibodies (donkey anti-goat Alexa-647, 1:1,000, Invitrogen, A32849; donkey anti-rabbit Alexa-488, 1:1,000, Invitrogen A-21206). DAPI (1:10,000, Thermo Fisher Scientific) was added for the last 10 min of secondary incubation. The sections were washed in PBS-X and cover-slipped with aqueous mounting medium (ProLong Gold Antifade Mountant, Thermo Fisher Scientific). Fluorescence images of each section surrounding the implant were acquired using the Axioscan Slide Scanner (Zeiss) and used to localize tetrode tracks relative to hippocampal subfields (CA1 and CA2). Putative CA2 was identified on the basis of a combination of PCP4 fluorescence, DAPI staining and correspondence with the brain atlas of this species of bats62. Tetrode positions were determined by serial reconstruction of the tetrode arrangement in adjacent coronal sections. As tetrode tracks were not perfectly parallel to the coronal cutting plane, the path of each electrode could be visualized (IBA1 staining) as elongated segments of inflamed tissue in each section. The tip of each electrode was found by tracking the tissue gliosis across anatomically arranged coronal sections. Ten out of a total of twelve tetrodes (across three microdrives) were successfully identified and localized in the dorsal hippocampus of implanted bats. The remaining two tetrodes provided putative hippocampal units (and visible hippocampal ripples) and were included in the analysis but could not be associated with a specific location (comprising a total of 7 out of 254 units). Similar procedures were applied to confirm the location of the tetrodes in the hippocampus for the bats recorded in the object experiment. Similar procedures—with the exclusion of staining for PCP4 and IBA1—were performed at the end of the imaging experiments to confirm the lens targeting accuracy and the GCaMP6f expression profile around dorsal hippocampal regions CA1 (one bat) or CA1–CA2 (two bats).

Recording and detection of echolocation calls

Sounds in the experimental room were recorded using a dedicated ultrasonic microphone (Earthworks M50, Earthworks) mounted on one side on the room, which was connected to a preamplifier (OctaMic II, RME Synthax) and recorded audio data at a sampling rate of 192 kHz. The microphone output was corrected to achieve flat-frequency responses up to 96 kHz. Audio recordings were controlled using the Soundmexpro (HorTech) toolbox for MATLAB (MathWorks) and recorded using custom MATLAB scripts. Detection of echolocation calls was similar to ref. 48 and was performed as follows. Downsampled audio data (96 kHz) were band-pass filtered (10–40 kHz) and z-scored. All events larger than 10 s.d. were considered to be potential echolocation clicks and identified with the MATLAB function findpeaks, with a minimum peak distance of 10 ms. Other wide-band signals could contaminate the detection of clicks but were much rarer than the thousands of echolocation calls typically emitted in one session. To account for this, we took advantage of the similarity of echolocation clicks in the spectral domain (for this species of bats32) and looked for the most numerous cluster (k-means, 4 clusters) in the space defined by the first 3 principal components of the power spectrum of all putative clicks. The correspondence between this cluster and actual echolocation clicks was confirmed by the presence of two prominent peaks in the inter-click-interval distribution, consistent with what is expected for this species32 (intra-pair interval, ~20 ms; and inter-pair interval, ~100 ms; Extended Data Fig. 12a). The detected echolocation signals were largely consistent with their production by the flying bat as (1) their rate increased in amplitude when a bat approached the microphone (Extended Data Fig. 12d), (2) there was an increase in echolocation jamming with increasing numbers of flying animals (Extended Data Fig. 12e) and (3) there was a tight temporal alignment between detected echolocation clicks and the wing-beat cycle of the flying bat9,63 (Extended Data Fig. 12f).

Data analysis

All analyses were conducted using custom code in MATLAB (2021a, MathWorks).

Processing of positional data during group behaviour

Preprocessing of tracking data and basic analysis of positional features

The positions of all bats recorded by the RTLS were smoothed using local quadratic regression (1 s window). The tracking quality was further improved by considering that, when not flying, our bats did not typically change their position by crawling, therefore remaining in the location where they previously landed. We therefore detected flight epochs based on the prominent 8 Hz component in the accelerometer signal (wingbeats) and used them for excluding all flights from a second smoothing step: all tracking data during rest (that is, not associated to wingbeats) were further smoothed with a moving median (5 s window). For each bat, flights were identified on the basis of a velocity threshold of 0.5 ms−1 and used to segment a bat’s session into rest and flight epochs. Bats tended to rest in a handful of positions, typically—but not exclusively—around the upper corners of the room (Fig. 1b). We therefore clustered positions during rest for each bat using agglomerative hierarchical clustering with a minimum of 10 s occupancy and 0.2 m linkage distance (Extended Data Fig. 2d). Occupancy maps were calculated by counting the number of samples spent by a bat in each 2D spatial bin (21 × 21 bins, ~0.3 × 0.3 m). No smoothing was applied. Exploration ratio during rest (Extended Data Fig. 2c) was calculated as the fraction of bins visited by each bat (only contour bins were considered, minimum occupancy 5 s). The fraction of time close to the feeder was calculated as the time in the session spent at a distance of <0.3 m from the feeder locations (Extended Data Fig. 2e). Correlations between spatial preferences (Extended Data Fig. 2f) were calculated as the Pearson correlation between rest occupancy maps (unrolled in 1D) across subsequent sessions or between different bats. Heading was defined for each flight sample as the direction of the instantaneous velocity vector in the xy plane.

State-space analysis

A configuration of N bats in a given sample was defined as the vector of all positions (r1, r2, …, rN) and served as an input for state-space embedding by dimensionality reduction. Epochs in which all bats were resting were extracted and downsampled to one configuration every 3 s. This interval was chosen because it was approximately equivalent to the time between two flights (that is, a change in the group configuration). Euclidean distances between pairs of configurations were calculated and used as inputs for Sammon projection in two dimensions64, thereby obtaining a point in 2D (state space) for every input configuration of the group. Occupancy in the state space (Fig. 1c) was calculated on 80 × 80 spatial bins covering the range of obtained states and smoothed with a Gaussian kernel (σ = 1 bin). Considering the sparsity in the state space (that is, the highly clustered spatial preferences of the bats), states could also be approximated as discrete variables as follows. We pooled together all of the positions occupied by the bats during epochs of general rest and clustered them using agglomerative hierarchical clustering with a minimum of 10 s occupancy and 0.2 m linkage distance, therefore defining a set of discrete observed locations. In this way, each sample of general rest was associated with a configuration of discrete values (corresponding to the combination of bat identity × positional cluster identity). All of the possible states were calculated as (number of positional clusters)(number of bats). All visited states were defined as the effectively observed combinations, whereas all frequent states were defined as the configurations with occupancy higher than the s.d. of all of the state occupancies for that session (Fig. 1d, dashed line).

Social network and proximity indexes

The spatial proximity between pairs of bats in a given session was quantified as the fraction of time in which the inter-bat distance was lower than 0.3 m. This value was corrected by considering that bats could be found in close proximity as a consequence of shared spatial (rather than social) preferences. Thus, we also calculated the average chance proximity for the same pair, by randomly circularly shifting in time the position of one of the bats in the couple. The chance distribution was generated by repeating this procedure 1,000 times. We calculated two measures of social proximity by comparing the empirical value of the spatial proximity and its chance distribution: a proximity index (corresponding to the difference between the empirical value and the mean of the chance distribution; Fig. 1g) and its associated P value (the fraction of shuffled spatial proximities that exceeded the empirical value; Fig. 1f).

Place-fields and spatial information

Spatial information in 2D

For the analysis of spatial firing fields across all flights, we considered only active cells (n = 147 from three bats), with a minimum firing rate of 0.2 Hz during flight (minimum of 5 flights, at least 3 flights with spikes) and a minimum exploration ratio of 0.5 (as defined above, but across the whole room surface, see the ‘Preprocessing of tracking data’ section). We focused on the spatial firing in the xy plane (parallel to the ground), where most of the positional variance was concentrated. To compute 2D place-cell firing-rate maps, we projected all positions during flight onto the xy plane and calculated the occupancy-normalized firing rates as follows: we binned the 2D area of the room into fixed-sized spatial bins (0.15 × 0.15 m2) and calculated the occupancy (time spent in each bin) and the number of spikes fired in each bin. We smoothed both the spike-count map and occupancy map with a Gaussian kernel (σ = 1.5 bins) and calculated their ratio, bin by bin, therefore obtaining the firing rate per bin. Spatial bins in which the bat spent <200 ms were invalidated (white in Fig. 1j and Extended Data Fig. 4a), unless surrounded by at least one valid bin. Spatial information per spike65,66 was calculated by summing across all valid bins:

$${\rm{SI}}=\sum _{i}\frac{{p}_{i}{\lambda }_{i}}{\lambda }{\log }_{2}\frac{{\lambda }_{i}}{\lambda },$$

where pi is the probability of being in bin i, λi is the firing rate on the same bin and λ = Σipiλi is the average firing rate across all bins. A shuffling procedure was used to classify a cell as significantly spatially informative by comparing the empirical value of the spatial information to a spike-shuffled distribution. The shuffled distribution was generated by randomly shifting the timestamps of the cell’s spike-train circularly (after cutting rest epochs) and was repeated 1,000 times for each neuron. Significant place cells were defined as active neurons for which the empirical value of the spatial information exceeded the upper 95% confidence interval of its shuffled distribution.

Spatial information in 1D (flight paths)

As previously observed for solo bats or pairs of bats24,25, many flights of our animals followed along similar paths, typically traversed in only one direction. We took advantage of this feature and calculated spatial firing maps along tightly confined repeated trajectories (referred to as 1D flight paths). Flights were clustered into similar paths by using an analogous approach to that described previously25. In brief, flight trajectories were spatially downsampled to seven points per flight (first and last points corresponded to the take-off and landing positions, respectively). The Frechet distance67 between downsampled flights was used as a measure of flight similarity and similar flights were clustered by agglomerative hierarchical clustering. The linkage distance was set to 1.1 m after manual inspection of flight groupings. Spatial firing fields along flight paths (1D fields) were calculated for each repeated path and neuron with at least five flights and a minimum of four flights with spikes (n = 132 cells from three bats for collective foraging experiments and n = 116 cells from two bats during the object experiment). To compute the 1D fields, we used a similar procedure to the one adopted for 2D maps, applied in this case in only one dimension, to flight paths as 1D parametric trajectories rescaled between take-off and landing (bin size = 0.15 m). The firing rate was smoothed with a Gaussian window (7 samples) and spatial information was calculated across 1D bins as described above. A shuffling procedure was used to assess the significance of the spatial information of each 1D field. Similarly to what was described for 2D maps, spatial information was calculated on a shuffled spike distribution, generated by randomly shifting the timestamps of the cell’s spike train circularly (considering only flight epochs from the analysed path). Shuffling was repeated 1,000 times for each neuron and path (1D field). Significant 1D fields were defined as those for which the empirical value of the spatial information exceeded the upper 95% confidence interval of its shuffled distribution after applying Bonferroni correction for the number of paths examined for that neuron. The stability of 1D fields within a session (Fig. 1l) was measured by splitting each path into two random halves of repeated flights, separately calculating 1D fields on each half (Extended Data Fig. 4b) and calculating the Spearman correlation between corresponding halves.

Social modulation of firing during flight of the recorded bat

Social modulation of firing during flight of the recorded bat was tested using three complementary approaches: (1) a stepwise GLM; (2) a test for firing differences between social and non-social flights anchored to specific take-off and landing locations—explicitly controlling for positional changes; and (3) a conservative test using modulation scores that aimed to identify social modulation in cases of minimal changes of kinematic variables (position, head direction and acceleration). We focused on the time periods around take-off and landing because these were associated with the largest fraction of spatial selectivity, and, furthermore, take-off and landing locations naturally constituted points in space were behavioural and positional variability was minimal (Fig. 1b), therefore enabling rigorous assessment of social modulation. Flights were divided into social and non-social using an empirically derived distance threshold (Fig. 2a), unless otherwise stated: all flights landing closer to a bat than 0.6 m were classified as social, whereas all flights landing further than 0.9 m were classified as non-social. The three approaches are explained below and are consistent with a significant modulation of hippocampal activity by the social nature of the bat’s spatial behaviour.

Social modulation for social versus non-social flights

Approach 1 using GLM. The aim of this analysis was to test whether the social nature of a flight had significant explanatory power in predicting the firing rate of hippocampal neurons across all of the flights executed by the recorded bat in a given session, under the null hypothesis that simpler models, including the position of the recorded bat as explanatory variable, could fully explain the variance in firing rate. Social modulation of firing was tested across all flights using a stepwise GLM68. The stepwise procedure aimed to build a simple model that tries to explain firing rate around take-off or landing—for all of the flights—with the fewest possible explanatory variables. We allowed for the fact that firing modulation induced by the social nature of a flight could happen, for each cell, at different timepoints around take-off and landing, and first determined the optimal time bin for each neuron. We therefore first divided flights into social and non-social on the basis of the nearest-neighbour bat distance at landing (see above). We next systematically tested for differences in the mean firing rate between social and non-social flights using a sliding window of 500 ms around take-off and landing ([−1 s, +1 s], 100 ms increments) using the conditional C-test for Poisson means69. For each cell, we then considered the time bin with the lowest P value for further analysis. We built a model using the number of spikes in the optimal time bin as a response variable and three explanatory variables: x and y position of the recorded bat at the centre of the optimal time bin (positional coding) and the social nature of the flight (social versus non-social, using the distance for non-social flights to >0.6 m to include all of the flights in this case). We considered only active cells (n = 162 from three bats), with a minimum average firing rate of 0.2 Hz throughout the session, and included only sessions with a minimum of 40 flights (total) and 20 flights per category (social, non-social). We used the MATLAB function stepwiseglm, considering a Poisson distribution as the distribution of the response variable and the log function as the link function. The stepwise procedure starts from a constant intercept model and iteratively adds or removes terms (x, y and social category) on the basis of their statistical significance in explaining the response variable. The comparison is performed on incrementally larger models using a deviance test68,70, which tests whether a model including more explanatory variables performs significantly better than a simpler model. This enabled us to compute the percentage of cells in which the social nature of the flight yielded a significantly better model than simpler models including only position and/or a constant term.

Social modulation for social versus non-social flights

Approach 2 based on firing differences with no positional differences. The aim of this analysis was to test whether the social nature of a flight could cause a significant change in firing rate around specific take-off and landing locations (in contrast to the previous analysis that considered all take-off and landing spots), while controlling for changes in the position of the recorded bat at the time of the modulation. We took advantage of the fact that take-off and landing locations were naturally clustered in space and systematically evaluated the activity of neurons around these anchoring points, iteratively applying the same procedure to the pairs defined by a neuron and an anchoring location. First, we applied spatial clustering to all of the resting locations of the recorded bats (see above) and retained only flights from clustered locations (corresponding to most of the flights; Extended Data Fig. 2d). As a result, we obtained a series of positional clusters at take-off and landing with each corresponding to repeated flights diverging from or converging on a restricted set of positions. Then, for each positional cluster, we applied the following procedure. We classified social versus non-social flights as described above and retained only positional clusters with a minimum of five flights per category. We next systematically tested for differences in mean firing rate between social and non-social flights on a sliding window of 500 ms around take-off or landing ([−1 s, +1 s], 100 ms increments), using the conditional C-test and applying Bonferroni correction for the number of tested windows. For each cell and in the case of take-off locations, we considered the time bin with the lowest P value as the optimal time bin for further analysis. In the case of landing, we instead prioritized time windows entirely confined before landing and considered windows after landing only if no significant firing difference was found before. We included only cells with a minimal average firing rate of 1 Hz in the optimal time window across all flights (n = 135 from three bats). Once the optimal time bin was found, corresponding to a significant difference between the firing rate on social versus non-social flights, we tested for significant differences in the position of the recorded bat at the centre of the optimal time bin. This was done by separately testing for differences in the x, y and z during social versus non-social flights using a simple permutation test. We considered a significant difference in position if any of the three coordinates showed a P value smaller than 0.05. Percentages of cells are reported in the main text.

Social modulation for social versus non-social flights

Approach 3 based on modulation scores. The aim of this analysis was to find, following a more conservative approach, neurons that showed consistent modulation of firing rate during social versus non-social flights while at the same time exhibiting minimal changes in position, heading direction and acceleration. To do so, we implemented a procedure (modulation score calculation; Extended Data Fig. 6) that enabled us to (1) minimize any potential unbalance between the number of social versus non-social flights and (2) test differences between the four variables of interest (firing, position, heading and acceleration) within the same statistical framework. The calculation of the modulation scores was performed iteratively, following the same steps for all of the active neurons and all of the anchoring points at take-off and landing fulfilling the inclusion criteria (see below). We divided flights into social and non-social, as described above, and required a minimum of five flights for each category for further analysis (median of 12 versus 9 flights per category). First, we identified the optimal time bin in which we could find a significant modulation of firing based on the social nature of the flights, using the same procedure described above (again applying Bonferroni correction for the number of tested windows). We included only cells with a minimal average firing rate of 1 Hz in the optimal time window across all flights (n = 135 from three bats). Once the optimal time bin was found, we calculated the number of spikes within the time bin (500 ms), as well as the position and heading angle of the recorded bat at the centre of the time bin and the average absolute acceleration (provided by the onboard accelerometer) within the time bin for each flight. Next, we selected a subsample of all of the available flights, made of five randomly selected social flights and five randomly selected non-social flights and calculated (1) the difference between the average firing rates; (2) the distance between the average positions; (3) the difference between the average heading angles; and (4) the difference between the average accelerations, where averages were calculated for the same five social versus five non-social flights. Each of these four differences was considered as the empirical value for that particular subsample and compared with 100 shuffled sets obtained by randomly permuting the social nature of flights. A variable of interest (firing, position, heading or acceleration) was considered to be significantly different for that particular subsample if the corresponding difference between social and non-social flights was larger (in absolute value) than 95% of the corresponding shuffled values. We repeated this procedure 100 times, each time sampling a different subset of five social versus five non-social flights and each time calculating the significance of the differences in firing, position, heading and acceleration. The modulation scores for each examined cell and anchoring location were calculated as four numbers (firing, position, heading, acceleration) quantifying the faction of subsamplings in which the corresponding variable showed a significant difference (for example, a firing modulation score of 0.7 means that in 70 out of 100 subsamplings we found a significant difference in average firing between social and non-social flights for that particular cell around a given location). We considered a cell as modulated by the social nature of a flight—with minimal changes in position, heading and acceleration—if the firing modulation score was larger than 0.5 (average 0.7 across all modulated cells; Extended Data Fig. 7) and all of the remaining scores (position, heading and acceleration) were smaller than 0.5 (average 0.2 across all modulated cells; Extended Data Fig. 7). The modulation score for heading was not considered for time bins centred before take-off or after landing (minority), as heading was not defined on those bins. The modulation value (as opposed to the score) of the firing rate for a neuron around a given anchoring point (absolute value in Fig. 2d,g,k and signed value in Fig. 2l) was calculated as the average difference in firing between social and non-social flights across all subsamplings (corrected by the mean of the shuffled distribution, typically equal to zero), divided by the average firing frequency for that cell over the entire session and expressed in percentages. Although this approach using modulation scores provides an underestimation of the fraction of cells that is modulated by social factors (as it effectively excludes cells that are also modulates by other factors, such as acceleration and heading that can also be socially modulated), it nonetheless provided a complementary assessment for dissociating movement and positional modulation from social modulation.

Responses to conspecifics versus responses to a moving object

The analysis of experiments involving three bats and a moving object was performed according to similar procedures as described in the above sections and, importantly, using the exact same method (modulation score, approach 3). To avoid contamination from social responses, modulation by the object was evaluated considering exclusively flights landing on an empty spot or close to the object when no bats were present. For each cell and take-off or landing location, as described above, we followed an iterative procedure for finding the optimal time bin for further analysis and similar criteria on minimum number of flights and spikes per flight were adopted. In general, single-unit response profiles around the same location tended to be largely different when an object was present versus when a bat was present at landing (84% bat modulated and 71% object modulated showed significantly different responses, P < 0.05 empirical data versus shuffled flight identities; some example responses are shown in Extended Data Fig. 8d).

Social modulation around flights to a specific target bat

The aim of this analysis was to investigate whether the modulation of firing during social versus non-social flights could be explained by the presence or absence of a specific bat at the landing spot, regardless of other bats. To test this hypothesis, we simply repeated the above analysis by replacing the nearest-neighbour bat distance at landing with the distance to a specific bat (termed as the target bat), iteratively testing all of the bats that participated in the session (minimum of 5 flights to target bat: landing distance <0.6 m; minimum of five flights not to target bat: landing distance >0.9 m). We adopted this approach following the structure in the bat group behaviour where the positions of different bats in specific locations were often correlated. Yet this approach enabled us to identify the cases in which sufficient instances occurred for each specific target bat to assess potential identity selectivity (points with low ‘fraction same’ in Fig. 2l,m). Thus, the analysis below is mainly aimed at understanding whether the effects obtained under the assumption that a particular bat was the main driver of the modulation are comparable to or larger than the effects obtained under the assumption that any bat was driving the modulation. We followed the analyses described above for each target bat with enough flights (see above, n = 142 cells from three bats). First, we looked for cells with significant differences in firing and no significant differences in position (approach 2). Second, we followed the more conservative exclusion approach (modulation scores, approach 3; see above). As a result of the iterative nature of the procedure, a cell could be modulated by different target bats and around different anchoring locations (a triplet: {cell, location, bat}). However, we found that most of the cells were modulated around a single position (79%) and for a single target bat (75%; Extended Data Fig. 9i), underscoring the selective nature of the hippocampal neurons’ activity. In additional analyses that are shown in Fig. 2l,m, we assessed the significance of the change in firing rate modulation for a specific target bat compared with the general distinction between social versus non-social flights (Fig. 2l) and compared with other bats (Fig. 2m). For assessing the significance of change in firing rate modulation with to other bats, we computed for each neuron showing significant social modulation for a given target bat the firing modulation score that would correspond, in the same time bin, to a different target bat (we restricted the analysis to cells with a minimum eight flights to target, eight flights not to target; Fig. 2m) and tested whether the two were significantly different (Wilcoxon signed-rank test). We also calculated the percentage of flights that had the same class (to target, not to target), when classified based on the original target bat and when based on the different target bat, as two bats could potentially be always present in the same location together (Fig. 2l,m, colour code). In a similar analysis (Fig. 2l), we examined in which way the modulation value obtained for a specific bat was different from that obtained for social versus non-social flights in the same time bin. To test for significant differences between the two conditions, we excluded 6% (5 out of 88) of the pairs in which the firing modulation value changed sign (going from increase to suppression or vice versa when considering social, non-social instead of to target, not to target) and again tested for significant differences between the two values (Wilcoxon signed-rank test on the absolute values). For the analysis of social proximity between the recorded bat and different target bats (Fig. 2n), we calculated the proximity index (a purely behavioural measure, see above) between the recorded bat and the target bat (the one associated with significant modulation of hippocampal activity) and between the recorded bat and a ‘different bat’ (not associated with a significant change in firing rate in the same time bin and location), therefore obtaining two values for each cell. To avoid ambiguities, we included only cells modulated by a single target bat in one single location (n = 30 from three bats) and considered a unique different bat, fulfilling inclusion criteria for minimum number of flights and associated with the largest number of flights (meaning that the different bat could be tested, but did not cause significant modulation of firing). The difference between proximity indexes was tested by pairwise comparison (Wilcoxon signed-rank test). To show the magnitude of the effect, the proximity indexes in Fig. 2n were normalized to the median proximity index between the implanted bats and all other bats, regardless of neural modulation. For all socially modulated cells, we controlled for differences between the time in the session when flights to target versus flights not to target occurred (only 8 out of 58 cells showed a significant difference between the time of flights, P < 0.05, Wilcoxon rank-sum test), suggesting that, overall, the modulation was not due to unstable recording of neural activity throughout the session, consistent with the fact that firing patterns were generally very stable (Fig. 1l).

Simulated spatial, social and conjunctive responses

Simulations were performed by combining the observed behaviour of implanted bats during collective foraging with modelled cell responses. All of the sessions that were included in the analysis of single-unit responses were also used for simulations. We performed two sets of simulations: one for evaluating the responses of different cell classes and one for evaluating the decoding performance from the activity of simulated cells. The two sets differed only in the number of simulated cells of each type and in the distribution in space and time of spatial and social responses (described below). The firing rate of each neuron was modelled on 200 ms time bins as an inhomogeneous Poisson process with rate λ(t) given by the contribution of spatial and social responses. In particular, for each time bin centred at ti:

$$\lambda \left({t}_{i}\right)={\lambda }_{{\rm{spont}}}+{\lambda }_{{\rm{spatial}}}({t}_{i})+{\lambda }_{{\rm{social}}}({t}_{i})$$

$${\lambda }_{{\rm{spatial}}}\left({t}_{i}\right)=w\left({t}_{i}\right){\lambda }_{c}{{\rm{e}}}^{\frac{{\left(x\left({t}_{i}\right)-{x}_{c}\right)}^{2}}{2{\sigma }_{c}^{2}}}$$

$${\lambda }_{{\rm{social}}}\left({t}_{i}\right)=b\left({t}_{i}\right){\lambda }_{s}{{\rm{e}}}^{\frac{{\left({t}_{i}-{t}_{s}\right)}^{2}}{2{\sigma }_{s}^{2}}}$$

The above equations describe spatial fields with maximal firing λc at the centre xc of the 2D field and width σc. w is a windowing function that ensures firing at rest decays within 0.5 s from take-off or landing. ‘Social’ responses were simulated as Gaussian-shaped changes in firing rate (value λs) happening around take-off or landing (ts) and lasting for σs seconds, conditioned to the presence or absence of a bat at the landing spot (b term), using a distance threshold of 0.6 m. Different cells classes could be generated by modifying the parameters of the model. Canonical place cells were generated by setting λs = 0; pure social cells were those with λc = 0; conjunctive cells were defined by setting λs = ±λc and b(ti) true only if (x(ti) − xc)2σc2, that is, firing was modulated both positively or negatively by the presence or absence of a bat, but only within a given spatial field (the sign of the social modulation was positive with 0.5 probability). To evaluate the general properties of modelled cells (Extended Data Fig. 10e), we simulated 50 cells per session and per implanted bat. These cells were randomly selected from the three categories defined above with probabilities 0.2 (spatial), 0.2 (social) and 0.6 (conjunctive), given the sparser responses of conjunctive cells. Parameters of the model such as the baseline firing rate, field width, firing rate at the centre of the spatial field or rate change for social versus non-social flights were derived from the experimentally observed values (λspont = 0.4 Hz, λc = 8 Hz for spatial cells, λs = 4Hz for social cells, λs = ±λc = ±4 Hz for conjunctive cells, σc = 50 cm, σs = 0.5 s). ts was randomly selected to be at take-off or landing, whereas xc was uniformly distributed across the 2D extension of the room. Activity from the simulated cells was analysed with exactly the same methods adopted for real cells and used to quantify spatial tuning and social modulation. For the second set of simulations (Extended Data Fig. 10f), 100 cells were simulated for each session and implanted bat, chosen at random from the three categories (~33 cells per class per session and implanted bat). Given that we were interested in decoding the landing position and the social nature of flights at landing, xc was randomly sampled from the relevant landing locations of the bats (min 5 flights) and ts was fixed at landing only, such that spatial, social and conjunctive responses were all concentrated around landing. Decoding of the landing location and or of the social nature of flights was performed by training multiclass support vector machines, by using the average activity of simulated cells on a [−0.5, 0.5] s time window around landing. Decoding accuracy was evaluated by fourfold cross-validation for increasing the numbers of cells from each of the modelled classes.

Analysis of alternative reward-related explanations for the social modulation

We carefully examined several alternative explanations for the social modulation involving the interplay between identity and reward (Extended Data Fig. 11). First, we looked for evidence of leading-following dynamics (Extended Data Fig. 11a), whereby flights of a given bat to reward locations reliably preceded or followed flights of another bat to the same location. We tested each pair (bati, batj) twice, corresponding to one bat leading and the other following or vice versa. We quantified the interval between bati landing on a reward location and batj taking off towards the same location, and we compared the median of observed intervals with that of a shuffled distribution in which the take-offs of batj were circularly permuted, therefore preserving the inter-flight time. We repeated this process 100 times and calculated the fraction of shuffled sets yielding a median interval smaller than the empirical value. To consider a relationship as significant, we required the aforementioned fraction to be <0.05 and a minimum of 5 intervals between landing and take-off shorter than 12 s for each session. Next, we tested different explanations for the modulation of neural activity potentially associated with reward and described in Extended Data Fig. 11b–e. Potential reward blocking was tested by looking at the landing locations at which cells were modulated (Extended Data Fig. 11b); potential disturbing (scrounging) was examined by looking at the take-off locations preceding landing at which cells were modulated (Extended Data Fig. 11c). In both cases, we found little overlap between the locations that would be expected if only the reward caused the response. Next, potential ‘next reward availability’ was tested by looking at the probability and timing of next flights to reward when the target bat was either present or absent at the location where cells were modulated (Extended Data Fig. 11d); potential disturbance of the target bat was investigated by looking at the distribution of the time intervals from last reward of the target bat relative to the time of neural modulation (Extended Data Fig. 11e). Finally, the percentage of cells directly responsive to the reward was calculated for a subset of the single units, recorded with a probabilistic reward delivery and with at least 5 rewarded and 5 unrewarded flights (mean 42 versus 29, respectively; 73 neurons from two bats). The average firing profile was calculated in a [0–3] s time window after landing for trials with or without reward delivery (happening ~1 s after landing), when the bat landed on the same reward location in the absence of any other bat. The absolute difference, across the window, in the average number of spikes between rewarded and unrewarded flights was compared with 100 shuffled values of the same difference obtained by a similar procedure, where the identities of rewarded and unrewarded flights were randomly permuted. A cell was considered to be significantly reward responsive if less than 5% of the shuffled values were larger than the empirical value.

Social modulation of firing during others’ flights, when the recorded bat was stationary

Modulation of neural activity under stationary conditions was evaluated around take-off of other bats. To avoid ambiguous events, we considered an interval from −1 to +1 s around each take-off and excluded all take-offs associated (1) with intersected intervals or (2) with intervals in which the recorded bat was also flying, which were very rare. All of the remaining intervals were therefore associated to the take-off of one single bat and disjointed with other intervals (the distribution of the number of valid events per session is shown in Fig. 3a). To account for the fact that hippocampal activity could be influenced by the overall movement of the recorded animal, in our main analysis, we considered only events characterized by low mobility of the recorded bat in the [−1s, +1s] interval around take-off (all flights and periods of high mobility are shown in Extended Data Fig. 13). To assess the recorded bat’s mobility, we used an on-board accelerometer. We calculated the vectorial norm of the three-axis acceleration recorded from the accelerometer and subtracted it to g (9.81 m s−2). All flights in which the absolute deviation from g exceeded 0.03 m s2 in any of the samples of the considered interval were excluded (Fig. 3b). Only cells with a minimum of 20 low mobility events (mean across cells: 155) and a minimum average rate of 0.2 Hz across the session were considered for further analysis (n = 177 from three bats). This enabled us to effectively behaviourally clamp the recorded bat and exclude modulation of neural activity by self-movement. Significant modulation was assessed by systematically comparing firing rates in a sliding window around others’ flights (500 ms duration, 100 ms steps, range: −1 s, +1 s around take-off), with the average firing rate across the whole interval. A cell was defined to be significantly modulated if the firing rate was significantly different from the average firing in any of the tested time windows (P < 0.05, Wilcoxon signed-rank test after Bonferroni correction for the number of tested windows). Comparison of hippocampal responses around others’ flights with or without echolocation (Extended Data Fig. 13e) was carried out for the subset of significantly modulated cells (as defined above) that contained enough trials of both types (minimum of 20). The delay between responses was calculated as the time lag giving the maximal cross-correlation between response profiles, considering only cells with maximal cross-correlation larger than 0.2 per sample. The click-triggered PSTH (Extended Data Fig. 13f) was calculated for the significantly modulated cells by considering the firing rate around echolocation clicks (minimum of 150 clicks, separated by at least 80 ms to avoid double counting within a click pair) emitted when no bats were flying and normalized to the baseline firing rate. For generating the shuffled trace, the time instants corresponding to the number of detected clicks were randomly sampled from the same epochs of no flight. The magnitude of the modulation for close versus far take-offs (Extended Data Fig. 13d) was measured for each cell as follows: first we selected the subset of cells with enough repetitions (minimum 10) of both low mobility close flights (<1 m take-off distance) and low mobility far flights (>1 m take-off distance). We then calculated the average firing rate profile around take-off events ([−1s, +1s]) for the two classes. The ‘magnitude’ of the modulation was then computed for each cell as the scalar product between the average firing rate profile (close versus far) and a template response, defined as the average firing rate of all modulated cells rescaled between −1 and 1. A similar definition, through a scalar product, was used to calculate the magnitude of the response for selectivity index calculation (see below) and for the distinction between CA1 and CA2 responses (Extended Data Table 1). The selectivity index of social modulation during others’ take-off was calculated for three different conditions: (1) selectivity for the position of the recorded bat (stationary); (2) selectivity for the identity of the bat that was taking off; and (3) selectivity for the identity of the bat that was taking off, given the position of the recorded bat (Fig. 3f; see below). The position of the recorded bat was considered as a categorical variable, corresponding to the positional cluster occupied by the recorded bat at the time of take-off of other bats (see above for positional clustering). In all cases, we considered only events with at least ten repetitions of the same class (position or bat identity). Events with less than ten repetitions were discarded, and the selectivity index was calculated considering only the remaining classes. As a result, the selectivity index could be calculated for only those cells in which at least two positions and/or identities remained after exclusion (n = 124, 110, 113 respectively). The calculation proceeded as follows: the average response of a cell in a given condition (position or identity) was calculated as the scalar product between the average firing rate in a [−1 s, +1 s] interval around take-off and the template response (see above for magnitude of the response). To calculate a selectivity index, the set of responses across different positions or identities was normalized to assume positive values and the selectivity index was calculated as described previously71,72:

$${\rm{SI}}=\left(1-\frac{{\left(\sum \frac{{r}_{i}}{n}\right)}^{2}}{\sum \frac{{r}_{i}^{2}}{n}}\right)\left(\frac{1}{1-\frac{1}{n}}\right)$$

where n indicates the number of different conditions (positions or identities) and ri represents the average response of the cell in that condition. A distribution of 100 shuffled selectivity indexes was calculated by repeating the above steps after random permutation of the positions or the identities. A cell was defined to be significantly selective for a given position or bat identity when the empirical value of the selectivity index exceeded the upper 95% confidence interval of its shuffled distribution. The calculation of the selectivity index for bat identity given position was performed similarly, by systematically considering each position as a separate subset and calculating a selectivity index for bat identity from that subset, therefore obtaining a set of indexes for each cell and position.

Analysis of calcium imaging data during collective foraging

All behavioural analysis related to the imaging sessions followed the same methods described above, as the structure of the experiment was largely the same in the case of electrophysiology and imaging (6 or 7 bats foraging from a bowl or from four feeders), with the main difference being the shorter duration of imaging sessions (about 60 min). For the analysis of social and spatial responses during imaging, we focused on the subset of sessions for which there was at least one landing location with stereotyped and consistent behaviour of the imaged bat for social versus non-social flights (n = 24 FOVs across 20 sessions with one or two simultaneously imaged bats, total of 3 different bats). In particular, we required at least five flights per type (social versus non-social) and no significant differences in the landing position, heading direction (averaged over a [−1, 0] s window before landing) and in the overall movement of the bat (quantified as the absolute deviation of the accelerometer signal from g, averaged over a [0, 2] s window after landing) by using a permutation test (P < 0.05). Once an analysable landing location was found, we tested each extracted ROI for social modulation by comparing its normalized firing rate (defined above) averaged over a [−1, 2] s time window around landing for social versus non-social flights by using a permutation test (a cell was considered to be socially modulated if P < 0.05). For principal component analysis and decoding, we considered as input features the standardized firing rates around social versus non-social landings, averaged over the same [−1, 2] s time window. Each landing was therefore associated with an N × F matrix, where N was the number of socially modulated cells (or a matched number of socially unmodulated neurons) and F the number of flights, each one associated with a class (social versus non-social). The first two principal components were used both for visualization (Fig. 4e, left) and for calculating the distance between the activity centroids for social versus non-social flights (Fig. 4e, right). Data from different sessions were pooled and represented in the same principal component plane by rotating all points (social and non-social) from a given session, such that the centroid of activity for social flights would be on the negative PC1 axis. The same method was used for socially modulated as well as unmodulated cells, as a control. For decoding social versus non-social landings, the activity matrix was used to train a logistic regression classifier. Accuracy was calculated using fourfold cross validation. Spatially modulated cells were defined, across the same set of FOVs analysed for social responses, as those ROIs showing significantly different activity when landing on one versus the other of the two most common locations in the room (mean = 31% spatially modulated cells across 24 FOVs, 3 bats), using the same [−1, 2] s time window relative to landing. Spatial decoding was performed as described above by training logistic regression classifiers on the activity matrix, where activity was in this case calculated around landing on the two most common locations in the room. Decoding accuracy—spatial or social—was calculated for different sets of cells (socially modulated, spatially modulated, unmodulated or socially but not spatially modulated). Note that for both social and spatial decoding, the chance level is at 0.5.

Statistical analysis

No formal methods were applied to predetermine sample sizes and adopted sample sizes were similar to those used by similar studies. No randomization of experimental sessions was performed and no blinding to experimental conditions was implemented during the analysis. All statistical comparisons were performed using nonparametric tests (Wilcoxon rank-sum tests, Wilcoxon signed-rank tests, bootstrap or randomization tests) unless otherwise stated. The tests were two-tailed, unless otherwise stated. Where appropriate, adjustments for multiple comparisons were performed using Bonferroni or Tukey correction.

Reporting summary

Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.

Source link


Leave a Reply

Your email address will not be published. Required fields are marked *