Like many other animals, insects have developed the ability to efficiently navigate the most complex environments. Over several decades, evidence has accumulated showing that different insect species combine a multitude of visual stimuli in order to take fast and reliable navigational decisions (reviewed in:1). Amongst these cues, the celestial polarization pattern serves as a robust visual stimulus informing the heading choices of many navigating insects1,2,3. Since Karl von Frisch first described the ability of honeybees to orient their waggle dances using merely a small patch of sky that did not include the sun as a landmark, many insects have also been shown to integrate the directional information provided by the skylight polarization pattern into their repertoire of visual cues4. Importantly, this ability is not restricted to central-place foragers like bees or desert ants that rely on visual cues to find their way back to their hive or nest5,6. For example, both diurnal and nocturnal ball-rolling dung beetles have been shown to use the celestial polarization pattern to set a straight path away from the food source where both predators and competitors may aggregate7,8. In this case, dung beetles show the tendency to maintain the same heading over repeated trials6. The tendency of other walking insects to set and maintain heading choices under a linearly polarized stimulus remains less well characterized. Although spontaneous behavioral responses to rotating polarization filters (polarotaxis) were demonstrated for crickets and flies when walking on air-suspended balls under laboratory settings9,10,11, clear characterizations of angular heading choices are missing for these experiments. Similarly, behavioral data for flying insects (other than honeybees), especially when using virtual flight arenas remains relatively scarce1,2. Oriented flights of suspended monarch butterflies under a polarized stimulus have been demonstrated, yet its ethological significance remains somewhat controversial, due to conflicting reports12,13,14. Probably the most valuable recent progress comes from the fly Drosophila melanogaster: spontaneous responses of flying Drosophila to linearly polarized light using virtual flight arenas have been demonstrated, both under the natural sky, as well as using an artificial stimulus generated in the laboratory using commercially available polarization filters15,16,17,18 (reviewed in19). Most importantly, flies were shown to choose arbitrary angular headings with respect to the orientation of the e-vector of the polarized stimulus and showed the tendency to maintain this navigational decision over several minutes, even when the stimulus presentation was perturbed for several minutes18. Nevertheless, fairly little is known about the navigational capabilities of free-living fruit flies (reviewed in20). Catch-and-release experiments from a fixed point in the desert suggested that Drosophila (melanogaster and pseudoobscura) disperse into all directions equally and are able to keep straight headings over extended periods of time, while flying in environments which provide few visual landmarks21,22. For a better quantitative understanding of the mechanisms underlying such processes, skylight navigation experiments using virtual flight arenas therefore serve as an attractive platform for the study of the navigation skills of wild type insects, thereby providing the platform for testing transgenic specimens harboring well-defined circuit perturbations23,24.

The retinal basis of celestial polarization vision across insects is well understood: in virtually all cases, specialized ommatidia located in the ‘dorsal rim area’ (DRA) of the adult eye are morphologically and molecularly specialized for this task25. In flies, DRA inner photoreceptors R7 and R8 express the same UV Rhodopsin Rh3 which is localized within untwisted light-sensing rhabdomeres, resulting in high polarization sensitivity23,26,27,28,29,30,31,32,33. Since rhabdomeres of DRA R7 and R8 of a given ommatidium are oriented orthogonally to each other, these two cells form an opponent analyzer pair23,31. Like in other insects, analyzer directions of DRA ommatidia change gradually along the DRA, forming a ‘fan-shaped array’ of polarization detectors34. Due to the monochromatic Rhodopsin expression in DRA R7 and R8, navigational decisions of Drosophila in response to linearly polarized light should be limited to the UV range of the spectrum23,25, whereas light of longer wavelengths should not elicit orientation responses to this stimulus. Interestingly, different insect species express blue-sensitive Rhodopsins in their polarization-sensitive DRA photoreceptors (crickets, locusts)35,36, and in some cases green-sensitive Rhodopsins were reported (cock chafers)37. Although these different Rhodopsin choices seem to reflect adaptations to different ecological niches, the exact ethological reason for these differences remain incompletely understood38,39. Increasing evidence also points towards many insects (including flies) being capable to detect linearly polarized light through a DRA-independent channel (reviewed in40). Experiments from Drosophila have shown that these polarotactic behaviors are not UV-specific, since behavioral responses can be elicited using polarized green light presented to the ventral half of the retina16,23. Although incompletely understood, these behaviors could be indicative of a so-far poorly understood system in which retinal detectors are used to detect linearly polarized reflections. Such reflections could be used by insects to seek out or avoid water surfaces, evaluate oviposition sites, or even detect prey2,40.

We use virtual flight arenas to test heading decisions of individual flies flying under ‘open-loop’ conditions under a slowly rotating polarization filter. In agreement with previous studies, we find that flies initially choose a heading with respect to the orientation of the incident polarized light that varies between individuals and shows no preference for certain headings over the entire population tested (arbitrary headings). In this configuration, the rotation of the polarization filter therefore forces the fly to constantly adjust its heading in order to hold its original heading decision constant. By quantifying the fly’s ability to adjust its heading relative to the changing e-vector over time we show that the behavioral performance varies greatly within a population, yet a similar behavior is never observed under unpolarized UV light, or linearly polarized green light. Importantly, flies show the tendency to maintain this heading over several minutes: we show that flies that perform well in following the e-vector within a 5-minute experiment show a high tendency to choose a similar heading in a second experiment, even when interrupted by a 5-minute interval of unpolarized light. These experiments underscore the usefulness of the experimental setups presented here and serve as an ‘open source’ platform for the development of new assays optimized for different visual behaviors, in flies as well as other species of flying insects.


The aim of this study was a quantitative analysis of heading choices recorded from single flies flying under a slowly rotating polarization filter. We reasoned that flies that commit to a specific heading angle with respect to the incident angle of polarization would show a tendency to hold this angle constant and therefore correct for the slow rotational drift of the stimulus.

Virtual flight arenas for testing the heading choices of tethered flies under a rotating polarized stimulus

In order to quantify the heading choices of flies (glued to a metal pin) under a constantly rotating e-vector of linearly polarized light presented dorsally, we used custom built virtual flight arenas assembled from 3D printed and off-the-shelf hardware (Fig. 1a, Supplemental Figs S1 and S2). Similar to what was previously described41, the magnetic field created by two magnets kept the steel pins (and therefore the flies) vertical and in the center of the dorsally presented stimulus (see below), while allowing individual flies to rotate around their yaw axis, thereby enabling them to freely choose their headings (for 3D-printing and detailed assembly instructions, see and On top of the setup, switchable LED light sources (UV or green) were attached to two vertical beams, equipped with a matching set of highly collimated optics (Mightex Inc, see methods), in order to minimize off axis illumination of the polarization filter. The polarization state of the dorsally presented stimulus could be altered by shining light through a switchable filter ‘sandwich’ consisting of diffuser paper and a linear polarizer with either the polarizer or the diffuser facing the fly, as previously demonstrated10,11,23. This allowed for switching between two experimental conditions in which the degree of polarization was either ~0% (unpolarized) and almost 100% linearly polarized while keeping light intensity between trials constant (Fig. 1b, Supplemental Fig. S2A,B). The filter sandwich was placed inside a removable filter cassette housed inside a 3D-printed filter wheel that could be rotated using an Arduino-controlled servo motor (Dynamixel MX-28T, see methods) via a 3D printed gear system, all of which was also attached to the vertical beams (Fig. 1a). The upper magnet holding the tethered fly in place was magnetically attached (via a second magnet) to a UV fused silica window mounted in the light path (Fig. 1a, Supplemental Figs S1 and S2). Similar to what had previously been reported41, a sapphire bearing for minimizing friction and to keep the steel pins in place, was placed on a small matte white disc (to avoid intensity artefacts) which was glued to the bottom side of the upper magnet. Due to this placement and size of the upper magnet (for holding the fly in place), the stimulus extended over a 17° wide concentric ring in the flies’ dorsal field of view (Fig. 1c, Supplemental Fig. S2C). Keeping this angle as small as possible was crucial in order to minimize transmission artifacts (i.e. intensity fluctuations) that can arise from the polarization filter, especially at larger viewing angles15. Additionally, the suspended fly was placed at the center of a matte, backlit cylinder that was 3D-printed from white material, in order to minimize polarized reflections from the walls surrounding the fly, as well as to shield it from additional visual cues (#10, in Fig. 1a, and Supplemental Fig. S2C). The flies were illuminated with near-infrared LED’s and filmed from below with 60hz (Firefly MV, Point Grey) through a pinhole placed on top of the camera in order to avoid reflections off its lens. Using the camera footage, the flies’ body axis angles were extracted over time using custom made image processing code so that their heading choices in response to the rotating e-vector could be quantified (Fig. 1d).

Figure 1
figure 1

Modular assay for studying skylight navigation in individual flying flies. (a) Schematic drawing of a fully assembled virtual flight arena for the quantitative study of skylight navigation in flying Drosophila. Commercially available parts include: (1) a 30 cm × 30 cm double density optical breadboard (Thorlabs); (2) compatible metal beams (Thorlabs); (3) swappable, magnetically attached high-power LED light sources with collimated optics (Mightex); (4) a robotics-grade servo motor for rotating the polarization filter (Dynamixel MX-28T, Robotis), positioned behind the light path (when viewed from the front); (5) an infrared camera shielded from the fly’s view, filming its body axis (Firefly MV, Point Grey). Custom-designed 3D-printed parts (see supplemental materials for printing instructions) include: (6) attachment to the vertical bars; (7) filter holder including gear system (see and for details); (8) horizontal platform holding the UV fused silica plate and top magnet for attaching the magnetotethered fly; (9) infrared illumination (enclosed LED’s) and bottom plate with ring magnet, mounted onto the infrared camera; (10) backlit cylinder for reducing linearly polarized reflection artifacts, which can be lifted all the way to the horizontal platform, when flies are tethered. (b) Two polarization filter / diffuser orientations can be chosen within the filter holder: Unpolarized (diffused; left), or polarized (right). See Fig. 3b for polarimetric characterization. (c) Drawing of the fly’s field of view inside the apparatus. α = 17°. (d) Camera image for the extraction of the fly’s body axis (shown in blue).

Flying Drosophila follow a slowly rotating e-vector at an arbitrary angular distance

In order to achieve a more precise quantitative measure for the quality of polarotactic responses over more extended time intervals, as opposed to rapid changes in e-vector orientation17 (see, we introduced a new stimulus: flies flying within the virtual flight arena were presented a linearly polarized stimulus rotating slowly with constant angular velocity (~6°/s). Given that our test subjects were flying, this speed was chosen ~3x faster than what was previously published for walking crickets and houseflies9,10,11. In these experiments the 5-minute recording session per trial was split up into 30 × 10 s windows. For each of these 30 windows the mean angular velocity of each fly was then calculated. If the difference between this angular velocity and the filter’s angular velocity was smaller than 3°/s, the particular time window was categorized as polarotactic behavior (i.e. above threshold; areas shaded blue). For each of these periods the fly’s chosen heading was then calculated as the mean angular difference between the fly’s body axis and the incident e-vector (blue bar plots: above threshold; grey bar plots: below threshold). A representative fly (Fig. 2a) flying under a constantly rotating e-vector adjusted its heading in about one third of the recorded 10 s time windows (10/30). The number and length of observed interruptions without polarotaxis varied from fly to fly, resulting in a wide spread of behavioral performance quality (as defined by number of polarotactic 10 sec time windows) when integrating over the entire 5 minutes tested. Importantly, the calculated preferred heading of a given fly falls within a narrow angular range when compared across polarotactic periods (Fly in Fig. 2a: mean heading 63.2°, SD = 12°), despite interspersed periods of non-polarotactic behavior (during which the ‘preferred orientation’ varies greatly). This indicates that flies attempt to keep a preferred heading with respect to the celestial e-vector pattern over short periods of time. As expected, virtually no polarotactic periods were detected when the same fly flew under unpolarized UV light (UVunpol), but otherwise unchanged conditions (Fig. 2b). Similarly, when the fly was flying under linearly polarized green light (PolGreen), virtually no polarotaxis was detected (Fig. 2c). However, upon presenting the fly re-polarized UV light again (PolUV2), polarotactic time periods were restored, in some cases even more pronounced than in the first UV trial (Fig. 2d). Pooled data from all tested flies flying under a constantly rotating filter under different lighting conditions (PolUV1, UVunpol, PolGreen, PolUV2) reveals that polarotaxis occurs exclusively when using a linearly polarized UV stimulus (Fig. 3a). Flies flying under a slowly rotating linearly polarized UV stimulus spent significantly more time following the e-vector, compared to flying under unpolarized UV or polarized green light, respectively. Interestingly, flies that underwent a second flight under re-polarized UV light spent even more time following the e-vector. Finally, analysis of behavioral responses of female and male flies reveal no significant differences between genders in the first as well as in a second trial under polarized UV light (PolUV1 and PolUV2).

Figure 2
figure 2

Flying Drosophila follow a slowly rotating e-vector at an arbitrary angle. (a) Top: Flight heading (blue line) of a single fly orienting to a slowly rotating linearly polarized UV stimulus (PolUV1; orange line). 10 s intervals with above threshold polarotactic behavior (see methods) are shaded blue. Bottom: plot of above threshold intervals and circular plot of heading chosen by the animal (blue: above threshold; grey: below threshold). (b) Same analysis as above, using an unpolarized UV stimulus (UVunpol); same fly. (c) Same analysis as above, using a polarized green stimulus (PolGreen); same fly. (d) Same analysis as above, using a re-polarized UV stimulus (PolUV2); same fly.

Figure 3
figure 3

Variation of heading choices across individuals tested. (a) Summary plot of % time spent following the slowly rotating e-vector, comparing the four conditions from above. Bonferroni-corrected two-tailed Mann-Whitney U test, *p < 0.05, **p < 0.01, ***p < 0.001. N (left to right) = 66, 22, 38, 43. (b) Direct comparison of male versus female polarotaxis from PolUV1 and PolUV2 experiments reveals no significant difference. Two-tailed Mann-Whitney U test. N (left to right) = f (30), m (36), f (19), m (24).

Chosen headings are arbitrary, while behavioral performance varies between flies

By comparing the behavior across many individuals (N = 66) we investigated the spread of preferred headings when single flies were flying under a slowly rotating polarization filter. The goal was to investigate whether, in this particular kind of virtual flight arena, certain headings are naturally preferred or avoided, or whether the choice of preferred heading is arbitrary and therefore different between individual flies. The strategy is exemplified by the direct comparison of four representative traces of individual flies in response to a slowly rotating polarized UV stimulus (Fig. 4). Quality of behavioral performance (polarotaxis intervals) and preferred heading were quantified as described above. It appears that in these trials each fly choses a different preferred heading with respect to the incident angle of polarization (Fig. 4, circular plots). Taken together, the preferred heading angles of all tested flies during their first linearly polarized UV trial (PolUV1) were distributed over the whole angular range (Fig. 5a,b). Importantly, although the quality of behavioral performance (number of polarotaxis intervals, i.e. time spent following the rotating e-vector) varied greatly between individuals, it did not correlate with the angular heading choice of the animals (Fig. 5c). Hence, unlike previous studies on walking fly populations23, no tendency for a fixed preferred angular heading choice was found across flying individuals.

Figure 4
figure 4

Chosen headings are arbitrary and different between flies. Top: Flight heading (blue line) of four single flies orienting to a slowly rotating linearly polarized UV stimulus (PolUV1; orange line). 10 s intervals with above threshold polarotactic behavior (see methods) are shaded blue. Bottom: Plots of above threshold intervals over time and circular histograms of headings chosen by the animals (blue: above threshold; grey: below threshold).

Figure 5
figure 5

Variability and robustness of consecutive heading choices. (a) Summary of heading angles (angular difference to the polarization filter) chosen by 66 individual flies, under the PolUV1 stimulus. (b) Same data plotted on circular coordinates reveals a wide distribution. (c) Same data as in B where behavioral performance (%Pol = percentage of time following the e-vector) is represented in false color.

Arbitrarily chosen headings are maintained between trials

Finally, we tested whether the amount of time that the flies spent following the e-vector (number of polarotaxis intervals, i.e. quality of behavioral performance) within the first linearly polarized UV trial (PolUV1) correlates with the tendency of the flies to choose a similar preferred heading in a second consecutive trial (PolUV2) that was separated from the first by an interruption (5 min of UVunpol). We found that the better the flies’ performance within the first trial (more time spent following the e-vector in PolUV1), the higher the likelihood of them choosing a similar heading in the second trial (Fig. 6a). During both PolUV1 and PolUV2 intervals, the probability of tested flies for following the rotating e-vector increased during the 5 min trial (Fig. 6b). In contrast, the overall lower polarotactic values obtained in control conditions (UVunpol and PolGreen) showed no similar increase over time.

Figure 6
figure 6

Arbitrarily chosen headings are maintained between trials. (a) Plot depicting the angular difference between headings chosen in two consecutive trials interrupted by a period of unpolarized light (PolUV1 vs PolUV2) as a function of the quality of polarotaxis during the PolUV1 period (% of time spent following e-vector). (b) The change of polarotaxis probability over the 5 min experimental time window, plotted for all four experimental conditions (PolUV1, UVunpol, PolGreen, and PolUV2).


Navigating insects rely on the detection and integration of a wide variety of visual cues, like celestial bodies (sun, moon, milky way), intensity gradients, and chromatic gradients1. In addition, the celestial pattern of linearly polarized light serves as an attractive orientation cue that many insects use2,42,43. Spontaneous behavioral responses of both walking and flying Drosophila to linearly polarized light (‘polarotaxis’) have been demonstrated in the past, using both population assays, as well as single fly assays16,17,18,23,34,44,45. In all these experiments, much care was given to the control and avoidance of intensity artifacts that can result in behavioral decisions that are in fact independent of the linearly polarized component of the stimulus (reviewed in15). The virtual flight arenas used here have been designed with the dual goal of providing relatively cheap, robust setups that can easily be assembled, while at the same time minimizing intensity/reflection artifacts. The codes, templates and building instructions for the virtual flight arenas are freely available for download to anyone (for a detailed description, see and Due to their modular design, they can be modified for studying behavioral responses to moving stimuli46,47,48,49, shapes50, colors51, or celestial bodies24.

Using these new virtual flight arenas, we show that individual flies choose arbitrary headings under a linearly polarized stimulus, and when summed over all individuals tested, all chosen headings appear to spread randomly. This finding is in good agreement with recently published studies, although these were using a rather different kind of stimulation system18. In further agreement with these past studies, we also find that flies show a clear tendency to keep their chosen heading over several minutes, which indicates that any given fly attempts to maintain its chosen heading. Given the considerable gap in knowledge about the ethology of Drosophila, these data provide further support for a potential role of polarization vision in guiding long-range navigation behaviors that have been reported for flies20,21,22. In contrast, we show that single flies flying under a linearly polarized green stimulus displayed no comparable polarotaxis, which was to be expected due to the fact that orientation responses to polarized stimuli presented dorsally were shown to be mediated exclusively by the DRA23, whose polarization-sensitive R7 and R8 photoreceptors in the fly both express the UV-sensitive Rhodopsin Rh325,28,29,30. Nevertheless, behavioral responses to linearly polarized green light stimuli have also been reported in the past16,22, but only when presented ventrally (far beyond the retinal regions that were illuminated in this study) and the retinal detectors responsible are not well understood23,40.

Our experiments show that well-performing flies show a clear tendency to maintain their chosen heading, even when interrupted by a period of unpolarized stimulation. These data again provide independent support for previous studies18 and reinforce the idea that a generalist fly like Drosophila melanogaster is indeed capable of using skylight polarization for maintaining a chosen course over longer times, which is crucial for achieving more complex navigational tasks20,21,22. Like previous studies, we aimed at quantifying the quality of behavioral responses, since we expected that behavioral performance of individual flies to be greatly variable due to the strong influence of environmental conditions as well as internal states of the animal(s). For this study, we introduced a simple new stimulus, where flies are suspended under a slowly rotating polarization filter (~6°/s) under ‘open loop’ conditions. Quantifying the quality of a behavioral response by chopping any given 5-minute experiment into 30 × 10 sec polarotactic periods serves as an attractive new strategy for producing statistically significant data in a reasonable amount of time. Using this method, our experiments indeed revealed that behavioral performance is variable across all individuals tested. Even after tight control of food quality, rearing conditions, temperature, and humidity, the flies’ cooperation in these experiments remains unpredictable. Importantly, the distribution of polarotactic 10 s intervals across any given 5 min experiment did not reveal any obvious pattern, except the trend that probability of polarotaxis tended to improve over time (as summarized in Fig. 6). How much this variability could depend on the fly’s motivational state or navigational decision making remains to be investigated. Interestingly, even within a given 5 min recording, flies do not necessarily follow the rotating e-vector permanently, but may transition into and out of polarotactic periods (see Fig. 2a). This demonstrates the usefulness of this experimental setup for further studies on the dynamics and modulation of polarotactic behavior (and potentially underlying decision making processes), for instance in response to different internal states. Finally, our experiments reveal no significant differences in the behavioral performance of male versus female flies. This was to be expected since catch-and-release experiments did not reveal any sex differences in Drosophila’s tendency to disperse21,22. Furthermore, the size and structure of DRA ommatidia does not differ in a systematic way, between sexes. Although male-specific, Fruitless-expressing neurons have been characterized in the Drosophila brain, none of them appear to be clustered in the dorsal periphery of the visual system52,53.

Many insect species use the celestial polarization pattern in conjunction with other visual stimuli like celestial bodies, intensity gradients, chromatic gradients, and landmarks1. The hierarchy in which these stimuli are combined might differ between species as well as depending on context. One recent study reported that single Drosophila flying in a virtual flight arena are also able to use an artificially generated celestial body (the sun) as a reference to choose a heading (menotaxis)24, a behavior that requires ‘compass neurons’ in a central brain region known as the central complex54. This function is therefore in good agreement with physiological properties described for these neurons in locusts55. Classic data from larger insects5, as well as more recent studies from Drosophila56 are beginning to elucidate the neural circuitry of the ‘compass pathway’, along which menotactic and polarotactic information are being integrated by the insect brain, resulting in time-compensated compass information in the central complex5,57. Despite important similarities, it remains unclear whether flies use their anatomical compass pathway for performing exactly the same computations for skylight navigation24,56,58,59,60,61,62. The experiments presented here therefore serve as an important new platform for the efficient combination of Drosophila molecular genetic tools for the cell-type specific manipulation of neuronal function with quantitative behavior assays for testing skylight navigation.


Fly rearing

Wild type Oregon R flies (isogenized) were reared at 25 °C and 60% relative humidity on standard cornmeal agarose food under a 12h-light/12h-dark cycle. Care was taken to keep population densities low within fly vials by flipping flies on a daily basis.

Fly preparation

Experiments were performed at 25 °C and 50% relative humidity during the flies’ evening activity peaks up until one hour after the light period within the respective rearing incubators would have ended. Flies were glued to 10 mm long, 100 µm diameter steel pins (ENTO SPHINX s.r.o., Czech Republic), so that when positioned vertically, they held the flies at a natural flying angle (about 60° from horizontal) and were allowed to recover for at least 20 minutes from the gluing procedure before being tested. To prevent the flies from flying during the recovery phase, small pieces of Kimwipes were transferred to their tarsi. Initial flight behavior was triggered by inducing a little air puff towards the fly from below. This was also quickly done when flies stopped flying during the experiments, but not more than 3 times per experiment without excluding those flies from data analysis.

Flight simulator setup

Virtual flight arenas

Detailed building instructions of the virtual flight arenas used in this study including 3D printing and step-by-step assembly instructions and the codes necessary for their operation are freely available ( and Furthermore, the experimental setup, including stimulus properties (normalized intensities of the LED light sources and polarimetric characterization of the stimuli used) are described in greater detail in Supplemental Figures S1 and S2.

Stimulus delivery

Above the fly a switchable cassette holding a 50 mm × 50 mm sheet linear polarizer (OUV5050, Knight Optical, UK) and 13 layers of thin, non-fluorescent diffuser paper (80 g/sqm, Max Bringman KG) was inserted into a motorized rotatable cassette holder. Light from a collimated UV or green LED (365 nm: LCS-0365-13-B, 530 nm: LCS-0530-15-B, Mightex) coming from above and passing through the filter cassette was polarized (pol filter at bottom) or depolarized (diffuser paper at bottom) depending on the orientation of the filter cassette and presented to the dorsal part of the flies’ eyes. Using a spectrometer (Flame, Ocean Optics) the intensity of the two LEDs was set approximately isoquantaly at 2 × 1012 photons/s/cm2. By rotating the cassette holder, it was possible to precisely control the angle of the polarized stimulus’ e-vector. The recording protocol consisted of rotating the E-vector with constant angular velocity (5.97 deg/s) for 5 minutes while synchronously recording the flies’ behavior.

Extraction of flight heading

The heading of each fly in each acquired video frame was extracted using a custom-written macro script for the open-source software Fiji63. In short, it binarizes each video and fits an ellipse around the fly’s body to extract its heading in a range from 0° to 180°, in accordance with the directional ambiguity of the presented e-vector. The Fiji tracking results were analyzed using MatLab. Circular statistics were used. In short, a fly’s heading changes were quantified as polarotactic behavior if the mean difference between the fly’s angular velocity and the e-vector’s angular velocity was smaller than 3°/s for a given 10 s time window. By calculating the fly’s heading relative to the e-vector during such polarotactic episodes it was possible to calculate a measure of the ‘preferred e-vector’ for each fly. The custom Fiji- and Matlab-scripts used in this study, as well as setup building instructions and documentation is freely available under