a, Schematic of optogenetic fly walking assay. Flies with Chrimson expressed in ORNs receive optical stimulation from a video projector mounted above the arena. b, Fictive odor bars moving at 15 mm/s are presented in 5s blocks, interleaved with a 5s blank period. c, Component of fly walking velocity along +x direction during the stimulus (shaded grey) and blank periods, for bars moving in +x (blue; n=178 tracks) or -x (orange, n=192 tracks). Shaded error bars: SEM. Only flies facing in the 90° sector perpendicular to bar motion at odor onset (t = 0) are included; d, Distribution of fly orientations during stimulus (top) and blank periods (bottom); colors same as c. Orientations are symmetrized over the x-axis. e, Direction sensing can be differentiated from gradient sensing by measuring turning responses versus fly orientation at both edges of wide, moving fictive odor bars: the ON edge (when the fictive odor first passes onto the fly) and the OFF edge (when it leaves the fly). f, Fly turning bias versus orientation for ON (green) and OFF (purple) edges moving at 10–15 mm/s. Darker curves: flies fed ATR; lighter curves: not fed ATR. Turning bias is quantified as the sign of orientation change following edge onset, where (−1) +1 is (counter)clockwise. Each point covers ±45°; thus, distinct points contain overlapping data. Error bars: SEM. Turning bias for ATR-fed flies, when oriented perpendicular to the bar motion (θ = 0), are significantly different from zero for both ON and OFF edges (p < 1e-6 for both edges, chi-squared test; n=1673, 1509 ON and OFF edge encounters, respectively). Turning biases are not statistically distinct from zero for non-ATR fed flies (p=0.09 and p=0.77 (chi-squared test) and n=1397 and 1484, for ON and OFF edges, respectively).