Synaptic gradients transform object location to action

To survive, animals must convert sensory information into appropriate behaviours1,2. Vision is a common sense for locating ethologically relevant stimuli and guiding motor responses3–5. How circuitry converts object location in retinal coordinates to movement direction in body coordinates remains largely unknown. Here we show through behaviour, physiology, anatomy and connectomics in Drosophila that visuomotor transformation occurs by conversion of topographic maps formed by the dendrites of feature-detecting visual projection neurons (VPNs)6,7 into synaptic weight gradients of VPN outputs onto central brain neurons. We demonstrate how this gradient motif transforms the anteroposterior location of a visual looming stimulus into the fly’s directional escape. Specifically, we discover that two neurons postsynaptic to a looming-responsive VPN type promote opposite takeoff directions. Opposite synaptic weight gradients onto these neurons from looming VPNs in different visual field regions convert localized looming threats into correctly oriented escapes. For a second looming-responsive VPN type, we demonstrate graded responses along the dorsoventral axis. We show that this synaptic gradient motif generalizes across all 20 primary VPN cell types and most often arises without VPN axon topography. Synaptic gradients may thus be a general mechanism for conveying spatial features of sensory information into directed motor outputs.

To survive, animals must convert sensory information into appropriate behaviours 1,2 . Vision is a common sense for locating ethologically relevant stimuli and guiding motor responses [3][4][5] . How circuitry converts object location in retinal coordinates to movement direction in body coordinates remains largely unknown. Here we show through behaviour, physiology, anatomy and connectomics in Drosophila that visuomotor transformation occurs by conversion of topographic maps formed by the dendrites of feature-detecting visual projection neurons (VPNs) 6,7 into synaptic weight gradients of VPN outputs onto central brain neurons. We demonstrate how this gradient motif transforms the anteroposterior location of a visual looming stimulus into the fly's directional escape. Specifically, we discover that two neurons postsynaptic to a looming-responsive VPN type promote opposite takeoff directions. Opposite synaptic weight gradients onto these neurons from looming VPNs in different visual field regions convert localized looming threats into correctly oriented escapes. For a second looming-responsive VPN type, we demonstrate graded responses along the dorsoventral axis. We show that this synaptic gradient motif generalizes across all 20 primary VPN cell types and most often arises without VPN axon topography. Synaptic gradients may thus be a general mechanism for conveying spatial features of sensory information into directed motor outputs.
To catch a ball, turn when called or pick up a cup, our brains must direct not just what to do, but where to do it. Inherent to this process is a 'sensorimotor transformation' 2,8,9 in which an object's location detected in sensory space, such as the position on the retina, is converted into movement direction in motor coordinates, such as the direction of limb or joint angle changes. There is considerable evidence that topographically organized brain regions in a wide range of species encode the location and identity of visual objects [10][11][12][13] ; however, how neural connectivity patterns convey such information to downstream premotor networks, and how developmental programs specify this connectivity, remains poorly understood.
In Drosophila, VPNs that have dendrites in the optic lobe and axon terminals in the central brain detect ethologically relevant visual features, such as small-object motion or looming of dark objects 6,7,[14][15][16][17] , and are close to the sensorimotor interface. Multiple VPN types initiate visually guided behaviours 6,[18][19][20][21] , and some VPN types synapse directly onto a subset of the ≈500 premotor descending neurons (DNs) per hemibrain whose activation drives distinct motor actions [22][23][24] . There are 20-30 different types of VPN, each a population of 20-200 neurons per hemibrain (Fig. 1a), with small receptive fields (20-40°) that together cover visual space 6,15,16 . VPN dendrites in the optic lobe thus form a topographic map of visual space, and object location on the fly's retina is theoretically encoded by which VPN neurons within a given type are excited. However, it has been unclear whether, and how, this spatial information is passed to downstream partners because the axons of all VPNs within a given type terminate in narrow, distinct glomeruli within the central brain ( Fig. 1a) with little 25 or no 6,15,26,27 observable topography at the light-microscopy level. Yet several VPN cell types have been associated with direction-specific behaviours, including backing up and turning, escaping looming stimuli from different directions, collision avoidance and, in flight, saccade turns away from a visual stimulus 6,[28][29][30] . Here we examine how direction-specific visual information is transformed onto downstream premotor networks by exploring the VPN-to-postsynaptic partner interface using electron microscopy (EM), light microscopy, physiology and behaviour. giant fibre (GF) DN 35 (Fig. 1a). To investigate the control of escape direction, we measured fly responses to three different directions of looming using the FlyPEZ 33 automated assay and machine-learning-based automated tracking (Extended Data Fig. 1a). Flies moved their centre of mass (COM) away from the stimulus direction (Extended Data Fig. 1a), and takeoffs were generally 33 away from the stimulus (Extended Data Fig. 1b). As previously suggested 28 , we found takeoff direction arose from pre-takeoff postural shifts of a fly's COM relative to its middle pair of legs (Δ[T2 leg angle]; Extended Data Fig. 1c,d), which power the takeoff jump. This indicates that object location encoded by looming-sensitive VPNs, such as LC4, is passed downstream.
GF activation does not drive postural adjustments 36 and is not expected to control the escape takeoff direction. LC4 axons, however, overlap with dendrites of nine other DNs 24 (here called LC4-DNs). To examine whether LC4-DNs control takeoff direction, we focused on seven for which we had DN-specific genetic driver lines 24 (Fig. 1b). Analysis of the Drosophila 'hemibrain connectome', reconstructed from EM data 27 , confirmed that these DNs receive direct visual input from looming-sensitive VPNs, and (except for DNp06) a substantial portion of this is from LC4 (Fig. 1c) with four of them (DNp04, GF, DNp02 and DNp11) among the top 10 downstream partners of LC4 (ref. 27 ). We optogenetically activated each DN, as well as two 'combination' lines targeting either two or three LC4-DNs together, and analysed the resulting behaviour with high-speed video 33 . GF activation produced takeoff rates of greater than 90% (refs. [33][34][35][36]. Only DNp04, DNp11 and combination line activation increased takeoff rates significantly compared to that of controls (Extended Data Fig. 1e,f and Supplementary Table 1), albeit with rates lower than that for GF activation (that is, 15-40% versus >90%), suggesting that natural threats may simultaneously activate multiple LC4-DNs to drive downstream escape motor circuits. DNp04-and DNp11-activated takeoffs were almost exclusively 'long-mode', in which the wings are raised before the takeoff jump, whereas GF activation produced 'short-mode' escapes without prior wing-raising as previously described 36 (Extended Data Fig. 1g,h and Supplementary Table 1). Combination line activation drove primarily long-mode takeoff, but did also unexpectedly produce many short-mode takeoffs, which are thought to rely on GF activation. Taken together with the findings of our previous work 37 , this mixed result indicates either that the combination of DNp02, DNp04 and DNp06 inputs to the GFs, or that these DNs are not naturally co-activated with the strong intensity of optogenetic activation.

Article
Part Tracker software (Branson Lab, see Methods) and created a metric for postural shift (Fig. 1d). DNp11 activation drove flies to lean forwards, whereas activation of DNp02 (including combinations of DNp02 and DNp04 or DNp02, DNp04 and DNp06) promoted backward leaning ( Fig. 1e-g and Supplementary Videos 1 and 2). We next assessed whether these induced postural shifts led to directional takeoffs (Fig. 1h,i). Activation of DNp11 evoked forward takeoffs (Fig. 1i), whereas activation of DNp02 and DNp04 together evoked a strong bias towards backward takeoffs (Fig. 1i). As activation of DNp04 alone resulted in omnidirectional takeoffs (Fig. 1i), we reasoned that DNp02 was the main contributor to the movements leading to backward takeoff. The weak forward takeoff bias from GF activation probably results from the average resting posture of the fly, which was previously observed to have the COM slightly in front of the T2 legs 28 .
To further test whether DNp02 and DNp11 contribute to directional control during looming-evoked escape, we silenced each DN by selectively expressing Kir2.1, an inwardly rectifying potassium channel, and then measured responses to frontal (0°) or rear (180°) looming stimuli (Extended Data Fig. 2). DNp02-silenced flies took off normally (forwards) in response to rear stimuli but showed significant impairment in their ability to take off backwards in response to frontal stimuli-on average most DNp02-silenced flies took off forwards, directly towards the stimulus. This is consistent with the activation of DNp02 driving a backward postural shift, and supports a critical role for DNp02 in the postural adjustments that control backward takeoffs. Notably, flies in which DNp11 was silenced had a similar phenotype-these flies took off forwards in response to both frontal and rear looming stimuli. This could indicate that more DNs, possibly with interconnections, are involved in the control of forward takeoffs than backward ones, and also probably reflects the bias of the fly to jump forwards if no postural adjustment is made from the common resting posture. We conclude that, as flies with either DNp11 or DNp02 inactivated did not respond with normal takeoff directions to anterior or posterior looming stimuli, both DNs contribute to directional control of the fly's natural escape behaviour.

EM reveals LC4-to-DN synaptic gradients
We next sought to determine how LC4 neurons differentially convey the spatial location of the looming stimulus to DNp11 and DNp02 (Fig. 2a,b). In the right hemisphere of a complete serial section transmission EM dataset, we traced all LC4 neurons, DNp02 and DNp11 (FAFB dataset 38 ; Fig. 2c) and marked synapses between LC4 neurons and each DN. We found a wide range (1 to 75) in the number of synapses individual LC4 neurons made with a given DN (Extended Data Fig. 3a). We next investigated whether LC4 neurons that synapsed more with DNp11 or DNp02 had dendrites located in a particular region of the lobula neuropil. We visualized the LC4 dendrites in the lobula and coloured each neuron by the number of synapses it made with a given DN. This revealed antiparallel synaptic number gradients along the lobula anterior-posterior (A-P) axis for DNp02 and DNp11 (Fig. 2d). By contrast, A-P gradients were not seen in LC4 connectivity onto the GF and DNp04 (Extended Data Fig. 3b,c). The same A-P gradient patterns with LC4 synapses onto DNp11 and DNp02 were seen in an EM dataset from a second brain (hemibrain) 27 (Fig. 2e-g). This was supported by a strong negative correlation between the number of synapses a given LC4 makes with DNp11 and with DNp02 (Fig. 2h). The orientation of these gradients   corresponds to the backward-and forward-jumping motor outputs of DNp02 and DNp11, respectively. Taken together, the behaviour and connectomic data support a simple model: antiparallel synaptic gradients transform locally detected object location into oppositely directed behaviours. A frontward looming stimulus activates anterior LC4 neurons that provide relatively more drive to DNp02, which produces backward body movements generating a backward escape trajectory following co-activation with DNp04 or other escape pathways. For a stimulus looming from behind, posterior LC4 neurons become more active and drive DNp11 to generate forward postural shifts and a forward-directed takeoff.

Synaptic gradients are functional
The synapse gradient model is based on the assumption that synapse number correlates with connection strength. To directly test this, we carried out in vivo whole-cell patch-clamp recordings from DNp02, DNp11, DNp04 and the GF during visual looming stimulation at varying locations along the A-P axis of the visual space. We presented vertical arrays of small dark expanding discs at four different azimuthal locations ipsilateral to the targeted DN ( Fig. 3a and Extended Data Fig. 4a). DNp02, DNp11, the GF and DNp04 all depolarized in response to looming, and all except the GF produced action potentials (Fig. 3a-f and Extended Data Fig. 4b-j; see Methods for identification of action potentials).
DNp02 produced more action potentials in response to anterior, compared to more posterior, stimuli (44 versus 13 spikes across all trials), whereas DNp11 exhibited the opposite trend (Fig. 3b,c,e and Extended Data Fig. 4i). These trends were consistent for both individual ( Fig. 3c and Extended Data Fig. 4c,i) and averaged (Fig. 3e) responses. By contrast, DNp04 produced bursts of action potentials without significant azimuth tuning (Extended Data Fig. 4c-f,i). In agreement with the action potential tuning curves, depolarizing membrane potentials in DNp02 were larger for more anterior azimuthal locations of the looming stimulus, whereas those for DNp11 were larger for more posterior looming locations (Fig. 3d,f and Extended Data Fig. 4j). For the GF, we did not see distinct tuning properties for the anterior-posterior location of the stimuli. DNp04 did show a trend towards stronger responses to anterior stimuli, although the responses were more variable than for DNp11 or DNp02 (Extended Data Fig. 4g,h,j).
If synapse number correlates directly with input current drive to the postsynaptic cell, we should be able to predict the DN responses to looming stimuli at different azimuthal locations. To assess this, we used the EM data to make a model incorporating both the spatial profile of LC4 dendrites and the synaptic connectivity of LC4 axons with DNs. Main dendritic branches of all 55 LC4 neurons in the FAFB dataset 38 were mapped from lobula to eye coordinates following a previously established method 25 (Fig. 3g and Extended Data Fig. 5a-c). The normalized estimated responses to looming recapitulated the azimuthal tunings predicted by the synaptic gradients and matched the responses for all four DNs we measured (Fig. 3h,i and Extended Data Fig. 5d-f). We conclude that the synaptic numbers observed from EM data can be interpreted as functional synaptic weights.

Article
We used this model to simulate responses to looming from azimuthal locations across the whole visual hemisphere, including those not possible in our physiology experiments. Our simulation showed strong antiparallel looming response profiles for DNp02 and DNp11 across nearly the whole visual hemifield (30°-130°), supporting the observed synaptic gradients as predictive of functional response profiles (Fig. 3j). Taken together, these results corroborate the model that anterior LC4 neurons provide stronger inputs to DNp02 in response to anterior stimuli whereas posterior LC4 neurons provide more drive to DNp11 in response to posterior stimuli in a graded fashion. This differential connectivity drives the backward (DNp02) or forward (DNp11) escape takeoffs away from looming threats.

Synaptic gradients are a common wiring motif
To address the question of whether visuomotor transformation through gradients of synapses is limited to just LC4 and DNp02 and DNp11 or whether it represents a general circuit wiring logic, we analysed the output connectivity patterns of 20 VPN cell types 6 using data from the hemibrain connectome 27 . First, we used principal component analysis and k-means analyses to cluster individual neurons within a VPN cell type on the basis of the similarity of their outputs (that is, the number of synapses they form onto the set of synaptic partners within their respective optic glomerulus; Extended Data Fig. 6a and Methods). Next, we colour-coded each cluster to visualize the relationship between a neuron's cluster identity and the spatial location of its dendrites in the lobula. A striking spatial separation of the clusters was found in most VPN cell types ( Fig. 4a,b), revealing widespread differential synaptic connectivity, such that individual neurons within one VPN cell type elaborated quantitatively and qualitatively different outputs in the glomerulus depending on the location of their dendrites in the lobula ( Fig. 4c and Extended Data Fig. 6b-g).
To investigate these properties in more detail, we analysed synaptic connectivity between two VPN cell types (LC4 and LPLC2) and the top 25 postsynaptic partners of each of them ( Fig. 4d-g). Both VPN cells types are looming detectors and share some postsynaptic partners, including the GF 6,34,39 . For each VPN cell type, we first assessed the similarity of its outputs onto different postsynaptic neurons by measuring the pairwise correlation for all 300 possible pairs of its top 25 postsynaptic partners (similar to LC4 and DNp02 or DNp11 in Fig. 2h). The resulting matrices revealed that postsynaptic targets of LC4 and LPLC2 formed three and five connectivity-based clusters, respectively (Fig. 4d,f). Thus, different postsynaptic partners receive different patterns of input from the same VPN cell type. Next, to visualize the relationship between this differential input and VPN dendritic maps, we calculated weighted dendritic input centroids for each of the top 25 postsynaptic partners of LC4 and LPLC2, and measured pairwise distances between them (Extended Data Fig. 9a-h and Methods). These indicate spatial regions of the lobula providing the most input to a given postsynaptic partner. The resulting topographic maps (Fig. 4e,g) revealed that all three connectivity-based clusters for LC4 clearly segregated along the A-P axis of the lobula (Fig. 4e). By contrast, two out of five clusters for LPLC2 segregated along the A-P axis of the lobula, two segregated along the D-V axis, and one cluster had no spatial bias (that is, neurons from this cluster receive uniform input from all LPLC2 neurons; Fig. 4g). Notably, both the numbers and topographic positions of these clusters largely match the results of k-means analysis for both VPN cell types (Fig. 4a).
These examples illustrate how the topographic map of VPN dendritic inputs in the optic lobe is converted into maps of graded synaptic weights in the optic glomerulus. We observed synaptic gradients reflecting both the A-P and D-V axes of the dendritic map across all 20 VPN cell types ( Fig. 4h and Extended Data Fig. 7), analogous to those we originally found in the fly directional escape circuit (Fig. 2). The ethological relevance of some of these gradients may be deduced from the known function of postsynaptic neurons in the literature. For example, the D-V gradient from LPLC4 onto DNp07 may control landing behaviour 22 (Fig. 4h) and the A-P gradient from LPLC1 onto PLP219 (Extended Data Fig. 7) could regulate collision avoidance 29 . Thus, we propose that conversion of visual space coordinates into graded synaptic connectivity is a shared feature of VPN wiring.

Synaptic gradients with or without axon topography
Topographic arrangement of VPN axons would provide a simple mechanism for the development of synaptic gradients. Previous studies concluded that this was unlikely 6,15,25,26 (with an exception of LC10 (refs. 6,13 ) and traces of topography in the LC6 (ref. 25 ) glomerulus). Here we revisited this issue using EM data 27 and looked for axon topography corresponding to dendritic arrangement along either the A-P or D-V axis of the lobula. We found five additional VPN cell types (LC4, LC9, LC22, LPLC1 and LPLC4) that have axon terminals retaining rough A-P topography, and one (LC16) whose axons maintain traces of D-V topography ( In summary, VPNs fall into two classes (Fig. 5c). In one, synaptic gradients correlate with axon topography within the glomerulus and in the other they do not.

DN dendrite location matches LC4 synaptic gradients
We focused on LC4 to understand how axon topography leads to the formation of synaptic gradients. We found that for the top 25 postsynaptic partners of LC4, the spatial distribution of postsynaptic sites in the LC4 glomerulus strongly correlated with the positions of LC4 dendrites in the lobula (Fig. 6a, Extended Data Fig. 9g,i and Methods). This is exemplified by DNp02 and DNp11 receiving anticorrelated inputs from LC4 axons (Figs. 2h and 4d,e) and having spatially segregated postsynaptic sites in the LC4 glomerulus ( Fig. 6b and Extended Data Fig. 9i). Topographic mapping of the LC4 axon terminals alone cannot account for these patterns.
To assess whether the spatial distribution of DN dendrites also contributes to differential connectivity, we mapped the positions of dendrites of different DN neurons within the LC4 glomerulus using light microscopy. DNp02 and DNp11 dendrites occupy unique glomerular sub-compartments where axons of LC4 corresponding to anterior and posterior visual fields selectively terminate. By contrast, dendrites of DNp04, a postsynaptic neuron with no A-P synaptic gradient with LC4, arborize uniformly within the LC4 glomerulus (Fig. 6c,d and Extended Data Fig. 10a-c).
To map synapses at the light level, we used a modification of the STaR 41 method to visualize presynaptic sites in sparsely labelled LC4 neurons (Extended Data Fig. 10d,e) and assessed their proximity to DNp02 and DNp11 dendrites ( Fig. 6e-h). The presynaptic sites of LC4 from the anterior lobula were much closer on average to the DNp02 dendrites than those from the posterior (Fig. 6e,g and Supplementary Videos 5 and 6). Conversely, DNp11 dendrites were closer to the presynaptic sites of LC4 from the posterior lobula.
In summary, LC4 utilizes a spatial wiring strategy to attain graded synaptic connectivity. A combination of topographic arrangement of LC4 axons and placement of DNp02 and DNp11 dendrites within different spatial domains in the glomerulus determines the directional specificity of the escape response to looming stimuli from different regions of the visual field.

Spatially independent synaptic gradients in LPLC2
The synaptic gradients elaborated by LPLC2 form in a fundamentally different way from those elaborated by LC4. Analysis of the top 25 postsynaptic partners of LPLC2 found no significant relationship between positions of LPLC2 dendrites in the lobula (that is, synaptic output specificity) and the spatial arrangement of synapses in the LPLC2 glomerulus ( Fig. 6i and Extended Data Fig. 9h,j). For example, the postsynaptic neurons PVLP071 and PVPL076 have anticorrelated inputs from LPLC2 (Fig. 4f,g), yet their postsynaptic sites are intermingled in the LPLC2 glomerulus ( Fig. 6j and Extended Data Fig. 9j).
We confirmed this principle by labelling presynaptic sites in axons of individual LPLC2 neurons with dendrites within the dorsal and ventral lobula and measuring the proximity of these presynaptic sites to the GF dendrites ( Fig. 6k and Extended Data Fig. 10f). No significant difference in distances was found (Fig. 6l) despite a marked difference in synapse counts (Fig. 4h). Thus, the spatial distribution of synapses in the LPLC2 glomerulus seems random. To assess this principle in a more systematic manner, we further analysed EM data (hemibrain) and measured the correlation between axo-dendritic overlap and synaptic counts for four topographic and four non-topographic VPNs and their postsynaptic partners (Extended Data Fig. 11). Our results strengthened the notion that VPNs utilize two qualitatively different wiring strategies to form synaptic gradients.
We next sought to assess whether the synaptic gradients of LPLC2 onto the GF were functionally significant (Fig. 4h). The dendrites of LPLC2 neurons expressing the P2X 2 receptor were locally activated by injection of ATP in the dorsal and ventral regions of the lobula, and the response in the GF was assessed using electrophysiological recordings (Extended Data Fig. 12a). GF responses following activation of dorsal LPLC2 were significantly stronger than those following ventral ATP injections. By contrast, little difference was seen in response following stimulation of dorsal versus ventral LC4 (also connected to the GF, but without a notable D-V synaptic gradient; Fig. 6m and Extended Data Fig. 12b,c).
In summary, functionally relevant graded synaptic connectivity of LPLC2 is established through a spatially independent mechanism.

Discussion
We took advantage of cell-type-specific genetic tools, behavioural and physiological analyses, and densely reconstructed neuron connectivity maps to examine a central brain sensory-to-motor interface at synaptic resolution. We showed that the transformation of object location from retinal to body coordinates is solved by gradients of synapses between spatially ordered visual-feature-detecting neurons (that is, VPNs) and movement-direction-specific premotor neurons (that is, DNs). We demonstrated that such numeric gradients produce functional synaptic weights and lead to predictable response differences in postsynaptic neurons that drive fly escape takeoffs correctly oriented away from looming threats. Individual cells within one VPN cell type are thus functionally heterogeneous with connectivity profiles often as dissimilar as ones found between different neuron types. It is this continuous heterogeneity that converts visual stimuli into ethologically relevant behavioural responses.
We discovered behavioural roles for individual DNs (DNp02 and DNp11), and it may be tempting to consider these as command neurons for particular body movement directions. However, several observations suggest that they act instead as members of a larger DN group whose combined activity represents both the strength of the drive to takeoff and movement direction. First, when optogenetically activated alone no LC4-DN drove a high takeoff rate (25% takeoff rate maximum, all long-mode takeoffs). By contrast, activation of the command-like GF drove nearly 100% takeoff (all short-mode takeoffs). Second, activation of DN combinations (for example, DNp02 and DNp04 or DNp02, DNp04 and DNp06), increased takeoff rates significantly, although only up to about 40% takeoff. This suggests that co-activation of multiple DNs drives the long-mode takeoff and more DNs than we identified probably participate. Finally, whereas co-activation of DNp02 and DNp04 increased the backward shift of flies compared to activation of DNp02 alone, this shift was reduced by additional co-activation of DNp06. Thus, different DNs may 'vote' for movement in a particular direction and the resulting behaviour is the sum of these votes, much like the population activity in directionally selective motor cortex neurons correlates with movement direction in primates 42 . This mechanism could extend beyond forward and backward control if the left and right DNs of the same type, which would be differentially activated in the event of a looming stimulus from the side, also independently 'voted' for leftward or rightward body shifts, much like unilateral activity in DNg02 neurons correlates with left or right flight saccades in flying flies 43 . By this mechanism it would be plausible for the fly to obtain the ability to takeoff in any direction relative to its body, as has been observed in behavioural data.
Expanding our analysis to 20 different VPN cell types and their postsynaptic partners revealed synaptic gradients as a general property of visual feature detector output in Drosophila. Evidence consistent with   a gradient motif has been observed at the sensorimotor interface of the cockroach cercal system, where input from directionally selective abdominal wind-sensitive hairs has graded effects on the response of downstream giant interneurons, which drive escape 44 . Thus, synaptic number gradients may be a general principle for transmission of spatial information between sensory and motor networks. VPNs guide innate visual behaviours of the fly, including loomingevoked backing or takeoff and small-object tracking 6,16 . We expect that the synaptic gradients we described here are specified by genetically hard-wired developmental processes, rather than through experience. In support of a developmental origin, we observed substantially the same LC4-DN gradients in EM volumes of two different fly brains 27,38 . The same wiring motif, however, could be present in more flexible areas of sensorimotor interface such as ellipsoid body 'compass' neurons 45 and would provide a simple mechanism for how learning-induced changes in numbers of synapses between neurons could result in different stimulus-behaviour pairings.
We identified two different circuit wiring strategies producing synaptic gradients in different VPN cell types. In the 'spatial' strategy, topographic mapping of VPN axon terminals organizes the optic glomerulus and is 'read out' by stereotypically positioned dendrites of different target neurons. Axonal topography may arise through age-dependent mechanisms as described for more peripheral regions of the fly visual system 46 , or through graded expression of cell surface molecules (for example, Eph receptors and ephrins) as described in the vertebrate visual system 47 . Developmental mechanisms must act in parallel to target dendritic processes of different postsynaptic neuron types to discrete domains within the glomerulus.
Most VPN cell types we examined (12/20), however, did not show clear topographic organization of their axonal projections. Thus, in most cases, gradients emerge in the absence of spatial cues. Molecular heterogeneity within one cell type previously found in the fly visual system 48 and mouse visual cortex 49 may underlie such differential synaptic specificity. Future work should examine whether spatial gradients of molecular regulators instruct differential expression of cell adhesion and recognition molecules in VPNs, thereby transforming a retinotopic arrangement of dendritic arbours in the optic lobe into a graded distribution of synapses in the central brain.

Online content
Any methods, additional references, Nature Portfolio reporting summaries, source data, extended data, supplementary information, acknowledgements, peer review information; details of author contributions and competing interests; and statements of data and code availability are available at https://doi.org/10.1038/s41586-022-05562-8.

Experimental model details
Flies were reared under standard conditions at 25 °C and 50% humidity with a 16-h light/8-h dark cycle on a standard cornmeal fly food. Male and female flies 3-5 days after eclosion were used for all experiments except if specified otherwise. Flies used for optogenetic activation experiments were raised on 0.2 mM retinal (Sigma R2500) food, and maintained on 0.4 mM retinal food as adults. These flies were kept in the dark in foil-covered vials until they were prepared for experiments. Supplementary Table 2 provides detailed descriptions of fly genotypes used in each experiment and origins of transgenic stocks.

Behavioural experiments
High-throughput takeoff assay. We tested escape responses of unrestrained flies using our previously developed FlyPEZ 33 system to automate fly behaviour experiments and collect large sample sizes necessary to quantitatively characterize differences in escape behaviour. In FlyPEZ, individual flies were released one at a time onto a 5 mm by 5 mm glass platform through an automated gate without undue perturbation, where they were targeted for visual or optogenetic stimulation. The fly position on the platform was tracked using a real-time tracking algorithm, which coordinated the triggering of a high-speed video camera and either looming stimulus or light stimulus. For visual stimulation, we used digital micromirror device projectors running at a refresh rate of 360 Hz, controlled by MATLAB using the Psychophysics Toolbox. Dark looming discs expanding from 10° to 180° at an elevation of 45° and azimuth of 0°, 90° or 180° ± 22.5° relative to the fly head position were presented on a 7-inch-diameter back-projection coated dome centred over the fly platform, which covers 360° in azimuth and 120° in elevation of the fly's visual field. To simulate an object approaching with constant velocity, the projected looming disc centre remained constant while the disc radius increased nonlinearly over time on the basis of the following equation θ t l vt ( ) = 2tan −1 in which θ is the angular size of the stimulus (in radians), l is the radius of the virtual object, and v is its simulated approach velocity. t = 0 is the theoretical time of contact, when the object would reach 180°, so that t < 0 during object expansion. For optogenetic stimulation, CsChrimson was activated in flies raised on retinal food with four 624-nm wavelength light-emitting diodes (total irradiance of 500 W m −2 , as measured from the location of the fly on the platform). Escape responses were captured using a macro lens on a high-speed camera, and two perspectives of the fly (side and bottom views) were filmed at 6,000 frames per second under 850-nm infrared illumination. Only one stimulus was presented per fly, and the platform was cleared before release of the subsequent fly. All looming experiments were carried out during the 4-h activity peak in the afternoon light cycle, and all optogenetic experiments were carried out in the dark.
Behavioural data analysis. Escape sequence durations in the CsChrimson activation and Kir2.1-silencing experiments were manually annotated by labelling the first frame of wing raising and the last frame of tarsal contact from the FlyPEZ video data. For the analysis of postural shifts and takeoff angles following either optogenetic activation or looming stimulus presentation, we used a machine learning software package, Animal Part Tracker (APT, a software package developed by the Branson Lab at Janelia) v0.3.4, which allowed us to automatically track locations of body parts in the input videos. For automated tracking, the videos were subsampled at 600 Hz (1.67-ms interval), which was sufficient to observe smooth changes in leg and body movements. Missing tracking data due to occlusions (body part out of frame) were interpolated for gaps less than five frames (8.33 ms), and a movingaverage filter was applied to smooth the raw tracking data. For optogenetic activation experiments, videos in which visibility of T2 legs was lost over the 100 ms of annotation were excluded, except for cases in which the fly performed a takeoff. For silencing experiments, videos in which visibility of T2 legs was lost between the stimulus start and the start of jumping leg extension were excluded from the COM movement, COM flow field and T2 leg angle analyses. Individual takeoff vectors were obtained from two locations of the COM, one at takeoff, when the last of the middle tarsi loses contact with the ground (t end ), and one either at a manually annotated frame of the start of jumping leg extension, or at 5 ms before the takeoff (t start ; Fig. 1i). The population mean resultant length, R , is calculated by the following equation in which n is the total number of the takeoff vectors, and e iθ is Euler's formula as a simplified representation of a vector. R is a statistic between 0 and 1 for the spread of a circular variable in the population, such that 1 means all of the takeoff directions are concentrated at a single angle, and 0 means the spread is more uniform. The COM referenced to fly body-centric coordinates was obtained by translating and rotating the COM as described in Extended Data Fig. 1c. Δ[T2 leg angle] at a given time frame of the FlyPEZ video was obtained using the APT-tracked tarsal tips of the middle legs and the COM as described in Fig. 1d. A Butterworth filter was applied to the T2 leg angle time series results. Individual COM movement vectors were calculated as the vector from COM 0 to COM pre (Extended Data Fig. 1d).

Electrophysiological experiments
Electrophysiological recordings and data analysis. Female flies of 2-4 days in age were anaesthetized on a Peltier-driven cold plate and positioned ventral side up to be tethered on a custom polyetherether-ketone recording plate by applying ultraviolet-cure glue to the head and thorax. We used only female flies because: female flies are larger and hence less prone to desiccation than male flies, and so have the potential to provide longer-lasting electrophysiological recordings; and both the hemibrain and full brain (FAFB) EM datasets were collected from female flies, so our direct measurements of the gradients are both in female flies. For recording stability, the proboscis was glued in a retracted position and the front pair of legs were clipped and glued at the femur. To access the DN soma for whole-cell recording, a window was cut in the cuticle on the posterior side of the head, and the overlying fat and trachea were removed. The brain was continuously perfused during electrophysiology with the external solution containing (in mM): 103 NaCl, 3 KCl, 5 N-Tris (hydroxymethyl)methyl-2-aminoethane-sulfonic acid, 8 trehalose, 10 glucose, 26 NaHCO 3 , 1 NaH 2 PO 4 , 1.5 CaCl 2 and 4 MgCl 2 , bubbled with 95% O 2 and 5% CO 2 , and adjusted to pH 7.3 and 273-276 mOsm. To disrupt the perineural sheath around the soma of interest, collagenase (0.25 mg ml −1 in external solution) was applied locally with a large-bore pipette to the surface of the brain. A small amount of tissue was then removed by using suction from a pipette filled with external solution to gain unrestricted patch pipette access. Patch pipettes were made from borosilicate glass using a Sutter p-1000 puller and fire-polished after pulling using a Narishige MF-900 microforge to achieve a final resistance of 4-8 MΩ. The internal solution contained (in mM): 140 potassium aspartate, 10 4-(2-hydroxyethyl)-1-piperazineethanesulfonic acid, 1 ethylene glycol tetraacetic acid, 4 MgATP, 0.5 Na 3 GTP and 1 KCl. The pH was 7.3 and the osmolarity was adjusted to approximately 265 mOsm. To obtain patch-clamp recordings, DN somata were visually targeted through brief GFP excitation.
Recordings were acquired in current-clamp mode with a MultiClamp 700B amplifier (Molecular Devices), low-pass filtered at 10 kHz, and digitized at 40 kHz (Digidata 1440A, Molecular Devices). Whole-cell recording data were analysed in MATLAB using custom written code or using Clampfit 11 software (Molecular Devices), and graphical representation was carried out by using Prism 9.2.0 software (GraphPad). Spike events in response to looming stimuli were determined on the basis of the rise slope (mV ms −1 ) in the response region above a threshold given from the averaged maximum slope in the baseline region across individual recordings, followed by visual inspection of the raw data. The baseline region of each trial corresponded to the 2-s time window before the beginning of the looming stimulus. The response region was the 150-ms period after the onset of the stimulus. To estimate the magnitude of depolarization in response to looming stimuli, membrane potentials were averaged across individual trials (4-8 trials per neuron), and the area (ms × mV) was calculated in the 150-ms response region.
Visual stimulation for electrophysiology. Custom visual stimuli were produced in MATLAB using the Psychophysics Toolbox to display looming stimuli with different approach angles around the fly. We were limited in how far posterior we could show stimuli owing to constraints of the plate to which the fly was tethered to for accessing the back of the head capsule and the microscope. This was especially an issue for DNp11 recordings, as the microscope objective blocks presentation of the posterior stimuli that should most strongly excite DNp11. Thus, our strategy for assessing the functional gradient of the receptive field (RF) was to compare directly measured visual responses in the experimentally accessible visual field to responses predicted by a model we generated from the measured synaptic numbers and an alignment with the visual world (see the section below entitled Mapping the LC4 anatomical RF). Within our accessible visual area, we generated looming stimuli at 32.5°, 45°, 57.5° and 70° along the eye equator (anterior to posterior) and then pitched the plane of these stimuli down 20° to roughly coincide with the tilt of the synaptic gradients we measured. Looming stimuli from different azimuths were shown in randomized sets. Looming stimuli were arrays of three discs, black on a white background, and programmed to expand from 0° to 30° in azimuth in each disc with a 12-s inter-stimulus interval. We used three-disc vertical arrays because we wanted to use a stimulus that would produce as strong a response as possible and which could be varied in azimuth. As LC4 neurons have only an approximately 40° RF, only a handful of LC4 neurons may be excited by a single looming stimulus. Therefore, to activate more LC4 neurons along a given azimuth, we used a column of three. See Extended Data Fig. 4a for a depiction of the looming stimuli used. Visual stimuli were back-projected at 360 Hz onto a 4-inch diameter dome at 768 × 768 resolution. Stimulus frames were synchronized by simultaneously recording a photodiode with the recording trace that monitored a patch of each frame projected just outside the dome and coloured black or white on alternate frames. Constant angular velocity stimuli were generated using the following equation in which θ is the angular size of the stimulus, v a is the angular velocity, and θ = 0 at t = 0. All stimuli were corrected for distortion and irradiance differences as described previously.

P2X 2 experiments.
Whole-cell patch-clamp recordings from the GF were carried out in 2-4-day-old female flies as described above. For P2X 2 receptor activation of LC4 or LPLC2 VPNs, a glass capillary pulled to a 1-μm diameter was positioned on the VPN dendrites, which expressed both GFP and the P2X 2 receptor, approximately 50 μm below the surface of the brain. ATP (Sigma A9187, 5 mM) was microinjected (5 psi, 200-ms pulse) under the control of a Picospritzer (Parker Hannifin). To test dorsoventral gradients of functional connectivity between the VPNs and the GF, either the dorsal or ventral part of the lobula was stimulated in an alternating fashion at 90-s intervals to permit recovery between pulses. Whole-cell recording data were analysed as mentioned above. Before calculating the peak amplitudes of the GF response, the membrane potential traces acquired during ATP applications were low-pass filtered and averaged across individual trials as specified in the figure legends.

Confocal image acquisition and processing
Immunofluorescence images were acquired using a Zeiss LSM 880 confocal microscope with Zen digital imaging software using an oil-immersion ×63 objective. Serial optical sections were obtained from whole-mount brains with a typical resolution of 1,024 μm × 1,024 μm × 0.5 μm. Image stacks were exported to Imaris 9.7 for level adjustment, cropping and removal of signal in off-target brain regions and background noise, as well as 3D volume reconstructions.

Analysis of neuroanatomical data from confocal image stacks
To assess and measure the differential placement of DN dendrites within the LC4 glomerulus, confocal image stacks of colocalized glomeruli and DN dendrites were aligned so that the x axis corresponded to the sagittal diameter (width) of the glomerulus and cropped at the edges of the glomerulus to exclude any extraglomerular DN dendrites from consideration. 3D reconstructions of LC4 axon terminals and DN dendrites were obtained using the Imaris Filaments tool (Extended Data Fig. 10b). The x coordinates of the filaments were exported to GraphPad Prism 9.2.0 and normalized to the sagittal diameter of the LC4 glomerulus (0-1 range). The x coordinate of the centroid of the DN dendritic arbour was calculated as a mean of x coordinates of all filaments and used as a final metric of spatial distribution of dendrites within the glomerulus (Extended Data Fig. 10c).
To assess the spatial proximity between presynaptic sites of individual LC4 or LPLC2 neurons and DN dendrites (single-cell STaR experiments), Brp puncta in single VPN cells were reconstructed using the Imaris Spots tool, followed by identification of their centroids, as well as centroids of reconstructed dendritic filaments. Distance between Brp puncta and DN dendrite centroids was measured along the sagittal diameter of the glomerulus (LC4) or along three cardinal axes (A-P, D-V and L-M) of the glomerulus (for LPLC2). Only female flies were used for analysis to be consistent with the available connectome data, which are in a female fly. Analyser was not blinded to genotype due to characteristic identifiable morphology of DNp02, DNp11 and DNp04, as well as clear anatomical positions of anterior-posterior LC4 and LPLC2.

Connectomics analysis
FAFB connectome reconstruction analysis. We annotated the FAFB serial section transmission EM volume using the CATMAID software to determine the chemical synaptic connectivity between the LC4 neurons and four DNs of interest, DNp02, DNp11, GF and DNp04. As a starting point, we used previously traced skeletons for LC4 neurons. To start tracing the DNs, we used morphological cues from confocal fluorescence imaging in distinct strategies to locate a starting point for tracing each DN. For DNp02, confocal microscopy stacks suggested that the somata neurite travels close to the path of the GF somata neurite. We found DNp02 by locating its neurite within a shared soma tract, which, along with several other neurites, appears encased in a dark sheath. DNp04 was located when tracing the LC4 neurons. The skeleton was then traced out and linked to the same soma tract as DNp02 and GF. DNp11 was located by searching for candidate DNs that cross the midline dorsal of the oesophagus. From each starting node, the full skeleton was traced and compared to the confocal image stacks for confirmation of cell type identity. To determine the chemical synaptic connectivity, we searched for four criteria: T-bars, presynaptic vesicles, synaptic clefts and postsynaptic densities. If a potential synapse possessed two out of four criteria, it was labelled as a synapse. We focused our efforts on LC4 (presynaptic) and DNp02, DNp11, GF and DNp04 (postsynaptic) synapses to gain a representative view of the connectivity between LC4 and the DNs.
Mapping the LC4 anatomical RF. To model the real-world RFs of the LC4 population, we followed a previously established method 25 , and applied it to newly reconstructed LC4 neurons. We first mapped all 55 LC4 dendrites (FAFB volume) onto a layer of the lobula by fitting a second-order surface to all of the dendritic arbours. Each projected dendrite traced out a polygon that represented the field of view of the corresponding LC4 neuron. We modelled each LC4 as a 2D circular Gaussian on this surface. Its height was set to be unity, and its width was given by the radius of a circle that had the same area as the projected polygon. To map each LC4 neuron's location (COM of the dendrite) onto eye coordinates, we used as reference points previously reconstructed Tm5 neurons 25 from two medulla columns, which correspond to the centre of the eye and a dorsal position on the central meridian (the line that partitions the eye between anterior and posterior halves). To estimate an LC4-DN's RF, we first multiplied each LC4 Gaussian's height by the number of synaptic connections to that LC4-DN. We then summed all LC4 Gaussians to produce a 2D multi-Gaussian distribution, which was the LC4-DN's RF. To estimate an LC4-DN's response to a looming stimulus, we multiplied the LC4 Gaussian's height by both the number of synaptic connections and the percentage of the LC4 RF that was covered by the stimulus at its maximum size (30°). For instance, if the stimulus overlapped with 40% of an LC4's RF, then that LC4 Gaussian's effective height was the number of connections times 0.4. Finally, all LC4 contributions were summed to produce the estimated response of the LC4-DN to the looming stimulus. Note that LC4s that did not overlap at all with a stimulus contributed nothing to the DN's response.
Hemibrain connectome reconstruction analysis. Volumetric data of neurons and neuropils, as well as connectivity data and synapse locations, were obtained from the neuPrint (hemibrain v1.1) database, (https://neuprint.janelia.org/) and have been processed with the natverse package 51 for R (v4.0.3) using custom scripts. All coordinates in these datasets are based on the original voxel resolution of 8 nm.

k-means clustering of individual neurons within VPN cell type populations.
For each VPN cell type, a matrix of synaptic connections between individual VPN neurons and their postsynaptic partners was constructed using the neuprintR package. Postsynaptic partners forming fewer than 50 total synapses with the entire VPN cell type population were excluded (about 1 synapse per individual VPN on average; we reasoned that this threshold would reflect the limit of EM data reconstruction error rate). Synaptic connections within the population of VPN cell type were also removed (for example, LC4 to LC4 synapses). The resulting matrix was scaled such that the variables (individual postsynaptic partners) had unit variance across the observations (individual VPN cells in the population). Principal component analysis was carried out on the scaled matrix. Up to ten principal components were used for k-means clustering on the individual VPNs (the number of PCs was determined on the basis of the drop in the eigenvalues in the scree plots for each VPN type). A value of k was subsequently determined from the corresponding scree plots by the drop in the within-cluster sum of squared distance (example in Extended Data Fig. 6a).
Correlation in synaptic connectivity. Matrices of correlation in synaptic connectivity (Fig. 4d,f) were generated using the pairwise Spearman's correlation coefficient of the 300 unique pairs derived from the top 25 postsynaptic partners (based on the total number of synapses and excluding connections with the same VPN cell type) of LC4 and LPLC2, ordered using hierarchical clustering. Each entry evaluates the monotonic relationship between a pair of the synaptic connectivity gradients. For each pair, the correlation coefficient was calculated using the vectors containing the number of synapses between the selected postsynaptic partners and each individual VPN cell within the population (example in Fig. 2h).

Weighted cendritic centroids.
To evaluate the distances between weighted dendritic map centroids for each postsynaptic partner of LC4 and LPLC2, we identified the endpoints of the dendrites innervating the lobula for each individual VPN cell. These were isolated using cut-planes that were manually selected to optimally separate the lobula region (Extended Data Fig. 9a-d). We then evaluated the centroid of the selected endpoints by calculating their spatial average. We repeated these steps for all VPN cells within a population (71 for LC4 and 85 for LPLC2). The resulting 3D centroids were then projected onto the cut-plane.
The outlines of the lobula were obtained by evaluating the convex hull of the projections of all the selected endpoints for all of the cells of the examined VPN. To identify a weighted innervation centroid for a given postsynaptic partner, we calculated the overall weighted median using the number of synapses associated with each centroid as weights. We then identified the top anticorrelated pairs of postsynaptic partners by selecting those for which the Spearman's correlation coefficient is below a certain threshold that was determined by evaluating, for each VPN, the value that optimizes the correlation between the dendritic map and the synaptic connectivity correlation. For each one of these top pairs, we estimated the perpendicular to the line connecting the corresponding weighted median centroids. These lines were combined using the median operator to reduce the influence of potential outliers. This resulted in a single line identifying the optimal unbiased separator of the most anticorrelated pairs (median separation line in Fig. 4e,g). The distance between their projections onto the line perpendicular to the optimal separator (projection line in Fig. 4e,g) was used as a final metric to generate the matrix and calculated for each pair of postsynaptic partners (Extended Data Fig. 9g,h). The projection line for LC4 was almost parallel to the A-P axis of the lobula (Fig. 4e), and slightly deviated from that for LPLC2 owing to the dual nature of synaptic gradients in this cell type (both A-P and D-V).

Spatial distribution of postsynaptic sites in optic glomeruli.
A similar approach based on the estimation of an unbiased separator was used to evaluate the correlation between the centroids of postsynaptic sites for postsynaptic partners of VPNs. To estimate this separator, we started by isolating all postsynaptic sites within the glomerulus using a cut-plane. We then selected the top anticorrelated pairs of postsynaptic partners, in a manner similar to how we analysed the dendritic map centroids. For each pair, we split the postsynaptic sites into two different classes depending on the postsynaptic partner they belonged to and used a support vector machine with a linear kernel to evaluate the optimal separating plane. We then computed the median of these planes. This resulted in a single plane identifying the unbiased optimal separator of the most anticorrelated pairs (median separation plane in Fig. 6b,j). We then projected the postsynaptic sites of each postsynaptic partner onto the line perpendicular to the optimal separator and calculated the distance between the median of the respective projections. The distance matrices for a given VPN cell type were obtained by calculating the pairwise distances between each of the 300 pairs of postsynaptic partners of LC4 and LPLC2 (Extended Data Fig. 9i,j). For selected pairs of postsynaptic neurons, the distributions of postsynaptic sites projections were compared using the two-sample Kolmogorov-Smirnov test (Fig. 6b,j).

Assessment of topographic mapping in VPN optic glomeruli.
Skeletons of individual neurons within each VPN cell type were selected manually on the basis of A-P and D-V topographic location of their dendrites and/or the pattern of k-means clustering of the dendritic maps (15 cells per topographic domain, unless stated otherwise in the figure legends). Groups of neurons with dendrites in different topographic domains were differentially coloured. Axonal processes of the corresponding neurons were traced in the optic glomerulus and visually examined for traces of spatially ordered organization. LC10 neurons were excluded from the analysis owing to previously reported A-P axonal topography 6,13 . LC6 neurons were excluded owing to previous extensive analysis 25 indicating the presence of coarse glomerular retinotopy inaccessible through visual examination.

Statistical analysis
All statistical analyses were carried out in RStudio 1.4.1103, MATLAB or Prism 9.2.0 software (GraphPad). NS: P > 0.05, *P < 0.05, **P < 0.01, ***P < 0.001 and ****P < 0.0001 for all figures where applicable.  6 and Extended Data Fig. 11), the solid line depicts the median; the upper and lower bounds of the box depict the third and first quantiles of the data spread, respectively. Whiskers indicate minimum and maximum values. All other statistical tests, number of replicates, statistical significance levels and other elements of statistical analysis are reported in the corresponding section of the Methods, along with the associated results and/or in the corresponding figure legends. No data were excluded from the analysis except as noted for the behaviour experiments (see the section in the Methods entitled Behavioural data analysis). All measurements were taken from distinct samples.

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

Data availability
The datasets generated during the current study are available as downloadable files at https://data.mendeley.com/datasets/pnbmx825wv, https://data.mendeley.com/datasets/84kh3ncbf8 and https://data. mendeley.com/datasets/th99hk824v. These include confocal image stacks related to Figs. 4-6. Other datasets generated and/or analysed during the current study are available from the corresponding authors on reasonable request. For further information regarding any resources and reagents, contact G.M.C. (gwyneth.card@columbia.edu) or S.L.Z. (lzipursky@mednet.ucla.edu). Source data are provided with this paper.

Code availability
R scripts for hemibrain connectome reconstruction analysis are available at https://github.com/avaccari/DrosophilaVPNWiring. Code associated with APT v0.3.4 (developed by the Branson Lab at Janelia) is available at https://zenodo.org/record/6366082. All reconstructed neurons from the FAFB dataset will be made available at https://fafb. catmaid.virtualflybrain.org/. All code to carry out the analysis and generate the figures on the FAFB data will be available at https://github. com/artxz/LC4_code.

Article
Extended Data Fig. 1 | Control of fly takeoff direction. a, When shown a looming stimulus from the front (azimuth 0°), side (azimuth 90°), or back (azimuth 180°), flies respond by moving their center of mass (COM) away from the stimulus. Black disc represents stimulus location and color indicates time from stimulus onset. Flies used for a-d were a control genotype for other experiments, Empty>Kir2.1. One trial per fly. b, Some flies also takeoff in response to looming, and those that do takeoff in a direction away from the stimulus (with some influence of the heading of the fly 33 ). Shown are polar takeoff direction histograms with 12° bin width and mean resultant vector overlaid (red line). p, Hodges-Ajne test for angular uniformity. c, Takeoff direction results from the fly shifting its COM relative to the axes formed by a line connecting the ground contact points of its two middle jumping legs and a perpendicular bisector. Black points indicate COM at stimulus onset and red points indicate COM just prior to takeoff. d, The specific direction in which the COM moves in body coordinates depends on its starting location. Vector position is the COM position at stimulus onset. The vector itself indicates the shift of COM position from stimulus onset to just prior to takeoff. Black vectors are tracked data, gray vectors are interpolated. Black square is approximated point of convergence. e, Percent of flies (individual DN driver lines) that performed a takeoff in response to CsChrimson optogenetic activation in the FlyPEZ assay. Error bars, Wilson score interval; *p < 0.05, **p < 0.01, ***p < 0.001, ****p < 0.0001 vs control (Empty, empty brain split-Gal4 control; DL -wild type control); normal approximation to binomial, two-sided Z-test, Bonferroni correction post hoc test. f, Same data as in (e) but with driver lines grouped by cell type. Error bars, SD. g, Histograms displaying the distribution of escape sequence durations between the wing raising and takeoff jump sub-behaviors (for LC4-DN driver lines expressing CsChrimson that can elicit escape upon activation). Escape trials are combined from split-Gal4 lines for each LC4-DN type. Short-mode escape duration (0 to 7 ms, gray shaded region) and longmode escape duration (>7 ms), as previously established. h, Percentage of short-mode activated escapes. Error bars, Wilson score interval; ****p < 0.0001 versus GF; normal approximation to binomial, two-sided Z-test, Bonferroni correction post hoc test. Detailed description of statistical tests used and p-values for panels "e" and "h" is available in Supplementary Table 1.    Fig. 3a and Extended Data Fig. 4b. Detailed description of statistical tests and p-values for panels "f, h" is available in Supplementary Table 1. Fig. 5 | EM reconstruction of LC4 neurons and estimated receptive fields. a, Tracing of all 55 LC4 neurons on one side of the brain in FAFB EM volume. Two example neurons are colored in red and blue (same in "b"). LC4 neurons have dendrites in lobula layers 2 and 4. LC4 cell bodies are marked with grey circles. Two Tm5 neurons are chosen to determine the center and central meridian of the eye in "b". b, Two-dimensional projection of the lobula layer. Traced LC4 dendrites (grey) are projected onto a surface fit through all dendrites (orange). Blue circles denote centers of mass of individual LC4 dendrites. Vertical line is the estimated central meridian that divides the eye between anterior and posterior halves. c, Pseudo-stimuli mimicking looming stimuli used in in vivo whole-cell recordings to simulate LC4DN responses based on LC4 connectivity. d, Confined DN RFs to the region of pseudo-stimuli in the eye coordinate imitating the looming stimuli. LC4 RFs based on connectivity to each DN are scaled by the proportion of overlapping with each stimulus region prior to sum up all the LC4 RFs. e, Estimated anatomical receptive fields (RFs) of the GF and DNp04 in the eye coordinates. f, Left: Estimated connectivity-based DN responses to pseudo-stimuli (solid) and measured responses to the corresponding looming stimuli (dashed) from in vivo whole-cell recordings. Right: Estimated responses in DNp04 and GF extrapolated using the connectivity model to looming pseudo-stimuli that cover the visual hemifield. Fig. 6 | Differential synaptic connectivity in VPNs manifests as synaptic gradients reflecting visual space map. a, Representative elbow plots from k-means clustering of individual cells within each VPN cell type (based on the number of synapses they make with postsynaptic partners). A drop in the within cluster sum of squared distance was used to determine the number of k in Fig. 4a, b (see Methods for details). b, Representative example of differential synaptic connectivity metric (median coefficient of variation) for LC4. Left: coefficient of variation in synapse number between individual neurons within LC4 population and top 25 postsynaptic partners of LC4 (ordered by decreasing variation). Right: summary (median CV, shown in red) metric for all postsynaptic partners of LC4 making >50 synapses total. topography for LPLC4 and LPLC1, n = 5 for LC9, n = 6 for LC22). e, Traces of DV axonal retinotopy in LC16 -a single example found across 20 VPN cell types. f, Representative examples of VPNs without topographic mapping of axon terminals in optic glomeruli (EM reconstructions), despite elaborating synaptic gradients reflecting visual space map (see Fig. 4h and Extended Data Fig. 7). g-j, Differential axon terminal morphology and glomerular targeting between individual LC4 (g, h) and LC22 neurons (i, j) innervating anterior and posterior regions of the lobula (N = 9 pairs of A-P individual clones from different brains with reproducible axon terminal topography for LC4, n =64 for LC22, correspond to examples from Fig. 5). Characteristic branching patterns are consistent between light microscopy and EM-based connectome reconstruction. A, anterior; P, posterior; D, dorsal; V, ventral; L, lateral; M, medial. Fig. 9 | EM-based analysis of synaptic connectivity patterns in LC4 and LPLC2. a-d, Analysis of the spatial distribution of dendritic centroids in the lobula for LC4. Centers of mass (centroids) of dendrites for individual 71 LC4 neurons (red dots) were established based on coordinates of end branching points (green dots) located laterally from the separation cut-plane (grey) to exclude the branching points in the glomerulus. Branching points and centroids were projected onto the plane (yellow and blue dots, respectively). Shown for the entire LC4 population and two representative neurons from posterior (a-b) and lateral (c-d) views. Similar analysis was also done for LPLC2. D, dorsal; M, medial; A, anterior. e-f, Relationship between synaptic input specificity and spatial dendritic map (measured by positions of weighted dendritic centroids) for 300 pairs of top 25 postsynaptic partners of LC4 (e) and LPLC2 (f). r s , Spearman's rank correlation coefficient. Error bands, SEM. Strong correlation indicates that LC4 and LPLC2 neurons with neighboring dendrites have similar synaptic specificity in the glomerulus. g-h, Matrices of pairwise distances between weighted centroids of inputs for 300 pairs of the top 25 postsynaptic partners of LC4 (g) and LPLC2 (h). The order of postsynaptic neurons is preserved from Fig. 4d and f. i-j, Matrices of pairwise distances between centroids of postsynaptic sites of the top 25 postsynaptic partners of LC4 (i) and LPLC2 ( j). The order of postsynaptic neurons is preserved from Fig. 4d and f.