{"id":779355,"date":"2026-07-23T06:21:11","date_gmt":"2026-07-23T06:21:11","guid":{"rendered":"https:\/\/www.newsbeep.com\/us\/779355\/"},"modified":"2026-07-23T06:21:11","modified_gmt":"2026-07-23T06:21:11","slug":"a-vector-based-strategy-for-olfactory-navigation-in-drosophila","status":"publish","type":"post","link":"https:\/\/www.newsbeep.com\/us\/779355\/","title":{"rendered":"A vector-based strategy for olfactory navigation in Drosophila"},"content":{"rendered":"<p>Fly husbandry<\/p>\n<p>Flies were maintained at 23\u201325\u2009\u00b0C and 60\u201370% relative humidity under a 12-h light\u2013dark cycle. The quality and composition of the fly food was a key factor for eliciting robust edge-tracking behaviour in tethered flies, particularly during imaging experiments. We found that flies that were raised for several generations on Wurzburg food<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 39\" title=\"Dan, C., Hulse, B. K., Kappagantula, R., Jayaraman, V. &amp; Hermundstad, A. M. A neural circuit architecture for rapid learning in goal-directed navigation. Neuron 112, 2581&#x2013;2599 (2024).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR39\" id=\"ref-link-section-d103016607e1846\" rel=\"nofollow noopener\" target=\"_blank\">39<\/a> exhibited robust edge tracking more consistently than did those raised on standard cornmeal\u2013agar\u2013molasses food. All behavioural experiments were performed using starved flies, which were removed from food and placed in vials containing only a water-soaked KimWipe or cotton plug for 16\u201324\u2009h before tethering. For optogenetic experiments, flies were reared in complete darkness. Two days before an experiment, one-to-two-day old flies were transferred to a food vial containing 0.4\u2009mM all-trans-retinal (Sigma, R2500). Sixteen to twenty-four hours before an experiment, flies were removed from food and placed in a vial containing a Kimwipe soaked in 1\u20132\u2009ml of 0.2\u2009mM all-trans-retinal in water.<\/p>\n<p>Detailed fly genotypes<\/p>\n<p>For all behavioural experiments examining edge tracking of an odour plume (Figs. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig1\" rel=\"nofollow noopener\" target=\"_blank\">1<\/a>, <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig2\" rel=\"nofollow noopener\" target=\"_blank\">2<\/a>, <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig4\" rel=\"nofollow noopener\" target=\"_blank\">4<\/a> and <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig5\" rel=\"nofollow noopener\" target=\"_blank\">5<\/a> and Extended Data Figs. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig7\" rel=\"nofollow noopener\" target=\"_blank\">1<\/a>\u2013<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig9\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a>,\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig11\" rel=\"nofollow noopener\" target=\"_blank\">5<\/a>\u2013<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig13\" rel=\"nofollow noopener\" target=\"_blank\">7<\/a>, <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig15\" rel=\"nofollow noopener\" target=\"_blank\">9<\/a>, <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig17\" rel=\"nofollow noopener\" target=\"_blank\">11<\/a> and <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig18\" rel=\"nofollow noopener\" target=\"_blank\">12<\/a>), we used Canton-S. For perturbations of EPG neurons (Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig3\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a>), we used the SS00098 EPG split Gal4 line: 19G02-p65AD\/+; R22E04-DBD\/UAS-GtACR1-EYFP. For functional imaging of EPG neurons (Figs. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig3\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a> and\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig6\" rel=\"nofollow noopener\" target=\"_blank\">6<\/a> and Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig20\" rel=\"nofollow noopener\" target=\"_blank\">14<\/a>), we used the 60D05-Gal4 driver: UAS-jGCaMP7f\/+; 60D05-Gal4\/+. For perturbations of FC2 neurons (Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig6\" rel=\"nofollow noopener\" target=\"_blank\">6<\/a> and Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig20\" rel=\"nofollow noopener\" target=\"_blank\">14<\/a>), we used VT065306-AD; VT029306-DBD\/UAS-GtACR1-EYFP. For functional recording of FC2 neurons (Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig6\" rel=\"nofollow noopener\" target=\"_blank\">6<\/a> and Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig20\" rel=\"nofollow noopener\" target=\"_blank\">14<\/a>) we used VT065306-AD\/UAS-syt-jGCaMP7f; VT029306-DBD\/60D05-Gal4. For optogenetic activation of olfactory sensory neurons (Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig10\" rel=\"nofollow noopener\" target=\"_blank\">4<\/a>), we used: UAS-Chrimson.mVenus\/Orco-GAL4, w1118 UAS-CsChrimson.mVenus, Orco-GAL4, w*.<\/p>\n<p>Drosophila stock sources. EPG split line: 19G02-p65ADZp (in attP40); R22E04-ZpGdbd (in attP2) (Bloomington Drosophila Stock Center (BDSC) 93169); FC2 split line: VT065306-AD; VT029306-DBD (gift from G. Maimon); R60D05-Gal4 (BDSC 39247); 10XUAS-sytGCaMP7f (attP2) (BDSC 94619); 20XUAS-IVS-CsChrimson.mVenus(attP18) (BDSC 55134); Orco-GAL4.C(142t52.1), w[*] (BDSC 23909); UAS-GtACR1.d.EYFP(attP2) (BDSC 92983); 20XUAS-IVS-jGCaMP7s(VK00005) (BDSC 79032).<\/p>\n<p>Fly tethering and dissection<\/p>\n<p>All assays were performed using 1\u20135-day old female flies. Flies were briefly anaesthetized (less than 10\u2009s) using CO2 and tethered to a custom-milled fly-plate similar to what has been previously described<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 56\" title=\"Maimon, G., Straw, A. D. &amp; Dickinson, M. H. Active flight increases the gain of visual motion processing in Drosophila. Nat. Neurosci. 13, 393&#x2013;399 (2010).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR56\" id=\"ref-link-section-d103016607e1947\" rel=\"nofollow noopener\" target=\"_blank\">56<\/a>. Flies were mounted to the fly-plate using a strand of hair or a single paintbrush bristle, which was used to secure their heads and subsequently their bodies to the plate before gluing the eyes and thorax using UV-curable glue. In all assays, the filament was removed after successful tethering and flies were placed in a dark, climate-controlled space (25\u2009\u00b0C, 40\u201360% relative humidity) to recover for 15\u201330\u2009min before the start of the experiment. Flies were then transferred to the closed-loop apparatus and allowed to walk freely on the ball for at least 15\u2009min before experiments.<\/p>\n<p>For functional imaging experiments, fly preparation varied accordingly. After tethering, the proximal portion of the extended proboscis was glued to minimize movement during recording while allowing the distal portion of the mouthparts to move freely during experiments. Flies were provided a recovery period of 30\u2013120\u2009min after tethering. After the recovery period, the fly-plate was then filled with saline (108\u2009mM NaCl, 5\u2009mM KCl, 2\u2009mM CaCl2, 8.2\u2009mM MgCl2, 4\u2009mM NaHCO3, 1\u2009mM NaH2PO4, 5\u2009mM trehalose, 10\u2009mM sucrose and 5\u2009mM HEPES sodium salt, pH 7.5 with osmolarity adjusted to 275\u2009mOsm). The cuticle covering the posterior portion of the brain was then cut using a 30-gauge needle and removed using forceps to facilitate optical access to central complex structures. Obstructing trachea were removed taking care to not damage the antennae or the antennal nerves. Flies were subsequently transferred and allowed to walk on the ball for at least 15\u2009min.<\/p>\n<p>Preparation of the olfactory environment<\/p>\n<p>A virtual olfactory environment was created for walking tethered flies using a previously described<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 16\" title=\"Zolin, A. et al. Context-dependent representations of movement in Drosophila dopaminergic reinforcement pathways. Nat. Neurosci. 24, 1555&#x2013;1566 (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR16\" id=\"ref-link-section-d103016607e1972\" rel=\"nofollow noopener\" target=\"_blank\">16<\/a> closed-loop olfactory system with the addition of custom Python scripts that allowed for two-dimensional (2D) rendering of odour plumes.<\/p>\n<p>Tethered locomotion<\/p>\n<p>For tethered locomotion experiments, a spherical treadmill based on previous studies was designed. A 6.0\u20136.5-mm-diameter ball was shaped from LAST-A-FOAM FR-4618 (General Plastics) by a custom-made steel concave file. The ball rested in an aluminium base with a concave hemisphere 6.75\u2009mm in diameter with a 1-mm channel drilled through the bottom and connected to an airflow. The ball was recorded at 60\u201361\u2009frames per second using a Point Grey Firefly camera (Firefly MV 0.3 MP Mono USB 2.0, Point Grey, FMVU03MTM-CS) with an Infinity lens (94-mm focal length) focused on the ball, with illumination from infrared LED lights. Ball rotation was calculated in real time using FicTrac software<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 57\" title=\"Moore, R. J. D. et al. FicTrac: A visual method for tracking spherical motion and generating fictive animal paths. J. Neurosci. Methods 225, 106&#x2013;119 (2014).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR57\" id=\"ref-link-section-d103016607e1983\" rel=\"nofollow noopener\" target=\"_blank\">57<\/a> running on computers with processor speeds of at least 3\u2009GHz.<\/p>\n<p>Closed-loop arena<\/p>\n<p>The heading of the fly, as calculated by FicTrac, was transmitted to a RaspberryPi 4 through a serial port. Custom Python code was used to translate heading into tube position, controlled by motors, as described below. The closed-loop air delivery system was custom designed using OnShape (<a href=\"https:\/\/www.onshape.com\" rel=\"nofollow noopener\" target=\"_blank\">https:\/\/www.onshape.com<\/a>) and 3D printed using VisiJet Crystal material at XHD resolution in a 3D Systems ProJet 3510 HD Plus. O-ring outside dimension and inside dimension gland surfaces were designed with excess material for printing and then manually modified on a lathe for improved RMS (surface) finishing. The 360\u00b0 tube rotation was driven by a bipolar stepper motor (SureStep DC integrated NEMA 17 stepper) controlled through an integrated driver and coupled by a Dust-Free Timing Belt (XL Series, 1\/4\u2033 width, McMaster-Carr, 1679K121, trade no. 130 \u00d7 L025) to the rotating tube system, which rotated mounted on an Ultra-Corrosion-Resistant Stainless Steel Ball Bearing (3\/4\u2033 shaft diameter, 1-5\/8\u2033 inner diameter, McMaster-Carr, 5908K19). The air channel was kept airtight using oil-resistant O-rings (1\/16\u2033\u00a0fractional width, dash no. 020, McMaster-Carr, 2418T126). Motor rotation was measured by a rotary encoder (CUI Devices, AMT10 Series) that was used to correct for skipped steps.<\/p>\n<p>Airflow and odour delivery<\/p>\n<p>Odour delivery was achieved by directing a continuous stream of humidified clean air through a 2-mm-diameter tube made of VisiJet Crystal material directed at the fly\u2019s antennae. An anemometer (Kanomax 6006-DE) was used to ensure that airspeeds reaching the fly were maintained at 15\u201325\u2009cm\u2009s\u22121. Air to the system was first passed through a charcoal filter and humidified by bubbling the air through a deionized water reservoir. The airflow was then split between the spherical treadmill and three mass flow controllers (MFCs; Alicat, MC-Series, 1000SCCM). Downstream of each MFC, air passed through the headspace of odour vials containing either ACV (Heinz) or deionized water. The ratio of air entering each vial was dependent on the fly\u2019s position relative to the odour plume, such that when a fly is outside the boundaries of the plume, 100% of the air is directed into the water vial; when the fly is within the boundaries of the plume, the air is directed at an experimenter-determined ratio between the water vial and the odour vials. Air streams coming from the odour vials then merge with a Y-connector before entering the air delivery system. Thus, by controlling how much of the air passes through each vial, the MFCs control the total odour concentration of the airstream reaching the fly. The MFCs were controlled using a RaspberryPi 4 running custom Python scripts.<\/p>\n<p>Optogenetic stimulation<\/p>\n<p>All optogenetic experiments were done on flies with intact cuticles. Flies were reared in the dark, transferred to retinal food and tethered as described above. For optogenetic experiments, a fibre-coupled LED was controlled by a T-cube LED driver (Thorlabs, LEDD1B) to deliver light to the fly\u2019s head in closed loop with its behaviour. For the activation of Orco+ sensory neurons, a 660-nm (red) LED (Thorlabs M660FP1) was turned on (0.863\u2009\u03bcW\u2009mm\u22122) when the fly was inside the fictive odour plume. For EPG inhibition experiments, a 530-nm (green) LED (Thorlabs M530F2) was turned on (0.752\u2009\u03bcW\u2009mm\u22122) for the duration of the entire trial.<\/p>\n<p>Closed-loop parameters<\/p>\n<p>Behavioural measurements (sampled at 60\u2009Hz) were determined by the rotation of the foam ball and obtained from FicTrac (x position, y position, heading, roll, pitch and yaw). These were saved alongside MFC flow values, experimental variables (odour on, LED on) and a time stamp in a single .log file.<\/p>\n<p>Edge-tracking behavioural assays<\/p>\n<p>Tethered behavioural assays were performed in a dark, climate-controlled room (25\u201327\u2009\u00b0C, 40\u201360% relative humidity). The closed-loop olfactory system was enclosed in a black tarpaulin as a further shield from other potential light sources, such as computer monitors and indicator lights on system hardware. To prevent odour build-up in the enclosed space, a vacuum line (60\u2009cm\u2009s\u22121) was placed at the back of the enclosure as an exhaust. Unless otherwise stated, all experiments started with a 2\u20135-min baseline period in which flies walked in clean air delivered in closed loop. At the end of this baseline period, flies were placed at the centre of the odour plume\u2019s short axis, with the exception of the 90\u00b0 plume, in which flies were placed at the centre of the odour plume\u2019s long axis. The geometry of the plume (0\u00b0, 45\u00b0 or 90\u00b0) was determined before the start of the experiment. Unless otherwise stated, each plume\u2019s short axis measured 50\u2009mm and each long axis 1,000\u2009mm. For EPG and FC2 imaging experiments, the plume\u2019s short axis was 10\u2009mm. For EPG and FC2 silencing experiments, all flies completed paired LED-on and LED-off trials in pseudo-random order. For the jumping-plume experiments in Figs. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig2\" rel=\"nofollow noopener\" target=\"_blank\">2d,h<\/a>, <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig3\" rel=\"nofollow noopener\" target=\"_blank\">3e,f<\/a> and <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig6\" rel=\"nofollow noopener\" target=\"_blank\">6<\/a> and Extended Data Figs. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig11\" rel=\"nofollow noopener\" target=\"_blank\">5i<\/a>, <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig12\" rel=\"nofollow noopener\" target=\"_blank\">6<\/a>, <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig13\" rel=\"nofollow noopener\" target=\"_blank\">7<\/a> and <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig20\" rel=\"nofollow noopener\" target=\"_blank\">14<\/a>, the edge of the plume was shifted 20\u2009mm in the direction opposite to the fly\u2019s heading as the fly exited the plume. Owing to the propensity of flies to engage in straighter trajectories because of the heat of the two-photon laser<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 6\" title=\"Mussells Pires, P., Zhang, L., Parache, V., Abbott, L. F. &amp; Maimon, G. Converting an allocentric goal into an egocentric steering signal. Nature 626, 808&#x2013;818 (2024).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR6\" id=\"ref-link-section-d103016607e2075\" rel=\"nofollow noopener\" target=\"_blank\">6<\/a>, during functional imaging of FC2 neurons (Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig6\" rel=\"nofollow noopener\" target=\"_blank\">6<\/a> and Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig20\" rel=\"nofollow noopener\" target=\"_blank\">14<\/a>), once the fly had made 20 plume entries, the plume was jumped 3\u2009mm on every third subsequent entry. For all experiments, trials were terminated if one of these three criteria was met: (1) the fly travelled the length of the long axis of the plume provided (1,000\u2009mm), except in the case of FC2 imaging, in which experiments were terminated at 2,000\u2009s; (2) the fly travelled more than 500\u2009mm perpendicular to the plume\u2019s edge; (3) the fly travelled 100\u2009mm downwind from its starting position on the plume.<\/p>\n<p>A small fraction of tethered flies (less than 10%) were excluded from the study because they did not acclimate to walking on the ball, because they did not show a behavioural response to ACV (by turning upwind and increasing their speed) or because continuous tracking of the trajectory was lost by FicTrac.<\/p>\n<p>Odour concentration-gradient plumes<\/p>\n<p>Gradient plumes were created with the same dimensions (50\u2009mm by 1,000\u2009mm) but featured one of three odour concentration gradients. (1) Vertical plume with increasing upwind odour concentration: odour concentration increased linearly in the upwind direction, starting at 10% ACV at the plume\u2019s downwind end (0\u2009mm) and reaching 100% ACV at the upwind end (1,000\u2009mm). (2) Vertical plume with decreasing upwind odour concentration: odour concentration decreased linearly in the upwind direction, starting at 100% ACV at the downwind end (0\u2009mm) and diminishing to 10% ACV at the upwind end (1,000\u2009mm). (3) 90\u00b0 plume with crosswind odour concentration gradient: odour concentration varied linearly along the lateral axis, increasing from 10% to 100% ACV in one crosswind direction or decreasing from 100% to 10% ACV in the opposite direction over 1,000\u2009mm. Flies were at first positioned at the interface between these two gradients, allowing them to track up or down the concentration gradient in the crosswind direction.<\/p>\n<p>Graded lateral plumes<\/p>\n<p>Plumes with graded lateral concentration profiles followed a Gaussian profile characteristic of naturalistic plume envelopes. To make these plumes most comparable to the 50-mm constant-concentration odour corridor, the peak odour concentration was set to 20% at the plume\u2019s midline, and the plume\u2019s width was adjusted to 160\u2009mm so that the half-maximal concentration occurred at \u00b125\u2009mm from the plume\u2019s midline. Flies tested in a plume with a graded lateral boundary were also tested in a plume with a sharp lateral boundary (Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig9\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a>) in pseudo-random order.<\/p>\n<p>Optogenetically generated fictive odour plumes<\/p>\n<p>Fictive odour plumes were the same dimensions as a vertical odour plume (50\u2009mm by 1,000\u2009mm). Flies were positioned in the centre of the plume\u2019s short axis and optogenetic stimulation was provided by a 660-nm LED whenever the fly was within the plume\u2019s boundaries.<\/p>\n<p>Disappearing plumes<\/p>\n<p>Flies tracked a constant-concentration plume for 10\u2009min. After this period, during their first trajectory outside the plume, the plume was removed, leaving the fly walking in closed-loop wind without further olfactory input.<\/p>\n<p>Dynamic plumes<\/p>\n<p>Flies were presented with a looped video of a previously recorded surface plume that was binarized to match the composition of concentrations in odour corridors. The video spatial dimensions were scaled up by bicubic interpolation to provide a larger stimulus in which flies were likely to make more than one to five returns (total alongwind length was 2,030\u2009mm instead of the original 300\u2009mm), and the replay speed was scaled down (see \u2018Dynamic plume analysis\u2019). Flies were initialized at a position 1,700\u2009mm downwind and at the centre line of the fictive source. During exploration, odour delivery was referenced to the fly\u2019s spatial position relative to the video X,\u2009Y dimensions and to the presence of odour at that referenced pixel in the frame of the T dimension of the video matching the experimental time elapsed. Given the irregular plume structure and the time-varying intermittency of odour filament encounters even when the fly was stationary, many odour encounters were shorter than 1\u2009s. Because the odour concentration required around 1\u2009s to reach set point in our system (Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig7\" rel=\"nofollow noopener\" target=\"_blank\">1a<\/a>), each odour encounter was programmed to deliver a 1-s odour signal at minimum. Each experiment was stopped when (a) 20\u2009min had elapsed; (b) the fly wandered more than 500\u2009mm from the outer boundaries of the plume envelope and did not return within 10\u2009min; or (c) the fly located the source (10 out of 12 flies).<\/p>\n<p>Replay experiments in which the odour sequence was replayed back to the fly in open loop<\/p>\n<p>For odour-replay assays, we allowed flies to track a 90\u00b0 plume for 10\u2009min and recorded the time stamps of odour onset and offset in a separate log file. This file was used to generate the temporal sequence of odour pulses delivered during the replay epoch of the experiment, which was initiated 10\u2009s after the edge-tracking epoch back to the same fly. The same temporal sequence of odour pulses was also presented to a naive fly that had never edge tracked. Consequently, for every replay experiment, we collected data from one naive fly, and each naive fly received a distinct temporal sequence of odour pulses defined by the matched replay experiment. During replay, wind was delivered in closed loop but the fly\u2019s fictive position had no effect on the timing of odour delivery.<\/p>\n<p>Operant training paradigm<\/p>\n<p>The operant training paradigm consisted of three phases:<\/p>\n<p>                    (1)<\/p>\n<p>Initial edge-tracking phase: flies were allowed to track a 45\u00b0 plume. After tracking for 250\u2009mm along the plume\u2019s edge, the plume disappeared as flies were on their next outside trajectory.<\/p>\n<p>                    (2)<\/p>\n<p>Operant training phase: during training, a fly\u2019s average heading and speed was continuously calculated over a 2-s sliding window. Flies triggered the delivery of odour when their average heading was in a 45\u00b0 range of entry angles (either \u221290\u00b0 to \u2212135\u00b0 or 90\u00b0 to 135\u00b0, depending on whether training was in the same direction as the initial plume or in the opposite direction; Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig17\" rel=\"nofollow noopener\" target=\"_blank\">11a<\/a>) while sustaining an average speed higher than 2\u2009mm\u2009s\u22121 over that 2-s sliding window, to ensure that the flies did not trigger odour stimulation while standing still. Odour was delivered for a minimum of 2\u2009s and terminated when flies oriented in the 90\u00b0 range of upwind exit angles (\u221245\u00b0 to 45\u00b0) while sustaining an average speed higher than 2\u2009mm\u2009s\u22121. The number of training epochs (for example, one or five odour stimulation periods) during this training phase, and whether they were in the same or opposite direction as the initial plume segment, were determined before the start of the experiment.<\/p>\n<p>                    (3)<\/p>\n<p>Test edge-tracking phase: after completing the predetermined number of training epochs, flies were positioned at the centre of the short axis of the future test plume, oriented opposite to the direction of the 45\u00b0 plume they had tracked during the initial phase. Note that after flies completed this training phase, they had to enter the test odour using the same heading that was used for the training phase, and so effectively had an additional epoch of reinforcement. In the test phase, the plume extended 20\u2009mm below the fly\u2019s starting position to increase the chances of it successfully entered the test plume.<\/p>\n<p>                Analyses of edge tracking behaviourTrajectory averages<\/p>\n<p>To construct average trajectories (Figs. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig1\" rel=\"nofollow noopener\" target=\"_blank\">1e<\/a>, <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig2\" rel=\"nofollow noopener\" target=\"_blank\">2e\u2013h<\/a>, <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig3\" rel=\"nofollow noopener\" target=\"_blank\">3f<\/a> and <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig6\" rel=\"nofollow noopener\" target=\"_blank\">6j<\/a> and Extended Data Figs. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig11\" rel=\"nofollow noopener\" target=\"_blank\">5e<\/a>, <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig12\" rel=\"nofollow noopener\" target=\"_blank\">6a<\/a> and <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig13\" rel=\"nofollow noopener\" target=\"_blank\">7b<\/a>), x and y coordinates for each outside or inside bout were upsampled to contain 10,000 points through linear interpolation between data points using the pandas library in Python. This allowed us to average x and y coordinates regardless of the length of the inside or outside bout. Upsampled x and y coordinates were averaged to produce one set of (x,\u2009y) coordinates for each fly. To construct an average across flies, the averages generated from individual flies were averaged together.<\/p>\n<p>Entry and exit angles<\/p>\n<p>Entry and exit angles were determined by calculating the mean travelling direction in the 0.5\u2009s before and 0.5\u2009s after crossing the plume\u2019s boundary.<\/p>\n<p>Analysis of inbound and outbound segments<\/p>\n<p>The outside trajectories of flies tracking a vertical plume were simplified into straight-line segments using the Ramer\u2013Douglas\u2013Peucker (RDP) algorithm<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 58\" title=\"Douglas, D. H. &amp; Peucker, T. K. Algorithms for the reduction of the number of points required to represent a digitized line or its caricature. Cartographica 10, 112&#x2013;122 (1973).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR58\" id=\"ref-link-section-d103016607e2278\" rel=\"nofollow noopener\" target=\"_blank\">58<\/a>, which simplifies a set of x,\u2009y coordinates by iteratively reducing the number of points in the trace. The parameter \u03b5 determines the maximum allowed distance between the simplified and original trajectories and was 1\u2009mm. These trajectories were then averaged using the linear interpolation method described above providing a single average trajectory for each fly. From this average trajectory, \u2018outbound\u2019 (away from the edge) and \u2018inbound\u2019 (back towards the edge) path lengths were calculated as follows: (1) outbound path length was calculated as the path length from the point of exiting the plume to the farthest point orthogonal to the plume\u2019s edge; and (2) inbound path length was calculated as the path length from the farthest point orthogonal to the plume\u2019s edge back to the plume\u2019s boundary. These three points\u2014plume exit point, farthest point and plume entry point\u2014define a triangle, the upwind angles of which define inbound and outbound angles as indicated in Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig1\" rel=\"nofollow noopener\" target=\"_blank\">1f<\/a>. For analyses of simulated inbound and outbound trajectories in a random search model (Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig11\" rel=\"nofollow noopener\" target=\"_blank\">5d,e<\/a>), we took the total number of outside bouts for each fly and then randomly selected the same number of outside simulated outside trajectories. From this collection of random trajectories, we used the method above to generate an average trajectory and then calculated outbound and inbound lengths.<\/p>\n<p>Definition of anemotaxis<\/p>\n<p>Trajectories of flies before ACV exposure (pre-air period) were divided into anemotaxis bouts, defined in a similar manner to menotaxis bouts in a previous study<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 6\" title=\"Mussells Pires, P., Zhang, L., Parache, V., Abbott, L. F. &amp; Maimon, G. Converting an allocentric goal into an egocentric steering signal. Nature 626, 808&#x2013;818 (2024).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR6\" id=\"ref-link-section-d103016607e2306\" rel=\"nofollow noopener\" target=\"_blank\">6<\/a>. Flies\u2019 trajectories were simplified into straight-line segments using the Ramer\u2013Douglas\u2013Peucker algorithm (\u03b5\u2009=\u200910\u2009mm). Segments of length greater than 50\u2009mm were assigned as anemotaxis bouts. See Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig6\" rel=\"nofollow noopener\" target=\"_blank\">6e,f<\/a>.<\/p>\n<p>Random-walk model<\/p>\n<p>We simplified the outside trajectories of 40 flies tracking a vertical plume using the Ramer\u2013Douglas\u2013Peucker algorithm (\u03b5\u2009=\u20091\u2009mm) and extracted the straight-line distances (run lengths) that flies travelled between successive turns and the angles between consecutive straight-line vectors (turn angles) to capture the changes in heading direction. Run lengths and turn angles were each stored in a separate library. We simulated random-walk trajectories by randomly sampling from the two empirical distributions of run lengths and turn angles. Simulated flies started at the plume\u2019s edge and the initial run length was assigned a heading that was drawn randomly from the initial segment heading directions from the plume (Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig11\" rel=\"nofollow noopener\" target=\"_blank\">5b<\/a>). At each step: (1) a run length was randomly sampled from the empirical distribution of run lengths; (2) a turn angle was randomly sampled from the empirical distribution of turn angles; and (3) the simulated fly moved forwards by the run length and then adjusted its heading by the turn angle.<\/p>\n<p>The simulation continued until the simulated fly either re-encountered the plume edge or exceeded a maximum distance travelled of 500\u2009mm in the direction perpendicular to the plume\u2019s edge, which is the same maximum distance that flies were allowed to travel in experiments before a trial was terminated.<\/p>\n<p>To reflect the natural tendency of flies to walk upwind even in the absence of odour cues<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 16\" title=\"Zolin, A. et al. Context-dependent representations of movement in Drosophila dopaminergic reinforcement pathways. Nat. Neurosci. 24, 1555&#x2013;1566 (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR16\" id=\"ref-link-section-d103016607e2337\" rel=\"nofollow noopener\" target=\"_blank\">16<\/a>, we modified the random-walk model to include an upwind bias. We adjusted the turn direction on the basis of a sinusoidal probability function whose magnitude scaled between 0 and 1 (value a). When a\u2009=\u20090, the probability of turning left or right is the same for all heading directions. As the values of a increase from a\u2009=\u20090 to a\u2009=\u20091, the fly becomes progressively more biased to turn left when it is facing right, and to turn right when facing left. The value of a was selected to match that of real flies (Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig11\" rel=\"nofollow noopener\" target=\"_blank\">5c<\/a>), mirroring the upwind bias observed in actual flies outside the odour plume.<\/p>\n<p>Given that random exploration outside the plume should not depend on the geometry of the plume tracked, the same model was used to simulate outside trajectories for flies tracking the 45\u00b0, 90\u00b0 and jumping plumes, drawing from the same empirically derived libraries of run lengths and turn angles (Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig11\" rel=\"nofollow noopener\" target=\"_blank\">5g\u2013i<\/a>). The only difference between the models was the initial heading, which was sampled from the initial segment heading directions for the 45\u00b0 and 90\u00b0 trajectories.<\/p>\n<p>Functional imaging<\/p>\n<p>All functional imaging experiments were performed on an Ultima or Investigator two-photon laser scanning microscope (Bruker) equipped with galvanometers driving a Chameleon Ultra II Ti:Sapphire laser. Emitted fluorescence was detected with GaAsP photodiode (Hamamatsu) detectors. Images were acquired with an Olympus 40\u00d7, 0.8 NA or 20\u00d7, 1.0 NA objective at 512\u2009\u00d7\u2009512 pixel resolution. The laser was tuned to 920\u2009nm for all experiments. The out-of-objective power for all experiments was around 15\u2009mW and never exceeded 25\u2009mW. For volumetric imaging, three to five slices were recorded using a piezoelectric Z-focus (Bruker) at a rate of 3\u201310\u2009Hz.<\/p>\n<p>Data alignment<\/p>\n<p>To align the imaging and behavioural data, we used a 3.3-V digital pulse from a RaspberryPi to initiate recording of an imaging stack through the PrairieView (Bruker) I\/O interface. The RaspberryPi continued to send 3.3-V pulses every 10\u2009s, which were recorded with PrairieView for confirmatory alignment of the imaging and behavioural data. Behavioural variables were captured at 60\u201361\u2009frames per second, whereas neural activity (fluorescence) was captured at 3\u201310\u2009frames per second. To align these two distinct time series, a standardized and regular time series was generated for each trace containing 100-ms time bins (0, 100, 200, 300 and so on). Behavioural data were binned at the centre of each time point and averaged. Imaging data were upsampled using linear interpolation at the same 100-ms time bins. Custom Python scripts were used to synchronize and log incoming FicTrac variables and outgoing MFC and motor commands, allowing us to align the wind direction, odour concentration, behavioural data and imaging frames.<\/p>\n<p>Image registration and regions of interest<\/p>\n<p>All images were stored as individual tiff files, which were registered using the StackReg function of the pystackreg library. Regions of interest were drawn using custom Python scripts, Fiji or a custom MATLAB GUI. To quantify EPG neuron activity recorded from the protocerebral bridge, we followed the methods described in a previous study<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 35\" title=\"Lyu, C., Abbott, L. F. &amp; Maimon, G. Building an allocentric travelling direction signal via vector computation. Nature 601, 92&#x2013;97 (2022).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR35\" id=\"ref-link-section-d103016607e2393\" rel=\"nofollow noopener\" target=\"_blank\">35<\/a> and manually defined each of the 16 glomeruli from the registered stacks corresponding to each imaging plane.<\/p>\n<p>FC2 neuron activity during edge tracking was recorded in the fan-shaped body. EPG neuron activity in the ellipsoid body was recorded synchronously to allow for direct comparison of their phase relationships during an experiment. To quantify FC2 neuron activity, we manually defined the lateral borders of the fan-shaped body, extended these lines down to a point and divided the arc defined by these intersecting lines into 16 wedges. Pixels were assigned to each wedge if they resided within the wedge and within the footprint of the FC2 neurons, defined by masks that were drawn manually in each imaging layer on the basis of their arborization pattern. To quantify EPG neuron activity recorded in the ellipsoid body, we divided the ellipsoid body radially into 16 sub-wedges from a manually defined centre. Pixels were assigned to each wedge if they resided within the wedge and within the footprint of the EPG neurons, defined by masks that were drawn manually in each imaging layer on the basis of their arborization pattern.<\/p>\n<p>\u0394F\/F0 values were determined by the formula (F\u2009\u2212\u2009F0)\/F0, where F is the mean pixel value within a wedge or glomerulus and F0 is the mean of the lowest 10% of F values.<\/p>\n<p>Neuronal phase analysis<\/p>\n<p>Phase was determined by two methods. For recordings of EPG neurons in the protocerebral bridge, phase was calculated as described previously<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 59\" title=\"Green, J. et al. A neural circuit architecture for angular integration in Drosophila. Nature 546, 101&#x2013;106 (2017).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR59\" id=\"ref-link-section-d103016607e2439\" rel=\"nofollow noopener\" target=\"_blank\">59<\/a>. For each time point, the Fourier transform was taken on the \u0394F\/F0 activity vector of the 16 glomeruli. Phase was determined as the phase of the Fourier spectrum at a period of 8, the peak periodicity of the power spectrum. For recordings of EPG neurons in the ellipsoid body and FC2 neurons in the fan-shaped body, phase was defined as the population vector average of wedge signals<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 31\" title=\"Seelig, J. D. &amp; Jayaraman, V. Neural dynamics for landmark orientation and angular path integration. Nature 521, 186&#x2013;191 (2015).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR31\" id=\"ref-link-section-d103016607e2450\" rel=\"nofollow noopener\" target=\"_blank\">31<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 35\" title=\"Lyu, C., Abbott, L. F. &amp; Maimon, G. Building an allocentric travelling direction signal via vector computation. Nature 601, 92&#x2013;97 (2022).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR35\" id=\"ref-link-section-d103016607e2453\" rel=\"nofollow noopener\" target=\"_blank\">35<\/a>. In summary, the 16 wedges of the ellipsoid body and fan-shaped body were assigned angles from \u2212180\u00b0 to 180\u00b0, equally dividing 360\u00b0 of azimuthal space. Angles were assigned so that ellipsoid body and fan-shaped body wedges were in correspondence as per the connectome<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 38\" title=\"Hulse, B. K. et al. A connectome of the Drosophila central complex reveals network motifs suitable for flexible navigation and context-dependent action selection. eLife 10, e66039 (2021).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR38\" id=\"ref-link-section-d103016607e2457\" rel=\"nofollow noopener\" target=\"_blank\">38<\/a>. In the ellipsoid body, wedges were counted anticlockwise starting from the most ventral wedge to the right of the midline viewed from posterior to anterior. In the fan-shaped body, wedges were counted from right to left midline viewed from posterior to anterior. For each time point, each wedge was assigned a vector with length equal to the \u0394F\/F0 value and direction given by its assigned angle. Phase was the angle of the population vector average of these vectors at each time point.<\/p>\n<p>Phase nulling and bump amplitude assessment<\/p>\n<p>Phase nulled EPG and FC2 signals were calculated as described previously<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 35\" title=\"Lyu, C., Abbott, L. F. &amp; Maimon, G. Building an allocentric travelling direction signal via vector computation. Nature 601, 92&#x2013;97 (2022).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR35\" id=\"ref-link-section-d103016607e2478\" rel=\"nofollow noopener\" target=\"_blank\">35<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 59\" title=\"Green, J. et al. A neural circuit architecture for angular integration in Drosophila. Nature 546, 101&#x2013;106 (2017).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR59\" id=\"ref-link-section-d103016607e2481\" rel=\"nofollow noopener\" target=\"_blank\">59<\/a>. At each frame, we rotated the signal by the estimated phase of the activity bump in that frame, such that all bumps were aligned. To compare EPG bumps recorded in the protocerebral bridge in and out of odour, we separated frames corresponding to when the fly was in or out of the odour and averaged 122 together with the signal from all these frames to get the average bump profile. The mean of phase-nulled FC2 and EPG bumps in Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig20\" rel=\"nofollow noopener\" target=\"_blank\">14d<\/a> was taken over a 0.5-s window before entries to the jumped plume and the preceding plume exit.<\/p>\n<p>FC2 and EPG bump amplitude was assessed by two measures: the mean \u0394F\/F0 across wedges and the population vector amplitude (PVA). Both measurements were taken over the same time period for the assessment of phase-nulled bumps. PVA was calculated as described previously<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 6\" title=\"Mussells Pires, P., Zhang, L., Parache, V., Abbott, L. F. &amp; Maimon, G. Converting an allocentric goal into an egocentric steering signal. Nature 626, 808&#x2013;818 (2024).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR6\" id=\"ref-link-section-d103016607e2498\" rel=\"nofollow noopener\" target=\"_blank\">6<\/a>. The 16 wedges of the ellipsoid body and fan-shaped body were assigned activity-weighted vectors as for neuronal phase analysis (see above). PVA was calculated as the hypotenuse of the mean vector across wedges.<\/p>\n<p>Phase calibration to allocentric coordinates<\/p>\n<p>The anatomical locations of activity bumps in the central complex correspond to azimuthal orientations in allocentric space. However, the mapping from anatomical to external coordinates varies between individuals and can remap during an experiment<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 31\" title=\"Seelig, J. D. &amp; Jayaraman, V. Neural dynamics for landmark orientation and angular path integration. Nature 521, 186&#x2013;191 (2015).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR31\" id=\"ref-link-section-d103016607e2510\" rel=\"nofollow noopener\" target=\"_blank\">31<\/a>. To produce EPG and FC2 signals aligned to external coordinates, we rotated phase and wedges by an offset at each time point, such that phase angle 0\u00b0 was aligned upwind and the central two wedges corresponded to 22.5\u00b0 to the left and right of the upwind direction (Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig6\" rel=\"nofollow noopener\" target=\"_blank\">6d,e<\/a>). The offset was the rolling mean (over 2\u2009s) of the difference between the EPG phase and the fly\u2019s heading, because the EPG signal provided a faithful neural correlate of heading relative to the wind (Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig3\" rel=\"nofollow noopener\" target=\"_blank\">3b\u2013d<\/a>). To rotate wedges, this offset was converted to an integer value varying between \u22128 and 8 by rounding to the nearest 22.5\u00b0. The same offset was applied to EPG and FC2 signals.<\/p>\n<p>ModelTime discretization<\/p>\n<p>We bin the data into time intervals of 0.2\u2009s and run the behavioural model in discrete time steps with this same interval. Because we are modelling the motion of the fly, we exclude data points when the fly\u2019s speed is less than 1\u2009mm\u2009s\u22121.<\/p>\n<p>Edge-crossing events for memory update<\/p>\n<p>To avoid spurious events and to account for the finite width of the odour boundary, we define an edge crossing as when a fly is on one side of the odour boundary for three consecutive time points and then on the other side for three consecutive time points. We define the fly\u2019s velocity unit vector at the time of the crossing, \\(\\hat{{\\bf{v}}},\\) as its velocity averaged over this five-time-step interval (1\u2009s), normalized to unit length.<\/p>\n<p>State<\/p>\n<p>The model has two states: returning and leaving. When the fly leaves the odour plume in the leaving state, a time interval is drawn from a negative binomial distribution NB(rleave,\u20091\u2009\u2212\u2009pleave) and, after that number of time steps, the state switches to the returning state if the fly is still out of the plume. When the fly enters the odour plume in the returning state, a time interval is drawn from a negative binomial distribution NB(rreturn,\u20091\u2009\u2212\u2009preturn) and, after that number of time steps, the state switches to the leaving state if the fly is still in the plume. Otherwise, no transitions occur. The parameters rleave, pleave, rreturn and preturn are determined by fitting to data by the procedure described below.<\/p>\n<p>Memory<\/p>\n<p>The model stores 2D vector memories of plume exit and entry directions. The entry-memory vector mentry is updated at the time of each entry by<\/p>\n<p>$${{\\bf{m}}}_{\\text{entry}}\\leftarrow {a}_{\\text{entry}}{{\\bf{m}}}_{\\text{entry}}+{b}_{\\text{entry}}\\hat{{\\bf{v}}}+{{\\boldsymbol{\\epsilon }}}_{\\text{entry}},$$<\/p>\n<p>where \\(\\hat{{\\bf{v}}}\\) is the entry-velocity unit vector defined above, and the two components of \u03f5entry are random variables drawn from a normal distribution with zero mean and variance \\({{\\sigma }}_{{\\rm{entry}}}^{2}\\). The exit memory vector mexit is updated at the time of each exit by<\/p>\n<p>$${{\\bf{m}}}_{\\text{exit}}\\leftarrow {a}_{\\text{exit}}{{\\bf{m}}}_{\\text{exit}}+{b}_{\\text{exit}}\\hat{{\\bf{v}}}+{{\\boldsymbol{\\epsilon }}}_{\\text{exit}},$$<\/p>\n<p>with \\(\\hat{{\\bf{v}}}\\) the exit-velocity unit vector and \u03f5exit drawn from a normal distribution with zero mean and variance \\({{\\sigma }}_{{\\rm{exit}}}^{2}\\). In simulations, we ignore updates for which the exit \\(\\hat{{\\bf{v}}}\\) is more than 60\u00b0 away from the upwind direction. This follows the intuition that flies have an innate tendency to exit upwind. Other than during these plume boundary crossings, mentry and mexit remain unchanged. For real flies, the values of the memory vectors at the beginning of a trajectory depend on unknown previous history. We therefore model mentry(0) as the null vector and mexit(0) with a trajectory-specific Gaussian prior N \\(({{\\boldsymbol{\\mu }}}_{0},{\\sigma }_{0}^{2}I)\\) during fitting.<\/p>\n<p>The parameters aentry, bentry, \\({\\sigma }_{{\\rm{entry}}}^{2},\\) aexit, bexit, \\({\\sigma }_{{\\rm{exit}}}^{2}\\), \u03bc0 and \\({\\sigma }_{0}^{2}\\) are determined by the fitting procedure described below. During fitting, nonzero values of \\({\\sigma }_{0}^{2}\\), \\({\\sigma }_{{\\rm{entry}}}^{2}\\) and \\({\\sigma }_{{\\rm{exit}}}^{2}\\) allow unexplained variation of latent memories. However, during simulation, we set \\({\\sigma }_{0}^{2}={\\sigma }_{{\\rm{entry}}}^{2}={\\sigma }_{{\\rm{exit}}}^{2}=0\\) to test the effectiveness of our hypotheses without introducing extra noise into the memories. When simulating from models fitted to a single trajectory, as in Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig14\" rel=\"nofollow noopener\" target=\"_blank\">8d<\/a>, we set the initial exit memory to \u03bc0. When simulating from the average fly model (parameters computed from multiple trajectories; Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig4\" rel=\"nofollow noopener\" target=\"_blank\">4b<\/a>), we set the upwind component of the initial exit memory to a fixed value \\({w}_{\\parallel }\\) equal to the median of the upwind components of \u03bc0 from all training trajectories, and we sample the crosswind component from a uniform distribution over the range from \u22122w\u22a5 to +2w\u22a5, where w\u22a5 is the median of the absolute value of the crosswind components of \u03bc0 from all training trajectories.<\/p>\n<p>Velocity update<\/p>\n<p>In the leaving state, velocity is updated at every time step with a decay term, a bias towards the current exit memory and a noise term,<\/p>\n<p>$${\\bf{v}}(t)={c}_{\\text{leave}}{\\bf{v}}(t-1)+{(1-c}_{\\text{leave}}){{\\bf{m}}}_{\\text{exit}}+{{\\boldsymbol{\\xi }}}_{\\text{leave}}(t),$$<\/p>\n<p>with \\({{\\boldsymbol{\\xi }}}_{\\text{leave}}(t)\\) drawn from a Gaussian distribution with zero mean and variance \\({\\sigma }_{\\text{leave}}^{2}\\). Similarly, in the returning state, the velocity update is<\/p>\n<p>$${\\bf{v}}(t)={c}_{\\text{return}}{\\bf{v}}(t-1)+{(1-c}_{\\text{return}}){{\\bf{m}}}_{\\text{entry}}+{{\\boldsymbol{\\xi }}}_{\\text{return}}(t),$$<\/p>\n<p>with \\({{\\boldsymbol{\\xi }}}_{\\text{return}}(t)\\) drawn from a Gaussian distribution with zero mean and variance \\({\\sigma }_{\\text{return}}^{2}\\). The parameters cleave, creturn, \\({\\sigma }_{\\text{leave}}^{2}\\) and \\({\\sigma }_{\\text{return}}^{2}\\) are determined by the fitting procedure described below.<\/p>\n<p>Variational inference and parameter learning<\/p>\n<p>For each trajectory, we fitted a trajectory-specific model using a variational expectation-maximization procedure. In the variational E-step, we inferred the binary leaving and returning states z1:T, entry memories mentry,1:T and exit memories mexit,1:T over the T time steps of the trajectory, while holding the model parameters fixed. Because the exact posterior p(z1:T,mentry,1:T,mexit,1:T|v1:T,o1:T) is intractable, where v1:T denotes observed velocities and o1:T denotes odour observations, we used the mean-field approximation q(z1:T,mentry,1:T,mexit,1:T)\u2009=\u2009q(z1:T)q(mentry,1:T)q(mexit,1:T), following a previous study<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 41\" title=\"Ghahramani, Z. &amp; Hinton, G. E. Variational learning for switching state-space models. Neural Comput. 12, 831&#x2013;864 (2000).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR41\" id=\"ref-link-section-d103016607e3933\" rel=\"nofollow noopener\" target=\"_blank\">41<\/a>. We optimized this variational distribution by coordinate ascent on the evidence lower bound (ELBO). In the M-step, we updated the model parameters by maximizing the ELBO while holding the current variational distribution fixed. We alternated between these two steps until the ELBO converged. When reporting inferred memories from real fly trajectories (Figs. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig4\" rel=\"nofollow noopener\" target=\"_blank\">4g<\/a> and\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig5\" rel=\"nofollow noopener\" target=\"_blank\">5f<\/a> and Extended Data Figs. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig14\" rel=\"nofollow noopener\" target=\"_blank\">8h<\/a>,\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig16\" rel=\"nofollow noopener\" target=\"_blank\">10f<\/a> and\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig18\" rel=\"nofollow noopener\" target=\"_blank\">12d<\/a>), we used the mean of trajectory-specific variational memory distributions q(m1:T).<\/p>\n<p>State durations were modelled with negative binomial distributions NB(r,\u20091\u2009\u2212\u2009p), parameterized by r and p. For r\u2009&gt;\u20091, q(z1:T) was represented over an expanded Markov chain, in which each behavioural state was augmented with r\u2009\u2212\u20091 substates<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 60\" title=\"Linderman, S., Antin, B., Zoltowski, D. &amp; Glaser, J. SSM: Bayesian learning and inference for state space models. GitHub &#010;                https:\/\/github.com\/lindermanlab\/ssm&#010;                &#010;               (2020).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR60\" id=\"ref-link-section-d103016607e3996\" rel=\"nofollow noopener\" target=\"_blank\">60<\/a>. We then updated r and p for both leaving and returning states by fitting negative binomial distributions to state durations in samples from q(z1:T). For simplicity, we fixed r\u2009=\u20091 during all but the final iteration of the fitting algorithm.<\/p>\n<p>For the average fly model, we fitted a single set of optimal parameters (except for \u03bc0 and \\({\\sigma }_{0}^{2}\\), which are still trajectory specific) to latent variable distributions calculated using the above procedure from the 28 trajectories with no fewer than 30 returns (Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig14\" rel=\"nofollow noopener\" target=\"_blank\">8c,h<\/a>). We chose a relatively large threshold on the number of returns to provide a high number of data points for determining the memory update parameters.<\/p>\n<p>Average fly model parameters (Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig14\" rel=\"nofollow noopener\" target=\"_blank\">8c<\/a>): w\u2225\u2009= 6.299\u2009mm\u2009s\u22121; w\u22a5\u2009=\u20091.695\u2009mm\u2009s\u22121; entry memory (a\u2009=\u20090.727, b\u2009=\u20090.437\u2009mm\u2009s\u22121) and exit memory (a\u2009=\u20090.956, b\u2009=\u20090.482\u2009mm\/s); return after entry (r\u2009=\u20092, p\u2009=\u20090.505) and leave after exit (r\u2009=\u20091, p\u2009=\u20090.81); returning state (c\u2009=\u20090.733, \u03c3\u2009=\u20093.23\u2009mm\u2009s\u22121) and leaving state (c\u2009=\u20090.6, \u03c3\u2009=\u20093.255\u2009mm\u2009s\u22121).<\/p>\n<p>Comparison with data<\/p>\n<p>We remove odour changes lasting only one or two time steps from simulated trajectories before comparing to fly data, which matches the preprocessing procedure for fly data that removed odour changes lasting less than 0.5\u2009s.<\/p>\n<p>Dynamic plume analysisPlume video<\/p>\n<p>We used a previously recorded 3,600-frame video (4\u2009min long) of a surface odour plume<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 3\" title=\"&#xC1;lvarez-Salvado, E. et al. Elementary sensory-motor transformations underlying olfactory navigation in walking fruit-flies. eLife 7, e37815 (2018).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR3\" id=\"ref-link-section-d103016607e4142\" rel=\"nofollow noopener\" target=\"_blank\">3<\/a>,<a data-track=\"click\" data-track-action=\"reference anchor\" data-track-label=\"link\" data-test=\"citation-ref\" aria-label=\"Reference 17\" title=\"Connor, E. G., McHugh, M. K. &amp; Crimaldi, J. P. Quantification of airborne odor plumes using planar laser-induced fluorescence. Exp. Fluids 59, 137 (2018).\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#ref-CR17\" id=\"ref-link-section-d103016607e4145\" rel=\"nofollow noopener\" target=\"_blank\">17<\/a> in two forms: one in the original scale, with the plume video sampled at 15\u2009Hz and a spatial resolution of 0.74\u2009mm per pixel, and another in an expanded scale stretched fivefold in both space and time, simulating an expanded video sampled at 3\u2009Hz with a spatial resolution of 3.7\u2009mm per pixel. Because the edge tracking model depends on binary odour states, we binarized the odour signal with a threshold of 0.1 to assure sufficient odour encounters while preserving the turbulent properties at the downwind end of the plume, allowing us to explore how the model performs with different degrees of turbulence (Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig19\" rel=\"nofollow noopener\" target=\"_blank\">13b<\/a>).<\/p>\n<p>Model simulations and threshold for success<\/p>\n<p>We used the average fly model to simulate 2,000 trajectories for each dynamic plume type. For the unscaled plume, we set the simulation time step to 1\/15\u2009s (the frame rate of the video) and converted model parameters accordingly. We initialized trajectories uniformly within a 200\u2009mm\u2009\u00d7\u2009100-mm rectangular region spanning 100\u2013300\u2009mm downwind of the source and \u221260 to 40\u2009mm in the crosswind direction, to assess how tracking success depends on the initial position within the plume. A trial was considered a success if the minimum distance of the simulated trajectory to the source was less than 20\u2009mm. For the scaled plume, we set the simulation time step to 0.2\u2009s, as in edge-tracking simulations, and we used the video frame closest in time at each step. We initialized trajectories uniformly within a 1,000\u2009mm \u00d7 500-mm rectangular region spanning 500\u20131,500\u2009mm downwind of the source and \u2212300 to 200\u2009mm in the crosswind direction. For the scaled plume, a trial was considered a success if the minimum distance to the source was less than 50\u2009mm.<\/p>\n<p>Effective entries and exits in dynamic plumes<\/p>\n<p>Effective entry and exit events during simulation were defined over a 1-s interval (entry: 0.5\u2009s odour off, 0.5\u2009s odour on; exit: 0.5\u2009s odour on, 0.5\u2009s odour off), to be consistent with memory updating in edge-crossing events (plotted in Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig5\" rel=\"nofollow noopener\" target=\"_blank\">5b,e<\/a> and Extended Data Fig. <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"figure anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#Fig19\" rel=\"nofollow noopener\" target=\"_blank\">13g<\/a>). When comparing models with and without entry memory, we included only trajectories with at least one effective entry. For the unscaled plume, we further excluded trajectories for which the first effective entry was within a 20-mm alongwind distance from the source, yielding 1,593 out of 2,000 trials. For the scaled plume, we further excluded trajectories for which the first effective entry was within a 50\u2009mm alongwind distance from the source, yielding 1,850 out of 2,000 trials.<\/p>\n<p>Entry-memory crosswind predictivity<\/p>\n<p>We denote \\({\\hat{{\\bf{m}}}}_{\\mathrm{entry}}={({m}_{\\perp },{m}_{\\parallel })}^{T}\\) as the entry-memory vector normalized to unit length and \\(\\hat{{\\bf{v}}}={({v}_{\\perp },{v}_{\\parallel })}^{T}\\) as the entry-velocity unit vector. Crosswind predictivity is calculated as the product of m\u22a5 and v\u22a5 at the time\u00a0of each entry.<\/p>\n<p>Statistics and reproducibility<\/p>\n<p>Data were processed and analysed using custom scripts written in Python and MATLAB. No statistical methods were used to predetermine sample sizes; sample sizes were selected on the basis of common practice in the field and were comparable with those used in previous studies. No randomization of experimental sessions and no blinding to experimental conditions were used during data collection or analysis. The principal behavioural finding\u2014that flies track odour plumes by repeatedly exiting and returning to the plume boundary (edge tracking)\u2014was highly reproducible across flies, experimental paradigms and experimenters. Unless otherwise stated, all statistical comparisons were performed using two-tailed non-parametric tests. Statistical details, including sample sizes, statistical tests and exact P\u2009values, are provided in the corresponding figure legends or Supplementary Table <a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#MOESM1\" rel=\"nofollow noopener\" target=\"_blank\">1<\/a>.<\/p>\n<p>Reporting summary<\/p>\n<p>Further information on research design is available in the\u00a0<a data-track=\"click\" data-track-label=\"link\" data-track-action=\"supplementary material anchor\" href=\"http:\/\/www.nature.com\/articles\/s41586-026-10827-7#MOESM2\" rel=\"nofollow noopener\" target=\"_blank\">Nature Portfolio Reporting Summary<\/a> linked to this article.<\/p>\n","protected":false},"excerpt":{"rendered":"Fly husbandry Flies were maintained at 23\u201325\u2009\u00b0C and 60\u201370% relative humidity under a 12-h light\u2013dark cycle. The quality&hellip;\n","protected":false},"author":2,"featured_media":779356,"comment_status":"","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[1159,61552,1160,157391,332025,79],"class_list":["post-779355","post","type-post","status-publish","format-standard","has-post-thumbnail","category-science","tag-humanities-and-social-sciences","tag-learning-and-memory","tag-multidisciplinary","tag-neural-circuits","tag-olfactory-system","tag-science"],"_links":{"self":[{"href":"https:\/\/www.newsbeep.com\/us\/wp-json\/wp\/v2\/posts\/779355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.newsbeep.com\/us\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.newsbeep.com\/us\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/us\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/us\/wp-json\/wp\/v2\/comments?post=779355"}],"version-history":[{"count":0,"href":"https:\/\/www.newsbeep.com\/us\/wp-json\/wp\/v2\/posts\/779355\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.newsbeep.com\/us\/wp-json\/wp\/v2\/media\/779356"}],"wp:attachment":[{"href":"https:\/\/www.newsbeep.com\/us\/wp-json\/wp\/v2\/media?parent=779355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.newsbeep.com\/us\/wp-json\/wp\/v2\/categories?post=779355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.newsbeep.com\/us\/wp-json\/wp\/v2\/tags?post=779355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}