Strange IndiaStrange India

Fly husbandry

Drosophila melanogaster flies were raised at 25 °C on a 12-h light:dark cycle. All physiological and behavioural experiments were performed on 1- to 4-day-old female flies. For optogenetic experiments, experimental and control crosses were kept in a box with a blue gel filter (Tokyo Blue, Rosco) as a cover—to minimize exposure to light within the excitation spectrum of CsChrimson while also not keeping the flies in complete darkness; eclosed flies from such experiments were placed onto food containing 400 µM all-trans retinal for at least one day.

Fly genotypes

To image EPG neurons during menotaxis experiments (Fig. 1 and Extended Data Fig. 3), we used +/−; +/+; UAS-GCaMP7f/60D05-Gal4 or +; UAS-tdTomato/+; UAS-GCaMP7f/60D05-Gal4.

To image FC2 neurons during menotaxis experiments (Fig. 1 and Extended Data Fig. 3), we used either +; VT065306-AD/+; VT029306-DBD/UAS-GCaMP7f or +; VT065306-AD/UAS-tdTomato; VT029306-DBD/UAS-sytGCaMP7f.

To stimulate FC2 neurons while imaging (Fig. 2 and Extended Data Fig. 4) we used +; VT065306-AD/UAS-CsChrimson-tdTomato; VT029306-DBD/UAS-sytGCaMP7f. For control flies we used +; VT065306-AD/UAS-tdTomato; VT029306-DBD/UAS-sytGCaMP7f.

To label PFL3 neurons for patch-clamp experiments (Fig. 3 and Extended Data Figs. 6–9) we used +; VT000355-AD/UAS-2xeGFP; VT037220-DBD/+.

To label PFL3 neurons for calcium imaging only (Fig. 5a–d and Extended Data Figs. 9i and 10a) we used +; 57C10-AD/UAS-tdTomato; VT037220-DBD/UAS-GCaMP7f.

To stimulate PFL3 neurons while imaging (Fig. 5e–h and Extended Data Fig. 10b–d) we used +; VT000355-AD/UAS-GCaMP7f; VT037220-DBD/UAS-CsChrimson-tdTomato. For control flies we used +; VT000355-AD/UAS-tdTomato; VT037220-DBD/UAS-GCaMP7f (Fig. 5g,h).

To stimulate PFL1 neurons while imaging (Fig. 5g,h) we used +/−; VT000454-AD/ UAS-GCaMP7f; VT001980-GAL4/UAS-CsChrimson-tdTomato.

To characterize the expression pattern of VT065306-AD; VT029306-DBD (Extended Data Fig. 1a,b), 57C10-AD; VT037220-DBD (Extended Data Fig. 1d,e), VT00355-AD; VT037220-DBD (Extended Data Fig. 1f,g) and 27E08-AD; VT037220-DBD (Extended Data Fig. 1h,i) we crossed each of these lines to UAS-RedStinger; UAS-mCD8-GFP.

For multicolour flip-out of VT065306-AD; VT029306-DBD we used hs-FLPG5.PEST (Extended Data Fig. 1c).

To express shibirets in PFL3 neurons, during the wind-induced angular memory task, we used +; 57C10-AD/+; VT037220-DBD/UAS-shibirets (Extended Data Fig. 11). To express shibirets in EPG neurons we used +/−; 60D05-Gal4/+; UAS-shibirets/+ (Fig. 6 and Extended Data Fig. 11). For control flies we used +/−; empty-AD/+; empty-DBD/UAS-shibirets, which were also used for ‘no wind’ control experiments (Fig. 6 and Extended Data Fig. 11).

To express TNT in PFL3 neurons, during the wind-induced angular memory task, we used either +; 57C10-AD/UAS-TNT(E); VT037220-DBD/+ (Fig. 6 and Extended Data Fig. 11) or +; 27E08-AD/UAS-TNT(E); VT037220-DBD/+ (Extended Data Fig. 11). For control flies we used +; 57C10-AD/UAS-TNT(Q); VT037220-DBD/+ (Fig. 6 and Extended Data Fig. 11) and +; 27E08-AD/UAS-TNT(Q); VT037220-DBD/+ (Extended Data Fig. 11).

Origins of fly stocks

We obtained the following stocks from the Bloomington Drosophila Stock Center (BDSC), the Janelia FlyLight Split-Gal4 Driver Collection or from other laboratories: VT000454-p65AD; VT001980-GAL4.DBD (SS02239)51, VT000355-p65AD (attP40)51, 57C10-p65AD (attP40) (BDSC 70746), VT037220-Gal4.DBD (attP2) (BDSC 72714), R60D05-Gal4 (attP2) (BDSC 39247), empty-AD; empty-DBD (BDSC 79603), 27E08-p65AD (BDSC 70048), UAS-2xeGFP (Dickinson laboratory), 20XUAS-IVS-jGCaMP7f (VK05) (BDSC 79031), 20XUAS-IVS-jGCaMP7f (su(Hw)attP5) (BDSC 80906), 10XUAS-sytGCaMP7f (attP2) (BDSC 94619), UAS-tdTomato (attP40) (BDSC 32222), UAS-CsChrimson-tdTomato (VK22) and UAS-CsChrimson-tdTomato (VK05) (gifts from D. Anderson, B. Pfeiffer and G. Rubin), UAS-mCD8-GFP (attP2) (BDSC 32194), UAS-RedStinger (attP40) (BDSC 8546), hs-FLPG5.PEST (BDSC 64085), pJFRC99-20XUAS-IVS-Syn21-Shibire-ts1-p10 (VK00005) (gift from G. Rubin), UAS-TNT(E) (BDSC 28837) and UAS-TNT(Q) (BDSC 28839).

Generation of genetic driver lines and immunohistochemistry

To generate split-Gal4 lines targeting FC2 and PFL3 neurons, we used the Fiji plugin Color MIP tool52 and NeuronBridge53 to find suitable pairs of hemi-driver lines. We validated that the split-Gal4 lines generated target the cells of interest by means of immunohistochemistry (Extended Data Figs. 1 and 11i,j).

We dissected the brains and incubated them in either 2% paraformaldehyde (PFA) for 55 min at room temperature or in 1% PFA overnight at 4 °C. We blocked and de-gassed brains in a blocking solution consisting of 5% normal goat serum (NGS) in 0.5% Triton X-100, phosphate buffered saline (PBT).

For GFP and RedStinger labelling experiments (Extended Data Fig. 1a,b,d–i), we used a primary antibody solution of 1:100 chicken anti-GFP (Rockland, 600-901-215), 1:500 rabbit anti-dsRed (Takara 632496) and 1:10 mouse anti-Bruchpilot (nc82, DSHB) in 5% NGS/PBT and a secondary antibody solution consisting of 1:800 goat anti-chicken:Alexa Fluor 488 (Invitrogen A11039), 1:400 goat anti-rabbit: Alexa Fluor 594 (Invitrogen A11037) and 1:400 goat anti-mouse:Alexa Fluor 633 (Invitrogen A21052) in 5% NGS/PBT. For TNT (Extended Data Fig. 11i,j) we used a primary solution of 1:1,000 rabbit anti-TNT (Cedarlane, 65873(SS)) and a secondary solution of 1:800 goat anti-rabbit:AlexaFluor 488 (Invitrogen A11034).

For heat-shock multicolour flip-out experiments54 (Extended Data Fig. 1c), we used a primary antibody solution of 1:300 rabbit anti-HA tag (Cell Signaling 3724S), 1:200 rat anti-Flag tag (Novus NBP1-06712) and 1:10 mouse anti-Bruchpilot in 5% NGS/PBT. The secondary antibody solution used was 1:500 donkey anti-rabbit:Alexa Fluor 594 (Jackson Immuno Research 711-585-152), 1:500 donkey anti-rat:Alexa Fluor 647 (Jackson Immuno Research 712-605-153) and 1:400 goat anti-mouse:Alexa Fluor 488 (Invitrogen A11029) in 5% NGS/PBT, followed by a tertiary antibody solution of 1:500 DyLight 550 anti-V5 Tag (AbD Serotec MCA1360D550GA) in 5% normal mouse serum PBT.

For visualizing biocytin-labelled neurons after patch-clamp experiments (Extended Data Fig. 6a), the primary antibody solution we used was 1:10 mouse anti-nc82 in 1% NGS/PBT and the secondary antibody solution was 1:800 goat anti-mouse:Alexa Fluor 488 and 1:1,000 streptavidin:Alexa Fluor 568 (Invitrogen S11226) in 5% NGS/PBT.

Brains were mounted in Vectashield and images were acquired using a Zeiss LSM780 confocal microscope with a 40×/1.20 NA water-immersion objective or a 10× air objective.

Estimating the number of PFL3 cells targeted for silencing

To estimate how many PFL3 cells were targeted by our split-Gal4 lines in the neuronal silencing experiments of Fig. 6 and Extended Data Fig. 11a-h, we stained for expression of TNT in the brains of 23 flies (57C10-AD ∩ VT037220-DBD: 12 brains, 27E08-AD ∩ VT037220-DBD: 11 brains) (Extended Data Fig. 11i–j) that had the exact genotype used in those behavioural experiments. Because the other cell types that are targeted by the split-Gal4 line, like PEG cells, have somas that are spatially intermingled with those of PFL3 cells, we could not simply count the number cell bodies in the dorsal part of the brain to determine the number of PFL3 cells targeted by TNT in each fly. We instead visually inspected the anatomical z-stacks and estimated the number of discernible neurites that projected from the fan-shaped body to each side of the LAL. This approach yielded, on average, an estimate of approximately 10 PFL3 cells targeted by TNT in each brain (57C10-AD ∩ VT037220-DBD: 9.65 ± 1.68, 27E08-AD ∩ VT037220-DBD: 9.89 ± 1.51, mean ± s.d.).

Fly tethering and preparation

We glued flies to custom holders that allowed for physiological measurements from the brain, under a saline bath, while the body remained dry and capable of executing tethered locomotor behaviour, as described previously33,34. When imaging neuronal activity in the protocerebral bridge or performing electrophysiology, we tilted the fly’s head down such that the brain was viewed from the posterior side. When imaging neuronal activity in the LALs or the fan-shaped body, the fly’s head was not tilted and the brain was viewed from the dorsal side. Glue was added at the junction of the fly’s thorax and wings (that is, around the scutellum) to prevent tethered flight and the proboscis was glued to the head to minimize brain motion associated with large proboscis movements. Brains were exposed by cutting and removing a small piece of cuticle with a 30-gauge syringe needle followed by removal of trachea and fat cells overlying the brain with forceps.

For closed-loop wind experiments, in which physiology was not performed simultaneously, we pin-tethered flies to a tungsten pin. Glue was added between the head and the thorax to prevent head movements. Glue was also added around the scutellum, to glue the wings to the thorax, to prevent tethered flight.

A previous study11 noted that wild-type flies typically perform menotaxis behaviour when food deprived for 8–16 h and heated to 34 °C. In the present study, we noticed that for some genotypes, the same level of food deprivation would yield unhealthy flies. As such, we opted for a shorter period of food deprivation for most experiments. We typically performed experiments at least 3 h after tethering flies. During this interval, we kept tethered flies inside a box with a wet piece of tissue paper to prevent desiccation. For FC2 stimulation experiments, we placed flies on plain agarose roughly 14 h before tethering. In all plate-tethered experiments, we heated the tethered fly by perfusing 26–30 °C saline over the fly’s head using a closed-loop temperature control system (Warner Instruments, CL-100). For pin-tethered experiments, we heated flies using a 980 nm infrared diode laser (RLDH980-200-3, Roithner). The intensity of the laser was controlled via pulse-width modulation in closed loop with a temperature reading from a thermal camera image (C2, Teledyne FLIR). The temperature set point was assigned to be 32 °C for TNT experiments and 35 °C for shibirets experiments.

Virtual reality setup

For both two-photon calcium imaging and patch-clamp experiments, we placed flies in a virtual reality setup described previously34. In brief, tethered flies were positioned over an air-cushioned foam ball2,34 (Last-A-Foam FR-4618, General Plastics) that had a diameter of 8 mm. The ball’s movements were visualized with a Chameleon CM3-U3-13Y3M (Teledyne FLIR) camera, whose 3D pose was tracked at 50 Hz using FicTrac55. We used a cylindrical LED display that spanned 270° of angular space around the fly35. In all experiments, the fly’s yaw rotations on the ball controlled the position of an 11°-wide vertical blue bar34. We covered the arena with sheets of blue gel filter (Tokyo Blue, Rosco) in order to prevent blue light bleed-through into the photomultiplier tubes. In patch-clamp experiments, we placed a steel mesh in front of the arena to electrically shield the headstage, as well as a nylon mesh to minimize reflections.

For closed-loop wind experiments, we used a similar virtual reality setup, but with the addition of a device that could deliver wind from 36 directions around the yaw axis, first described in ref. 45. The design of this device took inspiration from past wind-delivery devices for Drosophila56,57,58,59. In brief, the wind device consisted of two separate parts: a circular manifold surrounding the fly and a rotating spigot, which could deliver wind to the tubes in the manifold. The rotating spigot was placed outside the LED arena. Both components were assembled from a set of custom 3D printed parts (PolyJet plastic). The circular manifold had 36 equally spaced openings and these were connected to the rotating spigot via 36 transparent plastic tubes (internal diameter 1/16 inch, Tygon E-3603, Saint-Gobain). The spigot received pressurized, filtered, air from the wall, whose flow rate was regulated by a mass flow controller (Alicat Scientific). A stepper motor was used to rotate the spigot, thereby changing which tubes in the manifold expelled air. Because the spigot’s nozzle was 20° wide, it spanned two to three openings at any one time. The position of the spigot was controlled in closed loop with the yaw rotations of the ball using the same controller system used to update the position of the vertical blue bar on the LED arena. Importantly, because the airflow tubes were fixed in place, wind rotating around the fly did not present a confounding visual stimulus. The flow controller was used to turn the air on and off over the course of an experiment. During the ‘wind period’, the airflow entering the spigot was set to 1 standard litre per minute (slpm), except for no wind control experiments in which the airflow was set to 0 slpm. For these experiments, data were collected on two separate rigs that were constructed to be as identical as possible.

Calcium imaging

We performed two-photon calcium imaging as described34, with certain changes indicated below. We used a Scientifica Hyperscope and a Chameleon Ultra II Ti:Sapphire femtosecond pulsed laser (Coherent) tuned to 925 nm. We performed volumetric imaging, using galvo-galvo mode (Cambridge Technologies MicroMax) to scan the xy plane and a piezo device (PI, P-725.4CA) to move a 16×/0.8 NA objective (Nikon) along the z axis. Emission light was split using a 565 nm dichroic mirror. We used a 500-550 nm bandpass filter for the green signal and a 590–650 nm bandpass filter for the red signal. Emission photons were detected and amplified using GaAsP detectors (Hamamatsu, H10770PA-40). ScanImage60 (2018b) software was used to control the microscope.

For Fig. 5a–d, we used ScanImage’s MultipleROI feature to define two 50 × 50-pixel ROIs for each side of the LAL. We scanned the LAL with two z slices per volume, yielding a volume rate of 9.16 Hz. For Fig. 1, we scanned the protocerebral bridge or the fan-shaped body at 4.95 Hz using a 128 × 64-pixel ROI with 3 z slices. In standard imaging experiments (Figs. 1 and 5a–d), we used a laser power of ~25 mW (measured after the objective). Imaging recordings lasted up to 26 min. Occasionally, the fly’s brain would slowly sink over the course of a recording. To correct for this motion, we manually adjusted the position of the objective via a microscope-stage motor during the recording.

Optogenetic stimulation during imaging

We used the same two-photon light path to image and focally stimulate neurons, using ScanImage’s MultipleROI feature. We defined two ROIs which we refer to as the imaging ROI and the stimulation ROI (Extended Data Fig. 4a). The imaging ROI included the entire structure of interest (LALs or fan-shaped body). We scanned this ROI with a low laser power (10 mW), which did not change throughout the recording. The stimulation ROI was smaller than the imaging ROI. We scanned the stimulation ROI with a higher laser power (50 or 70 mW) and the location of this ROI changed throughout a recording. Within each z slice, we first scanned the imaging ROI and then the stimulation ROI. We only used pixel values from the imaging ROI for the analysis of fluorescence changes. We used a MATLAB script to change the location of the stimulation ROI automatically during an experiment. To register the timing of a change in the location of the stimulation ROI, we recorded the x and y galvo positions over time.

For Fig. 2, we alternated between stimulating one of two positions in the fan-shaped body (referred to as location A and B). When we wished to not stimulate any fan-shaped body location—that is, between trials—we positioned the stimulation ROI to a more anterior position in the brain, which lacked CsChrimson-tdTomato expression (Extended Data Fig. 4b). This approach ensured that the average laser power per volume remained constant throughout the experiment, which is important because flies could show behavioural reactions to changes in illumination intensity. We used a stimulation power of ~50 mW in these experiments. We imaged three z slices and the stimulation ROI existed in all three slices. The acquisition rate was 3.32 Hz. The duty cycle was ~0.67 (the number of pixels in the stimulation ROI divided by the total number of scanned pixels). If we acquired more than one recording per fly, the locations of the stimulation and imaging ROIs were adjusted as needed between recordings.

For Fig. 5e–h, we alternated from stimulating the left or right LAL. Between trials, we moved the stimulation ROI to a location anterior to the LAL that did not have any CsChrimson-tdTomato expression. We used a stimulation power of ~70 mW in these experiments. We used a single z-slice to scan the LAL with an acquisition rate of 4.97 Hz and the duty cycle was ~0.33.

We used a lower laser power in the imaging ROI so as to minimize two-photon excitation of CsChrimson. However, we noticed that during the inter-trial period the FC2 activity sometimes appeared non-physiological. For instance, the middle columns of the fan-shaped body, which are located more superficially, sometimes appeared to be persistently active during the inter-trial period, irrespective of the fly’s behaviour (for example, Fig. 2c). We therefore suspect that at even low laser intensities we might have been optogenetically stimulating neurons to some extent. We therefore did not analyse the fly’s behaviour during inter-trial periods because these were associated with unphysiological activation of the system.

Patch-clamp electrophysiology

We performed patch-clamp experiments as described previously33, with some changes indicated below. We perfused the brain with an extracellular solution61 bubbled with carbogen (95% O2, 5% CO2). The composition of the extracellular solution (in mM) was as follows: 103 NaCl, 3 KCl, 5 TES, 10 trehalose dihydrate, 10 glucose, 2 sucrose, 26 NaHCO3, 1 NaH2PO4, 1.5 CaCl2 and 4 MgCl2 (280 ± 5 mOsm). The composition of the intracellular solution61 (in mM) was as follows: 140 potassium aspartate, 1 KCl, 10 HEPES, 1 EGTA, 0.5 Na3GTP, 4 MgATP (pH 7.3, 265 mOsm). For some recordings the solution also included 13 mM biocytin hydrazide (Invitrogen, B1603) and 20 mM Alexa Fluor 568 (Invitrogen, A10437), which could be used to fill the neuron for subsequent verification of the identity of the cell from which we were recording.

We illuminated the fly’s brain via an 850 nm LED (Thorlabs) coupled to an achromatic lens pair (MAP10100100-A, Thorlabs) that focused the light from the LED onto a small spot on the fly’s head. We used borosilicate patch pipettes (BF150-86-7.5, Sutter Instruments) with resistances of 6-13 MΩ. Recordings were conducted in current-clamp mode (MultiClamp 700B, Molecular Devices) with zero injected current. The voltage signal was low-pass filtered at 4 kHz before sampling at 10 kHz. Plots have been corrected for a 13-mV liquid-liquid junction potential. For recordings in which we included biocytin hydrazide and Alexa Fluor 568 in the intracellular solution, we visualized the recorded, filled cell, by taking a manual z-stack on our epifluorescence patch-clamp microscope while illuminating with a 565 nm LED (pE-100, CoolLED). We also dissected the brain and performed immunohistochemistry, staining for biocytin, to verify the patched cell’s identity and anatomy.

Because the split-Gal4 line that we used for patch-clamp experiments (VT00355-AD ∩ VT037220-DBD) labels both PFL3 and PEG neurons (Extended Data Figs. 1f,g and 6a), we initially verified the cell type identity of all cells to be included in this paper via immunohistochemistry. Three PEG neurons and eight PFL3 neurons were identified by this method. Since recordings of verified PFL3 and PEG neurons were clearly distinguishable by their spike amplitudes and resting potential dynamics (Extended Data Fig. 6a–c), we classified the remaining recordings based on these electrophysiological criteria (7 PEG neurons and 13 PFL3 neurons).

To help categorize a recorded PFL3 neuron as innervating the left or right LAL, we targeted PFL3 cells with somas far from the midline as these PFL3 cells project exclusively to the contralateral LAL. Of the eight PFL3 neurons whose anatomy we verified via immunohistochemistry, all projected to the contralateral LAL. For an additional two PFL3 neurons we were able to verify that they projected contralaterally via the epifluorescence z-stack. We classified the remaining 11 PFL3 neurons based on their soma location. We discarded one recording from a soma located close to the midline since its identity as a left or right PFL3 could not be definitively established.

Because our recordings could approach 2 h in length, we sometimes observed a slow depolarizing drift in the membrane potential over time, accompanied by a decrease in spike size, consistent with a slowly increasing access resistance. We trimmed these recordings by visual inspection to only include the portion in which the membrane potential and spike size were stable. Four cells were discarded as there was no period when these criteria were met. After trimming, the average recording duration was 46 min (ranging from 6 to 120 min).

Experimental structure

In all physiological experiments, we allowed the fly to walk in closed loop with the bar for approximately 5–30 min as we prepared for data collection (that is, during desheathing and seal attempts in patch-clamp measurements or during ROI selection in imaging experiments). This time period gave the fly experience with all possible angular bar positions, which is expected to reinforce the formation of a stable map between the position of the bar on the screen and the EPG heading-estimate in the central complex41,42.

For menotaxis experiments (Figs. 1, 3 and 5a–d), we used bar jumps (that is, virtual rotations of the fly) to periodically assess whether the fly was actively maintaining its heading direction. Bar jumps served the additional role of ensuring that a fly sampled heading angles away from its goal angle, which allowed us to generate tuning curves to heading. Specifically, every 2 min, we instantaneously repositioned the bar by ±90° from its current position. The bar then remained static at this new location for 2 s, after which it returned to being under closed-loop control by the fly. For Figs. 1 and 5a–d each recording included five +90° bar-jump events and five –90° bar-jump events, presented in a random order. We typically collected two recording files from a given fly (a few flies had one or three recordings). In electrophysiology experiments, which could sometimes run as long as 2 h, bar jump events occurred throughout, until the end of an experiment.

For the stimulation experiments in Fig. 2, each recording consisted of five location A and five location B trials, alternating repetitively (that is, not randomized). The stimulation period lasted 30 s and the inter-trial period lasted 60 s. We collected up to two recording files from a given fly.

For the stimulation experiments in Fig. 5e–h, each fly experienced five left and five right LAL stimulation trials, presented in a random order. The stimulation period lasted 2 s and the inter-trial period lasted 30 s. We collected one recording file per fly.

For the wind-induced memory task (Fig. 6), each fly experienced six different allocentric wind directions (that is, the angle of the wind relative to the bar) in blocks of three trials with a constant allocentric wind angle, for a total of eighteen trials. The 6 wind directions we presented were –135°, –90°, –45°, +45°, +90° and +135°. These angles were selected based on two considerations. First, we wished to avoid allocentric wind directions in which the bar would be located in the 90° gap at the back of the LED arena when the fly is oriented upwind (that is, a 180° allocentric wind direction) since without a visual cue flies are expected to have a poorer estimate of their heading angle. Second, we wished to avoid allocentric wind directions in which the bar would be located directly in front of the fly when orienting upwind (that is, a 0° allocentric wind direction) because orienting toward a bar (that is, front-fixation) is not expected to require a heading versus goal comparison in the central complex11,37. Wind directions were presented in one of two orders, either (–135°, –90°, –45°, +45°, +90°, +135°) or (+135°, +90°, +45°, –45°, –90°, –135°), with the exact order chosen randomly for each fly. For each trial, airflow remained on for 30 s and was followed by a 2-s, 180° bar jump after the airflow was turned off. The bar jump ensured that if flies simply kept walking straight after the airflow turned off, this would not lead to a high performance index or indication of angular memory. The inter-trial period, which also included the ‘test’ period where we assessed the flies’ wind-induced heading memory, lasted 60 s. There was a 3-min period in between the end the wind period of the last trial of a wind-direction block and the start of the wind period of the next wind-direction block. We collected one recording file per fly. In preliminary experiments, it seemed that flies formed stronger wind-induced memories of an allocentric direction when the six possible wind directions were presented in a consistent, clockwise or anticlockwise sequence—as was done in the reported experiments—rather than appearing in a completely random sequence. This observation makes ethological sense in that allocentric wind presented from very different directions over time might lead flies to downgrade the relevance of wind, very generally, as a useful stimulus for allocentric navigation.

Data acquisition

All time series data were digitized with a Digidata 1440 A (Molecular Devices) at 10 kHz using the PClamp software suite (Clampex and Axoscope 10.7.03), except two-photon images, which were saved as tiff files using ScanImage at frequencies ranging from ~4-10 Hz, as described above. To align imaging data with behavioural data, we used a voltage signal of the y galvo flyback, which marks the end of an imaging frame, as an alignment point. For each imaging volume, the midpoint between the start of the volume’s first z-slice and the end of its last z-slice was used as its time stamp.

Data analysis

Processing of behavioural data

The yaw, pitch, and roll angles of the ball were sampled at 50 Hz, and aligned to our imaging data files using the ball camera’s trigger signal. We shifted the acquired ball-position data backward in time by 30 ms due to our measured latency between the trigger pulse for acquiring a frame and when FicTrac finished processing the image. For behaviour only closed-loop wind experiments—which did not require aligning behavioural and neuronal data—no camera triggers were used and all signals were downsampled to 50 Hz.

For Figs. 1 and 5b and Extended Data Figs. 3, 4, 8 and 9g,j we used a 500-ms boxcar filter to smooth the forward walking velocity or turning velocity signal. For several analyses we excluded timepoints when the fly was standing still, or nearly still, which we defined as any moment when the fly’s filtered forward walking velocity was ≤1 mm s−1. The fly’s virtual 2D trajectory was computed using the bar position, to estimate the fly’s heading, alongside the sideward and forward ball rotations to estimate the fly’s translational velocity. In Fig. 1, to visualize the relationship between neuronal phases and the fly’s orientation over time, we plotted the position of the bar on the arena (instead of the fly’s heading) since the EPG phase tracks the inverse of the fly’s heading (which is equivalent to the bar position)4. In Fig. 2, we flipped the heading direction x-axis to make it easier to compare with Fig. 1.

Processing of menotaxis behavioural data

To analyse the fly’s menotaxis behaviour, we isolated straight segments (which we call menotaxis bouts) of the fly’s 2D virtual trajectory using the Ramer–Douglas–Peucker algorithm62,63 (Extended Data Fig. 2a–e). This algorithm simplifies a set of x, y coordinates by iteratively reducing the number of points in the trace. The parameter ε determines the maximum allowed distance between the simplified and original trajectories. We then computed the fly’s displacement L for each segment of the simplified trajectory. For all analyses we used ε = 25 mm and only analysed segments with L > 200 mm. In other words, we analysed menotaxis bouts where the fly displaced itself more than 200 mm (roughly equivalent to 70 body lengths), without deviating from its course by more than 25 mm (roughly 8 body lengths). Aside from bar-jump (that is, virtual rotation) experiments (where we used the pre-jump heading angle as the fly’s goal angle) and Extended Data Fig. 10a (see ‘LAL imaging analysis’), we defined the fly’s goal angle as the mean heading angle during each menotaxis bout. For this calculation, we excluded timepoints when the fly was standing still.

The values chosen for parameters ε and L were conservative, in that they tended to break up portions of the fly’s trajectory where one might have considered the fly’s goal to have remained unchanged into smaller bouts. We preferred this bias over the risk of potentially lumping two bouts together, where the fly’s true goal angles might have been different.

To obtain a continuous estimate of the stability of the flies’ heading angle (Extended Data Fig. 3o,p), we computed the flies’ mean heading vector length (R) similarly as described previously11. In brief, each heading sample point was treated as a unit vector. Each timepoint was then assigned a value of R by taking the mean of the heading vectors within a 30, 60 or 120 s window centred on that timepoint. For this calculation, timepoints in which flies were standing still were first omitted (since this would increase the value of R for trivial reasons); trajectories were concatenated across the omitted standing events, such that analysis windows were not necessarily analysing a continuous trace in time.

Processing of imaging data

To correct for motion artefacts, we registered two-photon imaging frames using the CaImAn64 Python package. We defined ROIs for the left and right side of the LAL, the glomeruli of the bridge and columns of the fan-shaped body using a custom graphical user interface written in Python. ROIs were manually drawn using either the time averaged signal or the local correlation image of each z slice. In the case of the fan-shaped body, we used a semi-automated method to define columns as described previously4. In brief, we first defined an ROI including the entire fan-shaped body. This ROI was then subdivided into 16 columns of equal angular size using two lines that defined the lateral edges of the fan-shaped body. For each ROI, we defined ΔF/F0 as equal to (F − F0)/F0, where F is the mean pixel value of an ROI at a single timeframe and F0 is the mean of the lowest 5% of F values.

Neuronal phase analysis

We computed the FC2 phase in the fan-shaped body using a population vector average2,4. We computed the EPG phase in the protocerebral bridge as described previously4,34. For each timepoint, we treated the glomeruli ΔF/F0 in the bridge as a vector of length 16 and took the Fourier transform of this vector. The phase of the Fourier spectrum at a period of 8.5 glomeruli was used as the EPG phase.

To overlay the FC2 or EPG phase with the bar position (Fig. 1 and Extended Data Fig. 3), we subtracted from the phase its mean offset from the bar position. This offset was calculated, for each recording, by taking the mean circular difference between the phase angle and bar angle, excluding timepoints when the bar was in the 90° gap at the back of the arena or when the fly was standing still. In Fig. 1m,n and Extended Data Fig. 3c,d, we nulled the FC2 or EPG phase in the baseline period by subtracting its mean position, 1 s prior to the bar jump, from every sample point. In Fig. 1o and Extended Data Fig. 3e, we calculated the mean of this adjusted phase during the last 1 s of the open-loop period after a bar jump. To combine +90° and –90° bar jumps for analysis, the mean phase in the last 1 s of the open-loop period was multiplied by −1 for −90° jumps.

In Fig. 1m–o, we imposed strict requirements for a bar jump trial to be included in the analysis. First, the bar jump needed to occur during a menotaxis bout (see ‘Processing of menotaxis behavioural data’). Second, we required that the fly return to its previous heading angle following a bar jump —that is, trials when the mean bar position from 5 to 10 s after the start of the bar jump was within 30° from the mean bar position 5 s before the bar jump. Third, the bar needed to jump to a visible position on the arena (rather than the rear 90°, where we had no LED panels). Finally, we only included trials when the FC2 or EPG population vector average amplitude (PVA) (see Extended Data Fig. 3k for a description of how the PVA is computed) was greater than 0.3. These criteria were sensible, in that they selected for trials where we could be confident that the fly’s goals had not drifted and that our neural signal estimates were of high quality. However, they were stringent enough that they led us to analyse only 7% of all trials. In Extended Data Fig. 3c–e, we eliminated the first two of these requirements, leading us to analyse 59% of all trials and the results were generally the same.

We used the corrcc function from the pycircstat python package ( to compute the correlation between the EPG or FC2 phase and the bar position. For this calculation we excluded timepoints when the fly was standing still or when the bar was located in the 90° gap.

In Extended Data Fig. 3f,g, rapid changes in the FC2 phase position were detected by finding peaks in the filtered phase velocity (500-ms boxcar filter) using the SciPy65 function signal.find_peaks. In addition, we required that the FC2 PVA within 1 s from the peak phase velocity was above 0.15 at all timepoints and that the mean PVA during this time was above 0.25. These criteria helped ensure that genuine changes in the FC2 bump position were detected rather than spurious changes in the FC2 phase due to a poorly estimated phase. To overlay all of the detected changes in FC2 phase position, as well as the flies’ heading during these moments (Extended Data Fig. 3g), we aligned traces to the start of the peak in phase velocity. In order to combine traces where the peak in the FC2 phase velocity was either positive or negative, we flipped the FC2 phase for traces where the peak phase velocity was positive.

Neuronal activity bump analysis

In Extended Data Fig. 3l–n,p,q, we used three different metrics to quantify the EPG or FC2 activity/bump at every timepoint: the population vector average amplitude (PVA), the mean ΔF/F0 taken across all column or glomerulus ROIs and the maximum − minimum ΔF/F0 (column or glomerulus ROI with maximum ΔF/F0 minus column or glomerulus ROI with the minimum ΔF/F0). In Extended Data Fig. 3q, for each fly, we binned data points based on the fly’s forward walking velocity or turning velocity and computed the mean FC2 activity/bump metric for each bin. Likewise, in Extended Data Fig. 3p, we binned data points based on the fly’s instantaneous mean heading vector length (see ‘Processing of menotaxis behavioural data’) and computed the mean FC2 activity bump metric for each bin. Timepoints in which flies were standing still (that is, when the mean forward walking speed was below 1 mm s−1) were removed from the time series before performing this analysis because the fly’s mean heading vector length is undefined during standing events.

FC2 stimulation analysis

To compare the effect of columnar stimulation of FC2 neurons across flies, we nulled the heading angle using the following procedure. For each fly, we computed its mean heading during a stimulation A trial, excluding timepoints when the fly was standing still. We then took the mean heading across all stimulation A trials and subtracted this value from the fly’s heading angle in all trials. The histograms in Fig. 2c–f used 10° bins and also excluded timepoints when the fly was standing still. In some trials, flies were standing still throughout the entire trial (1.7% of all trials), which resulted in the trial being discarded for relevant analyses.

For Extended Data Fig. 4c, an ROI was considered inside the stimulation ROI if it had at least one pixel within the boundaries of the stimulation ROI scan path and was otherwise considered outside the stimulation ROI. In Extended Data Fig. 4d, we only analysed ROIs that were outside the stimulation ROI. The change in the column ROI ΔF/F0 was computed by dividing the mean ΔF/F0 during the 30 s stimulation period by the mean the ΔF/F0 during the 5 s before the stimulation. To calculate an ROI’s distance from the stimulation site (in number of ROIs), we first defined the stimulation site as the column ROI with the highest fraction of pixels inside the stimulation ROI. For each ROI we then computed its wrapped distance in number of ROIs. For instance, column ROI 2 and column ROI 15 have a (wrapped) distance of three, given that there are 16 columns in our analysis. Since our stimulation ROI could overlap with multiple column ROIs, in Extended Data Fig. 4d, there are no column ROIs with a distance of one.

In Extended Data Fig. 4e, to compute the stimulation location angle, we treated the fraction of pixels of each column ROI that were inside the stimulation ROI (see red colour map in Fig. 2c,d) as an array. Using this array, we computed the stimulation location angle with the same population vector average method used to compute the FC2 phase. We then took the mean difference between the two stimulation phases (A and B) for each fly. To compute the mean FC2 phase position during the stimulation period (Extended Data Fig. 4f–h), we excluded timepoints when the fly was standing still.

In Extended Data Fig. 4i–k, for each fly and stimulation location, we predicted the fly’s goal heading by adding the angular difference between the two stimulation locations in the fan-shaped body (as described above) to the fly’s mean heading direction during trials of the opposite stimulation location.

In Extended Data Fig. 4i, we grouped trials based on the fly’s heading relative to the predicted goal heading 2 s before the stimulation onset. In Extended Data Fig. 4j, we instead grouped trials based on whether the fly was standing still prior the stimulation onset (defined as any trial where the fly’s filtered forward walking velocity was below 1 mm s−1 at all timepoints 5 s before the start of the stimulation).

LAL imaging analysis

To detect transient increases in LAL asymmetries (Fig. 5b,c), we first smoothed the right – left LAL ΔF/F0 signal using a Gaussian filter (σ = 200 ms). We then detected peaks in the filtered signal using the SciPy function signal.find_peaks. Peaks were defined as timepoints where the filtered signal was above 0.1 ΔF/F0 for at least 1 s, spaced from other peaks by at least 3 s, and had a prominence of one. To detect transient decreases in LAL asymmetries, we flipped the right – left LAL ΔF/F0 signal and then applied the same algorithm. In Fig. 5c, we aligned the fly’s turning velocity and the right – left LAL ΔF/F0 signal to the timepoint of the peak neural signal and upsampled both the fly’s turning velocity and the right – left LAL ΔF/F0 to a common 100 Hz time base. In Extended Data Fig. 10a, we plot the exact same data as in Fig. 5c, but instead show the flies’ heading relative to goal (rather than the rate of change of that signal or turning velocity) in reference to the neural peaks. For this analysis only, we defined the fly’s goal angle as the mean heading angle in a 60 s window sliding window. We obtained similar results when only looking at peaks that occurred during a menotaxis bout, where we could define the goal in our more standard way.

To plot the LAL activity as a function of the fly’ heading relative to its goal angle (Fig. 5d), we only analysed data during menotaxis bouts (see ‘Processing of menotaxis behavioural data’). Because there is a ~200 ms delay between a change in the fly’s heading and a change in the EPG phase34, we expected the LAL ΔF/F0 signal to be likewise delayed relative to behaviour. Therefore, in Fig. 5d only, we shifted the LAL ΔF/F0 signal forward in time by ~218 ms (2 imaging volumes) prior to relating the signal to the fly’s behaviour. We believe that this is the most appropriate signal to analyse, but our conclusions are the same if we do not apply this shift. For each fly, we calculated the mean LAL ΔF/F0 by binning the data based on the fly’s heading relative to its goal using 10° bins. Timepoints in which flies were standing still were removed from the time series prior to analysis.

Processing of electrophysiological data

To detect spikes, we first filtered the membrane voltage (Vm) trace with a Butterworth bandpass filter. We then detected peaks in the filtered Vm trace above a specified threshold, spaced by >5 ms, using the SciPy function signal.find_peaks. Although this criterion means we could not detect spike rates above 200 Hz, the activity levels of all our cells stayed well below this upper limit. Different cut-off frequencies and thresholds were hand selected for each cell so as to yield spike times that matched what one would expect from visual inspection of the data. To remove spikes from the Vm trace—for analyses of the membrane voltage in Fig. 3c,d and Extended Data Figs. 6d, 7c,d and 9b,c—we discarded Vm samples within 10 ms of a spike by converting those samples to empty entries (that is, the not-a-number (NaN) data type).

When analysing electrophysiological data in comparison to the fly’s heading or goal angle (Fig. 3c–f and Extended Data Figs. 6–9), we downsampled the cell’s Vm or spike rate to the ball camera frame rate (50 Hz) by either averaging the spike-rate or the spike-removed Vm in the time interval between two camera triggers. In Fig. 3b we plotted the spike rate using a 1-s boxcar filter.

Tuning curves

To generate the tuning curves in Fig. 3c,d, we binned the electrophysiological time series data according to the fly’s heading, using 15° bins. We then calculated the mean spike rate and the spike-removed Vm for each bin. To estimate a cell’s preferred heading angle, we fit the spike-removed Vm tuning curve with a cosine function, with the offset, amplitude and phase of the cosine (the phase is the resulting preferred angle) as fitting parameters. In performing this fit, we excluded timepoints when the bar was located in the 90° gap at the back of the arena because the EPG system is expected to track the fly’s heading less faithfully during these moments2,34,39. We used Vm rather than spike rate for estimating the cell’s preferred heading angle because Vm was much less modulated by the fly’s goal angle than the spike rate (Extended Data Fig. 7), and thus it was less likely to lead to goal-modulation-related biases in our estimate of the preferred heading angle.

For Fig. 3e, f and Extended Data Figs. 7, 8, we only analysed data from timepoints that contributed to a menotaxis bout (see ‘Processing of menotaxis behavioural data’). For each bout, we computed a relative goal angle by subtracting the cell’s preferred heading angle from the fly’s goal angle. Likewise, for each timepoint, we computed a relative heading by subtracting the cell’s preferred heading angle from the fly’s current heading angle. We then calculated the mean firing rate (or spike-removed Vm) binned by the fly’s relative goal angle using 45° bins (columns in Fig. 3f) and by the fly’s relative heading angle, also using 45° bins (x-axis in Fig. 3f). To generate tuning curves (except Extended Data Fig. 8), we removed timepoints when the fly was standing still for the time series, before analysis. By contrast, for Extended Data Fig. 8c–e we only included timepoints when the filtered forward walking velocity of the fly was between −0.5 mm s−1 and 0.5 mm s−1 and the fly’s turning velocity was between –5° s−1 and 5° s−1 (that is, the fly was standing still and not turning in place rapidly).

Fitting the PFL3 tuning curves

The data contributing to the tuning curves in Fig. 3f were binned according to the heading and goal angles relative to the electrophysiologically preferred heading angle of the cell being studied, which was always made to equal zero. We refer to these relative heading and goal angles as H′ and G′ and we expressed the PFL3 activity in the single-cell model as \(f(\cos \left({H}^{{\prime} }\right)+d\cos ({G}^{{\prime} }-{G}_{\text{pref}}+{H}_{\text{pref}}))\), with \(f(x)=a\log (1+\exp (b(x+c)))\). This form for f, which is called a softplus function, was suggested by examining the shifted spike-rate versus Vm curves in Extended Data Fig. 9c (see below). We then fit the parameters GprefHpref, d, a, b and c by minimizing the squared difference between f and the data. The same value of Gpref – Hpref was used for each cell. The optimal parameters were Gpref – Hpref = −48°, d = 0.63, a = 29.23 Hz, b = 2.17, c = −0.7. The connectomic analysis discussed in the next section indicates that the difference between the preferred heading and goal angles, Gpref – Hpref, is expected to be −67.5°, on average. Several technical and biological reasons could account for the difference between the expected and fitted values. For example, a misestimation the cell’s preferred heading direction (see ‘Tuning curves’) could cause the measured Gpref – Hpref to be smaller than its average anatomical value. In the full model, described in ‘Full PFL3 model’, we used the angles from the connectome analysis.

Fitting our model to the mean turning curves in Fig. 3f accounted for 95% of the variance in these data. In addition, we used our model, with the above parameter values, to predict the time series of the firing rates of individual PFL3 neurons during menotaxis over 20 ms intervals. The model accounted for ~30% of the variance in these unaveraged data. The relatively low amount of variance explained is unlikely the result of tuning to either forward or angular velocity because averaged data that depended only on heading explained 93% and 92% of the variance of the heading/forward velocity and heading/angular velocity data shown in Extended Data Fig. 8a,b. An analysis of spike count variability showed approximately Poisson spike-count variability, and this is a likely source of the extra variance in the unaveraged data.

For the fits shown in Extended Data Fig. 6d, the data were fit to \(A\cos (H-{H}_{\text{pref}})+{V}_{0}\), with A, Hpref and V0 as fitting parameters, by minimizing the squared difference between this expression and the data points.

Spike-rate versus V
m curves

Extended Data Fig. 9b shows the relationship between the spike-rate and Vm (spikes removed) obtained from our whole-cell recordings. To generate this plot, we used the data shown in Fig. 3 and Extended Data Fig. 7 (that is, we included timepoints when the fly was performing menotaxis and not standing still). We binned the data according to the fly’s goal angle relative to the cell’s preferred heading angle (using the same 45° bins as in Fig. 3 and Extended Data Fig. 7) and also according to each cell’s Vm (4 mV bins). We used a cut-off of −46 mV, since at more depolarized membrane potentials spikes were not as well estimated and might have been missed. To include right PFL3 neurons in this analysis, we flipped the goal heading relative to the cells’ preferred heading values of right PFL3 cells prior to averaging across all cells.

To generate Extended Data Fig. 9c, in which the curves from Extended Data Fig. 9b are aligned, we shifted the curves for different goal directions along the horizontal (Vm) axis by amounts determined to minimize the squared difference between the spike rates in each bin across the different goal directions and a common function of the form \(f(x)=\alpha \log (1+\exp (\beta ({V}_{{\rm{m}}}^{{\prime} }))\), where \({V}_{{\rm{m}}}^{{\prime} }\) is the shifted membrane potential (black curve in Extended Data Fig. 9c). In other words, we computed the shifts that made the spike-rate curves for different goal directions maximally align. The resulting voltage shifts are plotted in Extended Data Fig. 9d. The parameters α and β of this fit are distinct from the parameters for the fits in Fig. 3f, and it is the parameters of the latter fit that are used to build the full model.

Full PFL3 model

For the full population model, the response of each PFL3 cell is expressed as

$$r=f(\cos (H-{H}_{\text{pref}})+d\cos (G-{G}_{\text{pref}}))$$

with the 12 left and 12 right PFL3 cells all modelled with the same function f and parameters d, a, b and c described in the section on fitting the PFL3 tuning curves. The values of the preferred angles, however, differ across the cells, and their values were obtained from the connectome12,13 (Fig. 4b and Extended Data Fig. 5g). For the preferred goal angles, we used the values Gpref = −(15°, 45°, 75°, 105°, 135°, 165°, −165°, −135°, −105°, −75°, −45°, −15°) for both the left and right PFL3s. For the preferred heading angles, we began by assigning angles to the 18 glomeruli across both sides of the protocerebral bridge, from left to right: −22.5°, 22.5°, 67.5°, 112.5°, 157.5°, −157.5°, −112.5°, −67.5°, −22.5°, 22.5°, 67.5°, 112.5°, 157.5°, −157.5°, −112.5°, −67.5°, −22.5°, 22.5° (Extended Data Fig. 5e). These angles were projected down to the fan-shaped body using the wiring diagram shown in Fig. 4b. There are 18 bridge angles but only 14 of them are used for these projections because the left two outermost glomeruli and the right two outermost glomeruli (first and last two entries in the above list) are not innervated by PFL3 cells. Individual PFL3 cells innervate with their dendrites either one or two of the innermost 14 bridge glomeruli. For the PFL3 cells that innervate two bridge glomeruli, we used the angle corresponding to the innermost of the innervated pair (see Extended Data Fig. 5f,g). The resulting preferred heading angles for the PFL3 population are therefore as follows: for the right PFL3 cells (that is, the PFL3 cells projecting to the right LAL), Hpref = −(67.5°, 112.5°, 157.5°, 157.5°, −157.5°, −112.5°, −112.5°, −67.5°, −22.5°, −22.5°, 22.5°, 67.5°) and, for the left PFL3 cells (that is, the PFL3 cells projecting to the left LAL), Hpref = −(−67.5°, −22.5°, 22.5°, 22.5°, 67.5°, 112.5°, 112.5°, 157.5°, −157.5°, −157.5°, −112.5°, −67.5°). The overall minus sign in these two lists of angles (and in the expression above for the preferred goal direction angles) reflects the fact that angles extracted from the connectome, which are given inside the parentheses, are referenced to the ellipsoid body, whereas the preferred angles listed here are referenced to heading angles, and the EPG bump and heading angles differ by a minus sign. These preferred angles determine the directions of the vectors shown within the fan-shaped body compartments in Fig. 4b, with angles measured positive anticlockwise and the zero-angle pointing directly downward.

In the analysis described in the previous paragraph, we used glomerular angles implied by the Δ7 innervation of the protocerebral bridge (Extended Data Fig. 5e–g). Alternatively, we could have used glomerular angles based on the innervation of EPG neurons (Extended Data Fig. 5c). We opted to use the Δ7 scheme because Δ7 neurons provide the majority of PFL3 neurons’ synaptic input in the protocerebral bridge12,13 (Extended Data Fig. 5a).

We also assumed that the PFL3 cells form twelve functional columns in the fan-shaped body due to anatomical considerations (Extended Data Fig. 5k). PFL3 neurons can, alternatively, be viewed as forming nine columns12. The model was also tested assuming nine columns (in this case, the preferred goal angles used were -(0°, 45°, 90°, 135°, 180°, −135°, −90°, −45°, 0°)), and qualitatively similar results were obtained. Note that in this 9-column angle assignment, the first and last columns represent the same angle, which would mean that the entire left/right extent of the fan-shaped body would encode more than 360º, a feature that we do not favour and which contributed to our using the 12-column model.

To simulate the effect of silencing subsets of PFL3 neurons (Extended Data Fig. 11h), we used the model described above, but set the response of randomly selected PFL3 cells to zero for all heading and goal angles. For each number of PFL3 cells silenced (from 0 to 24), we took the circular averaged error between flies’ intended goal, G, and the zero heading from their PFL3 turning curve across 5,000 simulations. We added noise to the goal direction input of the model, with an amplitude chosen to make the model with no silenced neurons match the performance of PFL3 > TNTinactive control flies.

Predicting PFL3 output using FC2 activity as the goal signal

To predict the PFL3 output signal in Extended Data Fig. 9g,h,j we used our full PFL3 model, as described above. As a goal input to this model, we used our FC2 imaging data during menotaxis. As a heading input to the model, we used a computer-generated (that is, synthetic) EPG and ∆7 heading signal (see below) for each timepoint; we could not use a measured heading input because we did not co-image EPG or ∆7 neurons during the relevant experiments. Before inputting the FC2 imaging data into the model, at every timepoint we first interpolated the ΔF/F0 array of the 16 imaging ROIs to a 12-ROI array in order to match the 12 columns used in our model. We then normalized the interpolated ΔF/F0 of each ROI independently such that each ROI’s signal ranged from negative one (the minimum value observed in the ROI) to positive one (the maximum value observed in the ROI). The resulting activity in each column ROI was used in place of the term \(\cos (G-{G}_{\text{pref}})\) in the equation \(f\left(\cos \left(H-{H}_{\text{pref}}\right)+d\cos \left(G-{G}_{\text{pref}}\right)\right)\) for each PFL3 neuron. To generate the synthetic EPG/∆7 heading signal, we had the phase of the synthetic bumps of activity in the bridge invariably track the angle of the bar on the arena. We time-shifted the phase of the synthetic EPG/∆7 signal forward by ~200 ms in relation to the bar’s instantaneous position on the LED display. This latency was chosen so that the synthetic data accorded as closely as possible with past measurements on how the real EPG/∆7 phase lags changes in bar position34 (Extended Data Fig. 3b). Recall that the EPG phase has a variable, fly to fly, offset to the bar position on the LED screen, which means that there will be an arbitrary offset between the FC2 phase in the brain and the expected bar position that a given fly stabilizes on the LED display. To account for this arbitrary offset, we added a fixed offset to the bar position so that its angular position and the FC2 phase aligned on average—which makes sense if one assumes that flies, on average, maintain a heading that is aligned with their goal angle. We used the inverse of this new, offset, bar position over time as the phase of the EPG/∆7 heading signal (that is, the fly’s heading) or H, in the expression \(\cos (H-{H}_{\text{pref}})\), which determines the heading input into each PFL3 neuron in the model. We could then predict the difference between the left and right population-level PFL3 activity at every timepoint using the same function f and parameters d, a, b and c as in our single-cell model and full PFL3 model. In Extended Data Fig. 9j, we binned data points that fell within a menotaxis bout—excluding timepoints when the fly was standing still—by the fly’s heading relative to goal angle and computed the mean predicted R–L signal and the fly’s filtered turning velocity for each bin. For this analysis, we first shifted the predicted R–L signal by ~200 ms forward in time in time since our LAL imaging data indicates that this is the latency where the relationship between R–L activity and the fly’s heading relative to goal angle is maximal (Extended Data Fig. 10a, see also ‘LAL imaging analysis’). We also shifted the fly’s turning velocity by ~200 ms earlier in time to account for the expected delay between the processing of internal, navigation-related, information to compute the fly’s heading relative to goal error and the execution of a motor command11.

Analysis of the wind-induced angular memory task

In Fig. 6, for each trial, the allocentric wind direction was computed by taking the mean of the difference between the bar position and the spigot angle, at every timepoint, during the time period when the airflow was on. This value was not necessarily identical to the nominal allocentric wind direction set by our code because of inertial/mechanical latencies associated with the air-delivery spigot needing to physically rotate to deliver air from a new direction. The set point and trial-computed allocentric wind direction could differ by up to 13°.

To generate the histograms in Fig. 6e and Extended Data Fig. 11a, we computed the fly’s heading relative to the wind direction by taking the difference between the fly’s heading on the ball and the allocentric wind direction, at every timepoint, during either the 30-s period when the wind was on or during the 30-s period starting 5 s after the wind was turned off, referred to as the test period. In the test period, the allocentric wind direction experienced in the most recent wind-on period was used as the alignment point for the histogram. We did not include the 5 s after the wind was turned off since this time period includes a 2-s open-loop 180° bar jump and because flies do not instantly correct for this virtual rotation.

In Fig. 6f and Extended Data Fig. 11b,c, the absolute distance to wind was taken to be absolute value of the flies’ heading relative to the wind direction, computed as described above.

To generate the plots in Fig. 6h, for each fly and wind-direction block, we computed the flies’ mean heading direction during the test period of the block’s second and third trial and plotted this value as a function of the same block’s mean allocentric wind direction. The absolute difference between these two values yielded the fly’s wind-direction error during the test period, which is plotted, averaged across all six directions, in Fig. 6j. To compute the fly’s wind-direction error in in Fig. 6i, we applied the same analysis as described above, but in this case, we used the flies’ mean heading direction during the wind period.

In Fig. 6k, for each wind-direction block, a fly was considered to have oriented along the correct direction if its wind-direction error during the test period was less than 30°. In other words, its mean heading direction during the test period needed to be within ±30° from the allocentric wind direction.

The flies’ performance index (PI) was defined as the fraction of time that a fly spent oriented toward the 180° hemifield centred on the previously experienced allocentric wind direction minus the fraction of time that a fly spent oriented toward the opposite hemifield (Extended Data Fig. 11d).

For the above analyses (except when computing the allocentric wind direction), we first removed from the time series timepoints when the fly was standing still. Five out of the 331 flies in our dataset stood still during the entire test period of both the second and third trial of at least one of the wind-direction blocks. Because this would result in an undefined goal angle for one of the wind-direction blocks, we excluded these flies from all analyses. Of the remaining 326 flies, 5 flies stood still during either the entire second or the entire third trial of a wind-direction block, which resulted in these flies only having one trial analysed for that wind-direction block.


For Fig. 1o, to assess whether the FC2 phase changed during a bar jump, relative to its position immediately prior, we performed a V-test66 (Rayleigh test for uniformity where the alternative hypothesis is a known mean angle μ) with μ = 0° (P = 6.65 × 10−4). To assess whether the EPG phase tracks the bar during a bar jump we performed a V-test with μ = 90° (P = 7.99 × 10−3). The same tests applied to Extended Data Fig. 3e yielded μ = 0° (P = 7.69 × 10−8) for the FC2 phase and μ = 90° (P = 2.49 × 10−5) for the EPG phase.

For Fig. 2g, to assess whether the difference in flies’ mean heading direction for stimulation A and B was within the expected difference based on the stimulation locations in the fan-shaped body, we performed a V-test with μ equal to the angular difference between the two stimulation location angles (Extended Data Fig. 4e). For flies expressing CsChrimson in FC2 neurons, this was μ = −173.4° (P = 1.49 × 10−3). For control flies that did not express CsChrimson, this was μ = −164.9° (P = 0.93). The expected difference of both groups is not exactly the same since the stimulation ROIs are defined manually without knowledge of the column ROIs (which are only defined later during the imaging analysis).

For Fig. 5h, to assess whether flies expressing CsChrimson in PFL3 neurons showed a change in ipsilateral turning velocity relative to control flies only expressing jGCaMP7f, we performed a two-sided Welch’s t-test (P = 1.93 × 10−5). To compare flies expressing CsChrimson in PFL1 neurons with control flies we used a two-sided Welch’s t-test (P = 0.76).

For Fig. 6j, we performed a two-sided Mann–Whitney U-test to assess whether flies expressing TNT in neurons labelled by PFL3 line 1 (57C10-AD ∩ VT037220-DBD) had a lower error during the test period than control flies expressing TNTinactive instead. This yielded P = 0.05 for our first experimental replicate (rep. 1) and P = 1.20 × 10−6 for our second experimental replicate (rep. 2). To combine these two P values, we used Fisher’s method, which yielded P = 1.08 × 10−6. Likewise, in Extended Data Fig. 11e, we applied the same test to assess whether flies expressing shibirets in neurons labelled by PFL3 line 1 had a lower error during the test period than control flies in which shibirets was driven by an empty split driver line (P = 0.29) and whether flies expressing TNT in neurons labelled by PFL3 line 3 (27E08-AD ∩ VT037220-DBD) had a lower error during the test period than flies expressing TNTinactive instead (P = 0.05). We also performed a two-sided Mann–Whitney U-test to assess whether PFL3 line 1>TNT flies (rep. 2) had a greater error during the wind-on period than TNTinactive control flies (P = 3.15 × 10−3). In Extended Data Fig. 11g—in which we selected flies whose wind-direction error during the wind-on period was between 12° and 45°—we performed the same test to assess whether PFL3 line 1>TNT flies (rep. 2) had a lower error during the test period than TNTinactive control flies (P = 6.47 × 10−4). For Fig. 6k and Extended Data Fig. 11f, we performed two-sided Mann–Whitney U-tests to assess whether flies with PFL3 cells targeted for silencing oriented along fewer correct goal directions during the test period than control flies: PFL3 line 1>TNT versus PFL3 line 1>TNTinactive (rep. 1: P = 0.04, rep. 2: P = 5.25 × 10−7 and Fisher’s method: P = 3.90 × 10−7), PFL3 line 3>TNT versus PFL3 line 3>TNTinactive (P = 0.07) and PFL3 line 1>shibirets versus empty split>shibirets flies (P = 0.15).

All p-values are reported without correction for multiple comparisons.

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 *