Fly stocks
We reared female flies on typical cornmeal-agar medium at 25°C under a 12-hour light cycle. For our optogenetics experiments, we added 50 µl of 35 mM all-trans retinal (Sigma, R2500, dissolved in ethanol) blended with about one teaspoon of hydrated potato flakes. For the electrophysiology experiments, we used flies that were aged between one to three days, while for imaging, they were aged between nine to fourteen days. You can find a detailed list of fly genotypes and reagents in Supplementary Tables 2 and 3.
Two-photon calcium imaging
Calcium imaging was executed similar to our previous study. To summarize, we anesthetized flies over ice and a cooled aluminum platform, then secured them onto custom 3D-printed holders. We aimed to minimize brain movement by stabilizing the proboscis and head, steering the eyes, head, and anterior tip of the thorax to the holder with glue. A small portion of the back of the brain’s surface cuticle, trachea, and air sacs were removed using fine forceps for imaging access to the FB. The flies were positioned over an air-supported ball (9 mm in diameter, painted with black spots, kept afloat by air) while we used two cameras (30 fps) situated at the front and side of the fly. A third camera (100 fps) tracked the ball via Fictrac software. Two infrared LEDs illuminated the fly and the ball during the experiment. We also continuously perfused the brain with extracellular saline and heated it to 33°C.
All imaging occurred under a 20× water objective using an infrared laser set at 920 nm. Simultaneous fluorescence emissions from GCaMP7f and tdTomato were separated by bandpass filters and recorded. Each volume consisted of three optical sections, collected at a speed of 8 volumes per second.
For imaging, the flies walked on a floating ball while receiving wind and odor stimuli, controlled via bespoke Python code. We arranged random patterns for the wind direction and maintained airflow for the duration of each trial while also integrating a compensatory system. All air streams for wind, ball support, odor, and compensation passed through a pressure regulator and charcoal filters.
During wind-shift trials, we adjusted the wind direction by 90° either with or without odor present. Control trials were included in the analyses irrespective of whether odor was involved.
Electrophysiology
For the electrophysiology part, we anesthetized the flies with ice, glued them to holders, and removed their front legs. A significant piece of cuticle, trachea, and air sacs from the back of the brain was also removed. The brain was continuously perfused with saline bubbles for the duration of the experiment. Using a 40× objective, we visualized GFP-positive cell bodies for recording purposes. Prior to the recordings, we made sure to clean the target cell area thoroughly.
For patch clamp recordings, we utilized glass pipettes filled with specific intracellular solutions and the voltage signals were amplified and digitized. We activated CsChrimson with red light, adjusting the voltage signals, which were then analyzed through various experiments. While most results in this paper focus on the light pulse stimuli, we did observe voltage changes across various patterns.
In some setups, we introduced drugs to block neurotransmitter receptors and allow for more precise observations. This involved careful timing, threshold adjustments, and statistical documentation of the different drugs and conditions used, available in Supplementary Table 4.
Immunohistochemistry
For immunohistochemistry, we fixed dissected brains in paraformaldehyde for a brief period before processing them with various washing and incubation steps involving primary and secondary antibodies. The details on antibody types, concentrations, and imaging techniques can be found systematically laid out in the description.
When comparing neuron morphology to other drivers, it was essential to identify overlapping neurons effectively, ensuring we derived meaningful representations from our imaging data.
Data analysis
Connectomic analysis
Data derived from the hemibrain connectome was obtained and analyzed through custom Python scripts. We structured the weight matrices accordingly and processed various synaptic connections using the corresponding datasets.
Calcium imaging and behaviour analysis
Using Fictrac software, we transformed the rotations of a custom ball into walking trajectories, subsequently calculating various velocity measures. The calcium imaging data underwent thorough pre-processing, including necessary alignments with behavioral data and threshold determinations.
We observed specific neuronal activity patterns and outlined the time frames for measuring certain activity benchmarks post-odour exposure. Moreover, we calculated and normalized values for various trials to draw comparisons and generate visual analytics of the behaviour patterns.
Electrophysiology analysis
For the electrophysiology data, significant processing was conducted using filtering techniques alongside persistent excitation calculations. The results were then visualized systematically for comparisons, maintaining a detail-oriented approach throughout.
Statistics and reproducibility
All statistics were thoroughly conducted using specific software and specifications defined in Supplementary Table 1. We ensured non-parametric statistical tests were employed wherever necessary, setting a uniform standard for significance.
Modelling
Full FB model
To delve into the fly brain’s network dynamics, we developed a model encompassing key neuronal populations, applying integrative techniques for rate-based dynamical systems. We established connection patterns based on empirical data and fine-tuned the random inputs reflecting realistic behavioral simulations.
Simple recurrent network model
For a streamlined version of the recurrent network, we simplified it to a smaller variable set that encapsulated essential dynamics while retaining the core properties of the previously established model.
Reporting summary
Further information related to this study can be found in the linked Nature Portfolio Reporting Summary.






