ABSTRACT
To survive, insects must effectively navigate odors plumes to their source. In natural plumes, turbulent winds break up smooth odor regions into disconnected patches, so navigators encounter brief bursts of odor interrupted by bouts of clean air. The timing of these encounters plays a critical role in navigation, determining the direction, rate, and magnitude of insects’ orientation and speed dynamics. Still, disambiguating the specific role of odor timing from other cues, such as spatial structure, is challenging due to natural correlations between plumes’ temporal and spatial features. Here, we use optogenetics to isolate temporal features of odor signals, examining how the frequency and duration of odor encounters shape the navigational decisions of freely-walking Drosophila. We find that fly angular velocity depends on signal frequency and intermittency – fraction of time signal can be detected – but not directly on durations. Rather than switching strategies when signal statistics change, flies smoothly transition between signal regimes, by combining an odor offset response with a frequency-dependent novelty-like response. In the latter, flies are more likely to turn in response to each odor hit only when the hits are sparse. Finally, the upwind bias of individual turns relies on a filtering scheme with two distinct timescales, allowing rapid and sustained responses in a variety of signal statistics. A quantitative model incorporating these ingredients recapitulates fly orientation dynamics across a wide range of environments.
INTRODUCTION
Olfactory navigation is an incredibly challenging task, owing to the complexity and variability of natural odor scenes. The distribution of odors in nature depends sensitively on the physical properties of the environment, such as airflow and proximity to surfaces and boundaries, creating a diversity of signals varying in their spatial and temporal statistics (Baker et al., 2018; Connor et al., 2018; Reddy et al., 2022). Animals such as insects must extract relevant odor information from these complex landscapes, and use it to inform rapid behavioral decisions to progress toward the odor source.
In diffusion-dominating odor environments such as near food-laden surfaces, animals can locate odor sources by sampling concentration gradients temporally (Gepner et al., 2015; Gomez-Marin et al., 2011; Hernandez-Nunez et al., 2015; Schulze et al., 2015) and spatially (Borst and Heisenberg, 1982; Gaudry et al., 2013). In stronger airflows, further away from boundaries, and above rough terrain such as rocks or trees, complex airflows break up smooth odor regions into discrete packets and filaments swept along by the wind (Cardé and Willis, 2008; Celani et al., 2014; Connor et al., 2018; Crimaldi and Koseff, 2001; Murlis et al., 1992; Murlis et al., 2000; Riffell et al., 2008; Yee et al., 1993). As a result, animals experience discrete encounters with odor packets separated by blanks (moments when odor concentration is below detection threshold). The durations of these encounters can span a wide range of timescales (Celani et al., 2014). Under such conditions, insects navigate by orienting upwind within the odor and moving crosswind or downwind when the odor is lost, in an attempt to regain the plume (Kennedy and Marsh, 1974). Similar behaviors (with some variations between species) are observed in laboratory experiments where walking and flying moths (Baker and Haynes, 1989; Baker and Vickers, 1997; Cardé and Willis, 2008; Haynes and Baker, 1989; Kanzaki et al., 1992; Kennedy and Marsh, 1974; Mafra-Neto and Cardé, 1994; Vickers and Baker, 1994) and fruit flies (Alvarez-Salvado et al., 2018; Budick and Dickinson, 2006; Demir et al., 2020; van Breugel and Dickinson, 2014) are made to navigate straight odor ribbons. We recently discovered that flies can also detect the direction of motion of odor signals, by resolving inter-antennal concentrations differences over time. Odor motion provides a directional cue complementary to the wind, and is especially useful in turbulent plume navigation (Kadakia et al., accepted). In sum, despite variations between species and locomotive regimes, the general picture of insect odor navigation is that the wind (along with recently-discovered odor motion) indicate the direction in which to reorient, while the timing of odor encounters indicate when to reorient.
Careful analyses of moth turning responses following odor encounters have implicated the frequency of odor encounters as a key driver of upwind progress (Kanzaki et al., 1992; Mafra-Neto and Cardé, 1994; Vickers and Baker, 1994). Frequency-driven turning is also observed in walking flies navigating complex odor plumes when odor encounters are brief (~100 ms) and frequent (Demir et al., 2020). Conversely, flies experiencing longer and sparser odor encounters progress upwind by integrating the odor concentration over time – thus responding to odor intermittency or duration (Alvarez-Salvado et al., 2018; Bell and Wilson, 2016; Steck et al., 2012), rather than encounter onset time or frequency. Thus, insects are clearly able to sense and process various temporal features of the odor signal during plume navigation; moreover, this broad and versatile sensing capability has been shown theoretically to enable efficient source localization across a diversity of plume structures (Boie et al., 2018; Jayaram et al., 2022; Rigolli et al., 2022). Still, how these multiple features are precisely weighted within a single navigation strategy, and whether the strategy itself modulates as signal statistics change, remains unclear.
In this study, we address these questions using an optogenetic assay developed in previous studies (Demir et al., 2020; Kadakia et al., accepted). We present spatially uniform but temporally-structured fictive odor stimuli to freely-walking blind Drosophila melanogaster in a steady laminar flow. In addition to decoupling odor signal from wind, the spatially uniform stimulus removes both the effect of behavioral feedback on the received odor signal, and any bilateral differences between antennae in timing or intensity from the odor encounters (Borst and Heisenberg, 1982; Gaudry et al., 2013; Kadakia et al., accepted). Thus, flies must navigate using the temporal features of the odor signals and the fixed wind direction alone.
Our main findings are the following. i) Fly angular velocity is controlled by the frequency and intermittency of odor encounters, but not their duration. ii) Flies demonstrated “novelty detection” in turn rate and turn speed: they responded more strongly to signal onset when the prior period without stimulus was longer than ~2 seconds. As in previous studies (Alvarez-Salvado et al., 2018) we also observed an “offset response” in turning behavior, which peaks both at the end of a long odor encounter or a block of many encounters at high frequency or high intermittency. Importantly these two features combine to smoothly transition the behavioral response of the flies between low and high frequency regimes. iii) The upwind bias of turns (likelihood to orient upwind when turning) was independently modulated by frequency and intermittency of the signal. This dependency resulted from a rapid increase in upwind bias at the onset of odor pulses, followed by a slower decay at the offset, and allowed for strong upwind responses across a wide range of temporally diverse odor environments. We incorporated these findings into a model combining novelty and offset responses together with a two-timescale integrator. This versatile but parsimonious model could recapitulate turn rate, turn speed, and upwind bias across the full spectrum of temporally diverse environments, thus unifying results from previous studies into one framework (Alvarez-Salvado et al., 2018; Demir et al., 2020; Jayaram et al., 2022).
RESULTS
An optogenetic setup to examine the olfactory response of free-walking flies to the temporal features of odor signals
To investigate how fly navigation decisions depend directly on the temporal features of odor signals, we created an optogenetic stimulus (henceforth referred to as a ‘fictive’ plume) that had only a temporal component yet drove clear navigational responses. Using the wind tunnel walking assay previously described (Demir et al., 2020) (Figure 1A), we presented a temporally variable but spatially uniform optogenetic odor stimulus (Figure 1B) to freely-walking blind flies that expressed Chrimson in their olfactory sensory neurons (OSNs) (w;+;Orco-GAL4, w;gmr-hid;UAS-20XChrimson), from here referred to as Orco>Chr mutants. The stimulus was presented in a 15s ON block, where the entire arena was illuminated with a uniform red light stimulus (same intensity as in (Kadakia et al., accepted)) and flashed regularly at a frequency of 2 Hz and duration of 0.05s (consistent with naturalistic complex plumes (Demir et al., 2020; Kadakia et al., accepted)), followed by a 15s OFF block with no stimulus. A steady unidirectional laminar wind was used as a directional cue for flies to follow. Wind speed was 150 mm/s, matching the wind speed in (Demir et al., 2020).
In our previous study – which used an identical behavioral setup and genotype – we showed that optogenetically-active flies navigated straight ribbons and complex plumes similarly to real odors (Kadakia et al., accepted). Moreover, light-driven ORN firing responses were well-maintained within their expected physiological range (Kadakia et al., accepted). Here, to further confirm that our optogenetic stimulus drove responses similar to wildtype flies encountering a real odor plume, we examined fly orientation during stimulus presentation. We compared to previous studies in which wildtype Canton-S (CS) flies navigated two real odors: ethyl acetate (EA) and smoke (Demir et al., 2020). Indeed, flies responding to the optogenetic stimulus showed qualitatively similar navigational trends as flies experiencing real odor plumes, directing their orientation upwind (i.e. towards the fictive odor source) to a very similar degree (Figure 1C).
To confirm that Orco>Chr mutants were orienting upwind due to the fictive plume stimuli and not some other confounding factor, such as ambient lighting in the experimental arena, we obtained the mean orientation of all trajectories during the ON block (3-12 s) for each environment (CS in EA, CS in smoke, Orco>Chr in fictive plume), along with the parental controls of the optogenetically active line (w;+;Orco-GAL4, w;gmr-hid;20XUAS-Chrimson). Orco>Chr mutant responses were additionally measured in the absence of all-trans-retinal (ATR). We compared the mean orientation in these environments to the mean of uniformly distributed headings (which due to the way we reflect orientations results in a mean of 90°-see Figure 1 caption) in both laminar and turbulent wind environments (Figure 1-Figure Supplement 1). During the ON block, both CS flies in EA or smoke and Orco>Chr mutants in the fictive plume oriented more upwind than crosswind (one-sample t-test, EA: 115.7°±1.4°, pval < 1e−6, Smoke: 130.6°±1.7°, pval < 1e−6 Orco>Chr: 119.9°±2.9°, pval < 1e−6) (Figure 1D). In comparison, the orientation of both the UAS-parental control line and the Orco>Chr mutant line without ATR did not differ from uniform orientation (UAS: 92.4°±3.5°, pval = 0.491, NO ATR: 92.2°±2.4°, pval = 0.343), (Figure 1D, grey, Figure Supplement 2). Interestingly, the GAL4-parental control line oriented more downwind than expected (79.1°±2.9°, pval = 0.0002), which we attributed to a mild influence of background visual stimuli, since this parent was not blind.
The similarity in gross behaviors between wildtype flies navigating real odors and optogenetically stimulated flies navigating fictive odors indicate that spatially uniform, dynamic optogenetic stimuli can drive upwind naturalistic plume navigation. This is consistent with previous results that used real odors (Alvarez-Salvado et al., 2018), though an added benefit here is that bilateral information is entirely removed by using full-field optogenetic flashes. Temporal signal variation alone is enough to drive persistent upwind navigation, emphasizing the importance of temporal stimuli features in the absence of spatially-variable concentrations or local gradients.
Upwind heading correlates with signal frequency and intermittency, but not duration
Next, we asked how frequency, duration and intermittency modulate upwind heading. We generated 45 fictive odor environments with pulse durations between 0.02s and 1s, and pulse frequency between 0.2 Hz and 5 Hz (Figure 1E). Intermittency – the fraction of time signal is present – is equal to frequency multiplied by duration (Jayaram et al., 2022), and varied between 0.004 and 0.875 (intermittency is bounded between 0 (signal is never present) and 1 (signal is always present)). Combinations that produced indeterminable encounters (i.e. intermittency ≥ 1) were excluded.
Average upwind heading exhibited common trends across environments (Figure 2A). At ON block onset, flies oriented toward the upwind direction (180°) when the odor was present, and went downwind at odor offset, similar to behavior in real odor plumes (see Figure 1). For low frequencies, where there was sufficient time between encounter onsets to distinguish individual encounter responses (i.e. 0.2Hz, 0.5Hz), flies oriented upwind at each encounter onset, maintained their upwind orientation for the duration of the encounter, then oriented downwind at the end of the encounter. Beyond 1Hz, individual encounter responses were largely indistinguishable, but we observed that flies drove their orientation upwind for the duration of the ON block, and turned downwind at ON block offset. For low frequencies, average upwind orientation increased with duration, but this effect tapered beyond ~1Hz. Meanwhile, for a given pulse duration, mean orientation increased with frequency up to around 3Hz, before decreasing at very high frequencies. This aligns with previous studies that have shown that olfactory receptor neurons can respond to high frequencies (Fox and Nagel, 2021).
To quantify how the frequency, duration, and intermittency of odor encounters influence upwind bias, we calculated the instantaneous angular velocity as a function of orientation at each time point during the ON block (Materials and Methods) (Figure 2B). Here, angular velocity was signed such that upwind turns were positive and downwind turns were negative. Average angular velocity was nearly zero when flies were oriented upwind or downwind, but became increasingly positive with signal frequency for those oriented crosswind, up to around 3 Hz. Similar trends were found with intermittency, but not duration (Figure 2, Figure Supplement 1A-1B). Since these trends were most apparent when flies were oriented crosswind (grey region in Figure 2B), we pooled the angular velocities over all instances in which flies were oriented within a 45° sector around the crosswind (90°) direction, and calculated correlations with signal frequency, duration, or intermittency (Figure 2C). We found a significant positive correlation between angular velocity and either frequency (Pearson’s correlation coefficient, R=0.59, p<0.001) or intermittency (R=0.55, p<0.001), but not duration (R=0.10, p=0.496). This result indicated that flies use odor frequency and intermittency to drive upwind motion, prompting us to examine behavioral models that respond to these particular signal features.
Turn dynamics exhibit novelty-response and offset-response
Fly orientation results from the cumulative effect of individual turns. To understand how temporal features of the odor signal drive turn dynamics, we first explored how the average angular speed (the magnitude of the angular velocity) was modulated during the signal block across environments (Figure 3A). For clarity, we focus on four example odor environments chosen from the 45 environments shown in Figure 2. We chose these 4 cases to illustrate the different signal and response regimes present in the full dataset (Figure 3 Figure Supplement 1).
In low frequency and intermittency environments (e.g. 0.2Hz, 1s), where responses to individual odor encounters could be clearly resolved, the angular speed was dynamic and peaked at each encounter onset (Figure 3A, Figure 3 Figure Supplement 1). For higher frequency environments >~1.5 Hz, angular speed peaked sharply only at the onset of the ON block, rather than at each individual encounter. It quickly dropped towards the pre-stimulus baseline and remained roughly steady for the remainder of the ON block. We first wondered whether this was because in higher frequency environments, flies had maintained their upwind orientation upon receiving new pulses and hence did not need to reorient upwind. However, we found that in higher frequency environments, even flies facing crosswind or downwind at the onset of later pulses did not show large changes in mean angular speed (Figure 3, Figure Supplement 2).This suggests a type of “novelty response”, where angular speed will spike at the onset of a new encounter provided the previous odor encounter was in the sufficiently distant past. In high intermittency environments e.g. 3 Hz, 0.25 s, we observed a second large, sharp peak in angular speed at the end of the ON block, which was also seen at the end of individual, long duration encounters (e.g. 0.2Hz, 1s) similar to previous observations (Alvarez-Salvado et al., 2018). These data suggest that turn dynamics exhibit novelty detection and offset-response, and that they are modulated by both odor frequency and intermittency. While odor offset responses have been seen and quantified before (Alvarez-Salvado et al., 2018), the “novelty response” following an unexpected odor encounter has not yet been characterized, though it is also observable in previous studies (see fig 1F, 2A in (Alvarez-Salvado et al., 2018)).
To unravel the decisions underlying these angular speed dynamics, we turned from population averages to individual trajectories. At the level of individual trajectories, changes in angular speed exhibited large, discrete jumps (Figure 3B), that occurred both during ON and OFF blocks across all odor environments. Angular speed also underwent small fluctuations that we posited to occur from the fly’s walking gait (DeAngelis et al., 2019) and measurement noise. Following previous work (Cruz et al., 2021; Dan et al., 2021; Demir et al., 2020), we attributed the large angular changes to turn events, i.e. intentional, large-scale reorientations that align the navigator’s heading to the direction of interest. We defined turn events by setting a threshold on angular speed. Events above threshold were called “turns”, those below threshold were called “fixations”. The threshold (25 deg/s) was chosen to remove small fluctuations that contribute little to the overall change in heading, but keep large angular changes that drive navigation behaviors. We also set a minimum turn duration of 0.18s to remove very short fluctuations in angular speed that were potentially artefacts of the tracking (Figure 3 - Figure Supplement 3 and Materials and Methods).
Having defined turn and fixation events, we examined how the rate, duration, and angular speed of these discrete events, which modulate total angular speed, are influenced by signal statistics. To obtain the turn rate, we note that >95 % of fixation events (times between turns) lasted less than 1.5 s (Figure 3, Figure Supplement 4A,4B), and within this range, the distribution of fixation events appeared approximately exponential (Figure 3, Figure Supplement 4C), suggesting that turn events obeyed a Poisson process. The slope of the distribution, i.e. the turn rate, changed with time (Figure 3C). It was high at the onset (4.92 ± 0.18 turns/s) and offset (4.18 ± 0.09 turns/s) of ON blocks, but lower (3.19 ± 0.02 turns/s) during OFF blocks. Turn durations also appeared exponentially distributed, but with a rate that varied less over time (Figure 3D). Finally, the mean turn speed exhibited a unimodal distribution that resembled a Gamma distribution with mean that strongly depended on the signal (Figure 3E): higher at the onset and offset of the ON block, and lower otherwise. Together, this suggested that angular speed dynamics depended more on changes in turn rate and turn speed than on temporal variations in turn duration.
To get a qualitative understanding of how turn rate and speed depend on the signal, we plotted them as a function of time (Figure 4A). We observed a similar novelty response and offset responses as we observed for angular speed (Figure 3A): turn rate and turn speed spiked at each pulse onset, however for the higher frequencies the responses were stronger at the onset of the ON block than for the subsequent odor encounters. At high intermittencies there was also an off-response at the offset of the ON block (Figure 4A grey, Figure 4 Figure Supplement 1, 2 grey). We conclude that turn dynamics are mainly controlled by signal-driven modulations of the turn rate and turn speed, which exhibit both a novelty-response and offset-response.
To model turn rate and turn speed at signal offset, we defined an intermittency-dependent offset response OFF(t) analogous to the OFF response reported by (Alvarez-Salvado et al., 2018), who used real odors to stimulate flies in a setup similar to ours. The OFF(t) function computes the difference between two integrative filters which decay at different timescales, one long and one short, producing a transient spike after long duration encounters or higher intermittency signals (Figure 4B) (Materials and Methods). This makes it a good candidate for modeling the observed offset behavior in turn rate and angular speed.
For the frequency-dependent novelty detection, we defined the function N(t) that would spike at pulse onsets and then decay until the next pulse onset. The height of a spike increases with the time since the last pulse onset (i.e. when a pulse has more “novelty” to it): where tL is the time of the latest pulse onset, and τd is the decay timescale of the response to individual odor pulse. A(t) controls the height of the response to each pulse. It is maximal (= 1) for the initial odor encounter but decays for successive encounters that occur within a novelty timescale τN (see Materials and Methods). Odor encounters that occur after a time τN are treated as novel signals and elicit maximal response again (Figure 4B).
Given these two response functions, OFF(t) and N(t), we attempted to capture the dynamics of both the turn rate and turn speed by simple linear combination. We modeled the turn rate λ(t) as and the mean turn speed μ(t) as where λi and μi for i = 0, 1, 2 are constant parameters. We note that turn duration was weakly modulated by the signal statistics (Figure 4, Figure Supplement 3), but the modulation was much smaller compared to modulations in turn rate and turn speed. Thus, for simplicity, we treated turn duration as exponentially-distributed with fixed parameters determined from data (Figure 3D). We first estimated the parameters for λ(t) using maximum likelihood estimation (see Materials and Methods), carrying out the estimation by pooling data from all 45 stimulus environments. This fixed λ0, λ1, and λ2, as well as the timescales involved in the N(t) and OFF(t) responses (Materials and Methods, Table 1). Then, holding the timescales fixed, we estimated the μ coefficients, again fitting to the data pooled from all 45 environments (Materials and Methods, Table 1). Our model captured both turn rate and turn magnitude well, albeit slightly underestimating both at lower frequencies (Figure 4A, pink, Figure 4 Figure Supplements 1,2 pink).
Up to this point, our model captures how the stimulus modulates the rate and magnitude of discrete turn events. These two aspects, along with turn duration, which we held fixed, should predict angular speed across environments with diverse signal frequency and intermittency. To test this, we simulated virtual agents enacting our dynamic model. Agents executed turns via an inhomogeneous Poisson process following Equation 2. The mean angular speed of each turn was sampled from a Gamma distribution with signal-dependent mean (Equation 3 and Materials and Methods). The turn duration was sampled from a fixed exponential distribution (Materials and Methods). In our dataset there are at most 240 fly trajectories at any given time. Therefore, we simulated 240 agents in each of the 45 environments to get a population-averaged trace, and then repeated this process 10,000 to get an estimate of the model-predicted mean and error. To quantify model accuracy, we calculated the ratio of the root-mean-square error of the model fit to the data standard deviation (NR score) across all environments (Geffen et al., 2009; Martelli et al., 2013). An NR score of <1 indicates a model prediction within the noise of the data. The NR score across all 45 environments was 0.16, indicating that the model recapitulates the dynamics of the fly angular speed well across experiments, albeit with some underestimation at the lowest frequencies (Figure 4C; predictions for all 45 environments are shown in Figure 6A below).
The model reproduces two important aspects of the turning dynamics and its dependency on signal frequency and intermittency: a varying turn rate at the onset and offset of longer odor encounters, and a roughly constant turn rate when the frequency of encounters is high (after the initial spike), both of which have been observed experimentally in separate paradigms investigating these distinct odor environments (Alvarez-Salvado et al., 2018; Demir et al., 2020).
Upwind bias responds to odor signal with two timescales: a fast rise time and a slow decay
Up until now, we are able to describe fly angular speed dynamics well, through a dynamic turn rate and turn speed. In order to describe fly orientation, we must also understand the direction of these turns, controlled by the upwind bias – the probability that a given turn is upwind (Demir et al., 2020). To illustrate how the upwind bias depends on signal, we plotted it in time (Materials and Methods), finding that in general it was dynamic and high during the ON block, but otherwise slightly below 0.5 (Figure 5A, grey, Figure 5 Figure Supplement 1 grey). Unlike the turn rate and turn speed, upwind bias also depended on fly orientation, and was largest for crosswind-facing flies (Figure 5B).
Following our previous work (Demir et al., 2020), we model upwind bias B(t) as a sigmoid (Figure 5C): where a0 represents a baseline bias (i.e. when no signal is present), and the sin2 θ term ensures that the bias is maximal at crosswind angles (Figure 5C). u(t) is the output of a signal processing model and g is a gain factor controlling how much the signal affects upwind bias. To best capture the upwind bias, we consider four simple signal processing models u(t) = I(t), F(t), H(t), R(t) hereafter called: intermittency sensing I(t), frequency sensing F(t), dual-frequency-intermittency sensing H(t) and two-timescale integrator R(t). The intermittency sensing model exponentially filters the binary signal S(t) with timescale τ: By construction, I(t) responds uniquely to signal intermittency (Jayaram et al., 2022). The frequency sensing model F(t) was proposed in (Demir et al., 2020). Here, the duration of the signal is ignored, and the signal is converted to a time-series w(t) of delta function spikes at the onset of each odor encounter. The onsets are exponentially filtered to produce the output, which is effectively a running estimate of odor encounter frequency: The third model examined was a dual frequency and intermittency sensing model H(t), outlined in (Jayaram et al., 2022). This model linearly combines I(t) and F(t), but the contributions of F(t) and I(t) are independently weighted: Here gI and gF are gain factors. In this case the gain g in Equation (4) is set to be 1 and the same timescale is assumed for I and F. Finally, in the two-timescale integrator model, the response R(t) adapted to the signal with one timescale τg when the signal turned on, but another timescale τd when the signal was lost. This is expressed mathematically as: when the signal is on and when no signal is present. This model always responds to signal intermittency, but also responds to frequency independently, up to frequencies of , provided τg ≪ τd (see Materials and Methods). Equations (4-9) define 4 alternative models for the upwind bias. Together with the turn dynamics model described in the previous section, this provides us with 4 alternative models to predict fly orientation dynamics.
To find out which of these 4 models best describes fly behavior, we fit all of them to data. To constrain a0 we took advantage of the fact that the upwind bias returns to baseline within a couple of seconds following the offset of the ON block (Figure 5A, grey, Figure 5 Figure Supplement 1 grey). Accordingly, we estimate a0 by using the last 10s of the OFF block (Figure 5D, black) to fit Equation (4) with u(t) = 0 (Figure 5A, purple). To estimate the remaining parameters we simulated stochastic agents. Turn initiation, speed and duration were simulated as explained above using the best fit parameter values extracted from the analysis in the previous section. Turn bias parameters were estimated using Equation (4) to generate a stochastic turn direction for each turn executed by the agents. For each environment, 240 sample trajectories were generated. We constrained the parameters by minimizing the mean squared error between the mean orientation of agents and flies (Materials and Methods).
We found that the two-timescale integrator model R(t) best fit the data across all environments (Figure 5D). For the intermittency sensing model (I(t), overall NR = 0.27, the optimal parameters τI = 0.04s, g = 12.6) predicted well the response for long encounters or lower frequencies, but underestimated responses at higher frequencies or lower durations, and overestimated the response at the highest intermittencies (Figure 5D, yellow). Conversely, the frequency sensing model (F(t), overall NR = 0.29; best fit parameters τF = 0.08s, g = 9.3) exhibited the opposite trend: satisfactory fits for frequencies > ~1.5 Hz, but clear underestimates for lower frequencies (Figure 5D, blue). This suggested that a simple sum of these models might resolve these individual failure modes. Indeed, the dual-frequency-intermittency model was more accurate overall (G(t), NR = 0.25), and with optimally fit gains gI = 2.7, gF = 3.2 and timescale τ1 = 0.1s, captured the mean and dynamics the orientation response across a range of odor environments (Figure 5D, green). Still, it underestimated the response at low frequencies < 1.5 Hz. The two-timescale integrator model, however, predicted the mean orientation responses across all panels better (R(t), NR = 0.20) than the than the dual-frequency-intermittency model. The optimally fit rise time for the response at signal onset was almost instantaneous (τg = 0.01s- - Materials and Methods for details about this value), whereas the decay timescale was much longer (τd = 1s). We also verified that the two-timescale integrator models with best-fit parameter values reproduces upwind bias in the data (Figure 5A, purple).
We conclude that models that combine frequency and intermittency sensing to determine upwind bias perform better than single-sensor models (Jayaram et al., 2022). However, a linear combination of the frequency and intermittency sensors is not sufficient. The data is better reproduced by sensor that responds to these features through integrating the odor signal over two different timescales.
A single model captures general trends in angular speed and orientation across a broad spectrum of temporally diverse fictive odor environments
To better examine the limits of our model, we now plot mean angular speed and orientation predictions on top of the data across all 45 environments. As mentioned above, angular speed is predicted well across most environments (Figure 6A NR=0.16) and the model captures the variation of the turning dynamics with respect to signal frequency and intermittency, recapitulating differences previously seen between experiments that explored different signal parameter regimes (Alvarez-Salvado et al., 2018; Demir et al., 2020).
The model also captures the general trend in orientation (Figure 6B NR=0.20), albeit less well than for angular speed. This is to be expected given the cumulative effect that errors in the prediction of angular speed and turning bias have on orientation. Maxima in mean fly orientation were underestimated at low frequencies, but overall general trends across all 45 panels were captured.
We conclude that flies navigate diverse temporal statistics by: 1) modulating their turn decisions and turn speed via a frequency-dependent novelty detector and an intermittency-dependent offset detector of odor signals; and 2) biasing the orientation of these turns using a response function that integrates the signal over two timescales, a very fast rise timescale (tens of ms) and a slow decay timescale (seconds).
DISCUSSION
It is well-known that animals from crabs (Keller and Weissburg, 2004) to moths (Vickers and Baker, 1994) and Drosophila (Sehdev et al., 2019b; van Breugel and Dickinson, 2014) use various temporal features of olfactory stimuli to modulate navigation. Previous studies in walking flies have shown that turns can be modulated by the frequency of odor encounters in complex plumes, and by encounter duration in low frequency environments (Alvarez-Salvado et al., 2018; Demir et al., 2020; Jayaram et al., 2022). Here we carefully examined the transition between these two regimes. To isolate temporal features from spatial information such as the spatial structure of odor encounters, local odor gradients, and turbulent wind structure, we used optogenetics. This allowed us to probe a broad range of odor frequency and durations.
A key finding of this study is that a model incorporating both a frequency-dependent novelty response (this study) and a previously observed intermittency-driven offset response (Alvarez-Salvado et al., 2018) can successfully describe the dynamics of turns across the spectrum of temporally diverse environments studied. This single model predicts that in environments with high odor intermittency, the turn rate is dynamic and spikes at the encounter offset, as seen in (Alvarez-Salvado et al., 2018), whereas in environments of high frequency odor encounters, the turn rate remains roughly constant, as seen in (Demir et al., 2020), after the initial response to the first encounter. Although the novelty response was not observed in (Demir et al., 2020), such a feature was likely highlighted in our current study due to all flies receiving identical odor stimuli simultaneously.
The novelty response reveals that after ~2s of no stimulus a fly is very likely to execute a large turn in response to a new odorant encounter, whereas more frequent encounters are not as likely to trigger such a deterministic response. In turbulent odor plumes, times between encounters (blank times) are power-law distributed and odor packets tend to arrive in clumps (Celani et al., 2014; Connor et al., 2018; Murlis et al., 2000). Thus, even within a plume a fly may not experience any odor packet for an extended period of time. It would be interesting to compare this novelty timescale with the distribution of blank times and clumps durations in natural plumes. Flying flies also experience very different signal statistics from walking flies, which begs the question of whether this novelty timescale is the same in flying flies. The observed spikes in turn rate and turn speed are also transient, decaying with a timescale of about 0.5 s. Probing the basis of this novelty response and how these observed timescales emerge from the neural circuitry could be a fruitful avenue for future study. It would also be insightful to investigate theoretically the optimality of varying turn rate and turn speed in such a way--whether modulation with this novelty response and offset response is optimal for navigation success across a range of temporally diverse environments.
In addition to the modulation of turn rate and turn speed, another important finding of this study is that the likelihood for a turn to be oriented upwind increases with a very fast timescale (fit to be roughly 10ms) at signal onset and decays with a slower timescale of roughly 1s. We show (Materials and Methods) that as a result, upwind bias increases independently with both signal frequency and intermittency, thus allowing for a sustained upwind bias across environments. The response to both frequency and intermittency is largely consistent with previous findings that intermittency dominates upwind motion in high-duration, low frequency environments whereas frequency dominates in low-duration, high frequency environments (Alvarez-Salvado et al., 2018; Demir et al., 2020; Jayaram et al., 2022).
The multiple timescale integration observed here in fly behavior is within the range of the fast and precise processing capabilities of the Drosophila olfactory circuit. Drosophila ORNs process signal as fast as 100 Hz (Schuckel et al., 2009). This information is preserved downstream where 2nd-order projection neurons (PNs) encode a broad range of signal frequencies via multiple post-synaptic currents (Nagel et al., 2015) (Fox and Nagel, 2021; Fulterer et al., 2018; Pooryasin et al., 2021). These features enable rapid behavioral responses (~50ms) (Bhandawat et al., 2010). A recurring theme in Drosophila temporal odor processing, both in behavior and circuitry, is the importance of two distinct timescales. At the first processing relay, ORNs synapse onto PNs with two kinetically distinct fast and slow postsynaptic currents which promote a wide range of frequency transmission (Nagel et al., 2015) and promote robust navigation of simulated flies across environments with diverse temporal statistics (Jayaram et al., 2022). Our model of fly turning exhibit similar fast and slow timescales: the turning bias increases rapidly ~10ms at odor onset but decays slowly ~1s at odor offset. Moreover, our analysis shows that, for a simple integrating response to increase independently with frequency and intermittency, it is necessary for the rise timescale to be faster than the decay timescale.
Drosophila OSNs adapt their activity to both the mean and variance of fluctuating odor stimuli (Gorur-Shandilya et al., 2017; Martelli et al., 2013; Martelli and Fiala, 2019; Nagel and Wilson, 2011), which aids preservation of both response dynamics (Martelli et al., 2013) and odor encounter timing in OSN spiking (Gorur-Shandilya et al., 2017; Kadakia and Emonet, 2019). Here we used optogenetics to drive behavior, thus bypassing the part of the ORN adaptation dynamics that takes place upstream of the firing machinery (Gorur-Shandilya et al., 2017; Nagel and Wilson, 2011). In a previous paper that used the exact same experimental setup and light intensity, we verified that the type of stimuli used here drives ORN responses within their physiological range and that fly behavior resembles that in real odor plumes (Kadakia et al., accepted). Since the odor encounters in this study neither fluctuated in intensity nor lasted longer than 1 second, it is perhaps unsurprising that we did not need to include ORN adaptive dynamics in our model. However, in experimental paradigms with longer light stimuli or varying intensity, adaptation could play an important role in navigational behavior.
Other aspects of olfactory navigation have not been considered in this study. As we wanted to focus solely on orientation dynamics, we did not factor changes in ground speed or transitions between stops and walk bouts into our predictive models, although these locomotory behaviors are known to be modulated by odor encounter timing and duration (Alvarez-Salvado et al., 2018; Demir et al., 2020). Further analyses with these data studying the effect of temporally varying stimuli on walking speed would be useful. We acknowledge that this paradigm creates a simplistic odor landscape in which other sensory inputs such as visual cues are removed, which when present can improve navigation success (Budick et al., 2007; Frye et al., 2003). Moreover, any information available to the fly from bilateral sensing was removed due to the spatially uniform signal. Doing so was important to isolate odor timing since insects respond to timing differences across antennae (Takasaki et al., 2012), use them to detect odor motion (Kadakia et al., accepted) and respond to bilateral concentration differences (Duistermars et al., 2009; Gaudry et al., 2013). Since our fictive odor signal activated all Orco-expressing ORNs (Tao et al., 2020), we did not examine the effect of odor identity or valence on turning dynamics (Jung et al., 2015; Tao et al., 2019). We additionally did not investigate any potential effects of flies learning the structure of the odor scene during navigation (Buehlmann et al., 2015; Pang et al., 2018), as well as potential collective behavior that could improve odor environment recognition (Sehdev et al., 2019a).
We have demonstrated that processing odor signals over multiple timescales allows for temporally driven navigational behaviors across diverse environments. Further extensions of this work include investigating the neural bases for these different timescales, as well as how temporal information from individual odor encounters, combined with the overall spatial structure of an odor scene can be exploited for successful navigation.
MATERIALS AND METHODS
Flies/Handling
All fly genotypes used were reared at 25°C and 60% humidity on a 12 hr/12 hr light-dark cycle in plastic vials containing 10 mL standard glucose-cornmeal medium (Archon Scientific, NC). All flies used in experiments were female, aged 3-10 days old.
To obtain our experimental genotype, we crossed w;gmr-hid;20X-UAS-CsChrimson (GMUCR) males with w;+;Orco-GAL4 (117) virgin females (F1: w; +/gmr-hid; Orco-GAL4/20X-UAS-CsChrimson). Adults were removed from vials after 3 days, and the F1 females were collected 1-3 days after eclosion. All F1 flies contained a copy of gmr-hid, making them blind, and expressed the channelrhodopsin Chrimson in their Orco-expressing olfactory receptors. 20-30 females were starved 72 hours prior to the experiment in empty plastic vials containing water-soaked cotton plugs at the bottom and top. 24 hours before the experiment, flies were fed 1 mM all trans-Retinal (ATR) (MilliporeSigma) dissolved in water. The vials were covered in foil for these last 24 hours to avoid ATR degradation. For control experiments without ATR (Figure 1D, Figure 1- Supplement 2), flies were instead given 1 mM deionized water.
Behavioral apparatus
The fly walking arena in this study is identical to that used in (Kadakia et al., accepted), based on (Demir et al., 2020). The arena was 270 mm x 170 mm x 10 mm (length x width x height). The top and bottom surfaces were made of glass, and walls were acrylic. A plastic mesh was placed downstream of the airflow to prevent flies from escaping, near to which flies were aspirated into the arena through a sealable hole. The arena was illuminated using 850 nm IR LED strips (Waveform Lighting) placed parallel to the sidewalls. Note that although the experimental line is blind, two of the control lines (Canton-S and GAL4 parent) are not blind, thus we additionally shone green light using an LED (Luxeon Rebel LED 530 nm) throughout the arena to flood the visual response to simplify comparisons. All other light sources were removed.
Dry air (Airgas) was passed into the arena through a stack of heavy duty plastic coffee stirrers (Mr. Coffee) to present laminarized wind with a flow rate at 150 mm/s. In all experiments, laminar wind was used. To present complex wind within the arena for wind control experiments (Figure 1- Supplement 1, Figure 2- Supplement 1), airflows perpendicular to the laminar flow either side of the laminar mesh were alternately turned on with 100 ms correlation time to perturb the wind structure.
Experiments were recorded at 60 frames per second with a camera (FLIR Grasshopper USB 3.0) with an IR-pass filter. Optogenetic stimuli were delivered using a projector (DLP LightCrafter 4500) mounted above the arena, with resolution 912 × 1140 pixels, which illuminated the entire walking arena with pixels of size 292 μm (along wind axis) x 292 μm (perpendicular to wind axis). Only the red LED (central wavelength 627 nm) was used throughout this study. All experiments used a 60 Hz stimulus update rate. The projector and camera were aligned by minimizing the least square difference between the two coordinate systems, as described in detail in (Kadakia et al., accepted).
Stimulus protocol
All stimuli were written using custom scripts in Python 3.6.5. All stimuli were delivered to the projector using the Python package PsychoPy, version 2020.2.4.post1.
During signal presentation, the entire arena was illuminated with a spatially uniform pulse of red light (“odor encounter”), presented at the maximum intensity (LED 255). We note that flies demonstrated similar albeit weaker responses to odor encounters with a lower intensity (data not shown). The odor encounter was presented regularly at a defined frequency (0.2 Hz, 0.5 Hz, 1.0 Hz, 1.5 Hz, 1.75 Hz, 2 Hz, 2.5 Hz, 3.0 Hz, 4.0 Hz, or 5.0 Hz) and a defined duration (0.02 s, 0.05 s, 0.1 s, 0.25 s, 0.5 s, or 1.0 s). Any combinations of frequency and duration that produced overlapping encounters with indistinguishable onsets and offsets were excluded from the environment sweep.
Within one experiment, the stimulus paradigm was repeated four times. Each repeat consisted of an “ON block” and an “OFF block”. Odor encounters were presented only during the ON block, which lasted for maximum 15 s. Note that the end of the ON block (i.e. the offset of the last odor encounter) is dependent on the combination of encounter frequency and duration used and thus could be as short as 10.02 s (0.2 Hz, 0.02 s). Any signal that ended after 15 s (i.e. 1.75 Hz 0.25 s, 1.75 Hz 0.5 s, 2.5 Hz, 0.25 s) was terminated at 15 s. The ON block was followed by a 15 s long OFF block, in which no odor was presented. Note that due to the variability in the end of the ON block means that the OFF block could last between 15 s and 19.98 s. Thus each repeat lasted for 30 s, and the entire experiment lasted 120 s. Laminar wind was presented continuously for the span of the experiment unless otherwise stated. Up to 10 experiments were presented to the same set of flies within one session, with a 60 s interval between experiments. The order of the experiments within a session were pseudo-randomized so that two consecutive experiments would not present same stimulus to avoid flies possibly learning from the environment.
Experimental protocol
Experiments were performed between 08:00 and 12:00 as Drosophila activity peaks during this time (van Breugel et al., 2018), in a temperature- and humidity-controlled environment (temperature: 22.2 °C ± 0.2 °C, humidity: 52.3 % ± 2.7 %). Female flies were aspirated into the arena and allowed to acclimatize to the new surroundings and the laminar wind flow for one minute. To ensure that the cross had been successful and that the F1 were healthy and correctly expressing Chrimson in their Orco-receptors, we presented flies with three parallel static red fictive odor ribbons for 1 minute in laminar airflow. Responsive flies, when encountering the ribbon, tend to turn upwind and weave along the edges of the ribbon towards the expected odor source (Demir et al., 2020). Sets of flies that did not show this behavior were discarded. For each combination of encounter frequency and duration investigated, between 6 and 12 videos/experiments were recorded/performed with between 11 and 27 individuals in one session.
Fly tracking/data acquisition
All tracking scripts were custom written by Nirag Kadakia in Python 3.7.4 and are described in detail in (Kadakia et al., accepted).
Briefly, fly centroids were determined using the SimpleBlobDetector function in OpenCV, and assigned to a trajectory identity by matching to other nearby centroids. Centroids that could not be connected to existing trajectories within 30 frames were excluded, and subsequent detected centroids were thus marked as a new trajectory. Orientation was obtained using the canny function in scikit-image to determine fly “edges”, defined between 0 and 360. Measurement noise was removed using a Savitsky-Golay filter (4th order polymonial, window size of 21 frames (0.3 s). The ground velocity in the individual x and y directions were defined by taking the analytical derivative of the fitted polynomials for x and y, and was used to resolve the head and rear of the fly (Kadakia et al., accepted). The angular velocity was determined in the same manner using the orientation. Any potential location bias in the arena due to physical constraints from the stimulus projection were removed by randomly selecting half of the trajectories from each odor environment and flipping the y coordinates and heading along the y axis (axis perpendicular to the airflow). Any trajectory where the fly’s mean speed across all the time it was tracked was less than 2mm/s was considered as a non-responsive individual and removed from all further analyses. For Figure 1 only (and its corresponding supplemental figures), individual time points where the fly moved less than 2mm/s were additionally removed to ensure equal treatment of data for comparison with data taken from (Demir et al., 2020).
Defining turns
To define a turn event, we sought to determine a threshold angular speed and minimum duration, above which the reorientation event would be classified as a turn. This method is robust against artificial detections of spurious events that may occur due to measurement fluctuations. However, arbitrarily setting the angular speed threshold too high will neglect large angular changes that likely drive changes in the overall heading. To determine a suitable minimum angular speed threshold for this dataset, we pooled trajectories across all 45 odor environments, and examined how changing the threshold angular speed for a turn event affected the distribution of the angular change for “fixation” events, i.e. the change in orientation for events where the angular speed was below threshold. We set the threshold at between 5 deg/s and 150 deg/s. For each of the 17 tested thresholds, we obtained the distribution of angular change magnitudes during fixation events, and extracted the 95th percentile to obtain a comparable measure representing the majority of angular changes made (Figure 3, Figure Supplement 3A).
A suitable threshold would have smaller angular changes during fixations, and larger changes during turns. We found that initially, as the threshold increased, smaller angular changes that are likely caused by trivial reorientations were classed as “fixations”, and thus would be disregarded as a turn event. Increasing the turn speed threshold beyond 25 deg/s led to much greater changes in orientation during fixation events, (Figure 3, Figure Supplement 3A) (see also Figure 3B). Thus we set the minimum angular speed threshold for a turn event at 25 deg/s.
We observed that the distribution of angular change magnitude for events above the 25 deg/s threshold angular speed was bimodal (Figure 3, Figure Supplement 3B). The first peak indicates a proportion of events with small angular changes; the second peak centralized around much larger angular changes. We reckoned that the distribution of smaller angular changes could be from very short, sharp changes in orientation, which were potentially artefacts of the tracking to be removed.
We fit a Gaussian mixture to the distribution and found that the standard deviation of the low-mean Gaussian was approximately 4.5°. A navigating agent is more likely to regulate the duration of its turn, rather than the magnitude of the angular change and thus we instead set a minimum duration for turn events. With a minimum angular speed of 25°/s, and a minimum angular change of 4.5°, we get a minimum turn duration of 0.18 s. We removed all above angular speed threshold events with an event duration of less than 0.18 s; the resultant angular change distribution for turn events was no longer bimodal (Figure 3, Figure Supplement 3C).
Plotting turn quantities as a function of time
To estimate the turn rate as a function of time, at any time point we considered trajectories where flies were in a fixation state or had just transitioned from fixation to turn at that time point. Assuming an inhomogeneous Poisson process, the probability to transition from fixation to turn at a timepoint t is given by λ(t) · Δt, where Δt is the time-step resolution of our data, 1/60s. Thus the fraction of all considered trajectories that had just transitioned from fixation to turn, divided by Δt, provides an estimate of λ(t). We smoothed this estimate with a rectangular smoothing window of width 0.25s, sliding the window across each time step, and plotted the results in Figure 4A, grey, and Figure 4, Figure Supplement 1, grey. Errors bars were estimated by bootstrapping the data 500 times at each time point.
We estimated mean turn speed, mean turn duration and upwind bias as a function of time in the following way. We defined a 0.25s wide window and considered all turns that started in this window. For each turn, we then computed its mean angular speed, its duration and whether it was upwind (+1) or downwind (0). We then averaged these quantities to get an estimate of the mean turn speed, mean turn duration or upwind bias, respectively, for that window. As for the turn rate, we slid the window across each time step and plotted our results against the center of the time window. Error bars were estimated by resampling the data 1000 times at each time point.
Modeling fly turning behavior
The OFF function is defined as analogously to how it was defined in (Alvarez-Salvado et al., 2018). Here Islow and Ifast are defined as in Equation 5, with characteristic timescales τslow > τfast. At signal offsets, Islow decays slower than Ifast, so their difference (and thus OFF) is positive for some time. At signal onset or presence, Ifast rises faster and is greater in value than Islow, thus the max operation ensures that OFF is 0. Due to the integrative nature of the I filters, this OFF function reaches a higher peak after high intermittency signals.
The novelty function N(t) was defined as where tL is the time of the latest pulse onset. For the time between the onsets of the first and second pulse, At := 1. Otherwise, , where again tL is the time of the latest pulse onset and tL′ is the onset time of the pulse before the latest pulse. For a square wave signal, tL − tL′ becomes , i.e. the period of the signal. Thus at first pulse onset, N spikes to 1 and decays with timescale τNd. At subsequent pulses, N spikes to a height of At before decaying with timescale τNd. The τN timescale defines the time required between pulses to induce a strong response—if T ≪ τN, At ≈ 0 and the novelty response is suppressed. On the other hand if T ≫ τN, At ≈ 1 and the novelty response is maximal.
Parameter Estimation
To estimate parameters for turn rate (Equation 2), we considered time points where flies were in fixations (i.e. not turning) or had just transitioned from fixation to turn. We excluded fixations that lasted longer than 1.5s, as more than 95% of fixations were shorter than 1.5s and beyond this duration, fixation durations were no longer exponentially distributed (Figure 3 Figure Supplement 2). For a time point t, the probability to not initiate a turn at that time point is where Δt is our sampling time (1/60s) and λt denotes the turn rate from Equation 2 at that time point. The probability to initiate a turn at that time point is . We then constructed a likelihood function: and minimized the negative log of this likelihood using scipy.optimize.minimize with the standard L-BFGS-B method for minimization with bounds. All subsequent log-likelihood functions were minimized similarly. Note that for all timescales we estimated the log of the inverse timescale, i.e. the log of the ‘rate’ and then converted that back into a timescale.
To estimate turn speed parameters, we calculated the mean angular speed for each turn and subtracted our minimum turn speed of 25 deg/s (this is added back later when simulating the turns). The distribution of the resultant mean angular speeds was assumed to be a Gamma distribution with fixed shape parameter 2, based off the observations in Figure 3. The mean of this Gamma distribution was assumed to depend on the signal and is given by Equation 3. Assuming individual turns are independent, we could then construct a likelihood function as the product of the likelihood of each mean turn speed: where xt is the observed mean angular speed (after subtracting 25 deg/s) for the turn and μt is the predicted mean angular speed for a given set of parameters, using Equation 3. As the timescales for the N and OFF responses were already estimated from the turn rate analysis, only the three μ coefficients were estimated from this likelihood function, by minimizing its negative logarithm.
For turn duration, for each turn we calculated its duration and subtracted the minimum turn duration, 0.18s (this is added back later when simulating turns). We then assumed an exponential distribution for these resultant turn durations and computed a likelihood function as where here xt denotes the turn duration (after subtracting 0.18s). We found the constant λdur that minimized the negative log-likelihood. The inverse of this constant is reported as τdur in Materials and Methods, Table 1.
For the turn bias (Equation 4), we first fit the a0 parameter as explained in the main text. Given that the elevated upwind bias returns to baseline within a couple of seconds of ON block offset (Figure 5C, grey, Figure 5 Figure Supplement 4 grey), we assumed that the bias in the last 10 s of the OFF block (Figure 5D, black) had no remaining signal dependence and so takes the form 1F(1 + exp[−a0 · sin2 θ]). We then minimized the squared error between this functional form and the no-signal turn bias curve obtained from data (Figure 5D, black), using scipy’s optimize.least_squares routine and its default method, the Trust Region Reflective algorithm. The remaining turn bias parameters (timescales and gain factors in Equations 4-9) were fit by simulating 240 flies (roughly how many trajectories were in the experiment) executing our full turning strategy (see below for simulation details) with all other parameters fixed to their fit value and minimizing the squared error between the observed mean θ(t) and predicted θ(t) over the first 20s of the experiment. The minimization was done with a brute-force search over the parameter space, where g was discretized to 20 values linearly spaced between bounds shown in Materials and Methods, Table 1, while for the timescales we fit the log of the rates (i.e. 1Fτ) by considering 20 values linearly spaced between the log of the minimum rate and log of the maximum rate, corresponding to fitting the timescales with logarithmic spacing. The parameters that minimized the mean squared error were used.
Analysis of two-timescale integrating model
Following our analysis of a single timescale integrator I(t) in (Jayaram et al., 2022), we consider the response R(t) to a binary square-wave signal with frequency f and duration D. If we let Rn denote the value of R(t) at the onset of the nth pulse, then by straightforwardly integrating Equations 8 and 9, we get the relation Expanding and simplifying, we get where we define . We can then see that in general Note that , the period of the square wave and so , which we can see is lessthan 1. If we denote the asymptotic value of Rn as , we get We can then compute the asymptotic average value of R(t) over one period of the signal, which we denote as as If we note that f · D = Int, the intermittency of the signal, we get We can see here that the response depends independently on both the intermittency and frequency of the signal. Since the response is integrating the signal (Equations 8 and 9), increases with signal intermittency. To see how it depends on frequency, we consider the difference between the timescales. Firstly, note that if τg = τd then we just have a single timescale integrator and , as we would expect from (Jayaram et al., 2022). For the case where τg ≪ τd and can be approximated as 0 (as in our fits), one can readily compute , noting that R(t) is 1 when the signal is present and decays with timescale τd when the signal is absent.
We get which we can see grows with f until f ≫ 1Fτd at which point it levels off.
On the other hand, if τd ≪ τg and is taken to be 0 instead, we get and in this case decreases with increasing frequency, before leveling off. Thus we see that a short rise timescale and longer decay timescale are necessary for a positive response to both intermittency and frequency.
Simulating Fly Turning Dynamics
To simulate flies executing our turn model, we first determined whether a simulated fly would initiate a turn or not by taking the probability to initiate a turn in a time step Δt as λ(t) · Δt, where λ(t) is given by Equation 2. If a fly was not turning its angular velocity was assumed to be 0. If a turn was initiated, its duration in excess of 0.18s was sampled from an exponential distribution with timescale τddur, and added to 0.18s to get the total turn duration. The mean angular speed of the turn in excess 25 deg/s was sampled from a Gamma distribution with shape parameter 2 and mean given by Equation 3, then added to 25 deg/s to get the total mean angular speed. We assumed a turn had a parabolic angular speed profile (see Figure 3B). Given the mean value and duration (i.e. time between two zeros) of this parabola, we could compute for the duration of the turn as |6μ/d2(t − tstart)(t − (tstart + d))| where tstart is the start time of the turn, μ is the mean angular speed of the turn, d is the duration of the turn and the factor in front ensures that the average angular speed over the turn is equal to μ. To determine the sign of the turn, we determined whether it was upwind or downwind by simulating a Bernoulli variable with probability given by Equation 4. Once was specified for the whole turn, we could use Euler integration with timestep Δt = 1F60s (the frame rate of our experiments) to evolve a simulated agent’s heading. Values for response functions u(t) except for F(t) were computed by Euler integration with a step-size of 1/10th our sampling rate and then resampled for agent simulation. F(t) was computed as in (Jayaram et al., 2022). Agents were initialized with headings sampled from the distribution of experimental flies’ initial headings for that environment and initialized to all not be turning for simplicity (thus the first 0.1s of our simulated total angular speed is not shown in Figure 5C and 6A as the comparison with data would not be fair).
DATA AND CODE AVAILABILITY
The data, fly lines used in this study and the scripts used to perform experiments, track flies and extract relevant behavioral data are available upon request.
AUTHOR CONTRIBUTIONS
AS and VJ contributed equally to this work. AS, NK and TE conceived the project and designed the experiments. AS performed all experiments with help from EB. VJ and AS performed the data analysis with help from NK and TE. VJ performed the mathematical modeling, stochastic agent-based simulations, and parameter fitting. AS, VJ, NK, and TE wrote the manuscript. All authors revised the final manuscript.
ACKNOWLEDGMENTS
We thank G. Madeira Santana, M. Demir, H. Mattingly, and K. Kamino for helpful discussions. NK was supported by a postdoctoral fellowship through the Swartz Foundation for Theoretical Neuroscience, by postdoctoral fellowships NIH F32MH118700 and NIH K99DC019397. VJ and TE were partially supported by the Program in Physics, Engineering, and Biology at Yale. The project was supported by TE’s setup funds from Yale University.