(a) The behavior of larvae in a linear gradient (Gershow et al., 2012) of an innately attractive odor, ethyl acetate, (EA) is recorded after odor presentation is intercalated (’unpaired’ training protocol) or coincident (’paired’ training protocol) with fictive punishment (optogenetic activation of nociceptive basin neurons [Ohyama et al., 2015]). Larvae navigate via kinesis, modulating turn rate over time and in response to different conditions, and via klinotaxis/tropotaxis, choosing turn side (Gershow et al., 2012; Gomez-Marin and Louis, 2012; Schulze et al., 2015; Gepner et al., 2015). Here, we record turn rate as a function of larval orientation in the odor gradient (c). (b) Navigation index following paired and unpaired protocols (computed by dividing the mean velocity in the direction of the gradient by the mean crawling speed). The positive index after the unpaired protocol indicates that larvae approach the odor, the negative index after the paired protocol indicates they avoid it. (c) Turn rate as a function of larval orientation in the gradient. Unpaired group larvae approach the odor by turning less in response to an increase in odor concentration (when crawling up the gradient, toward the odor source), and more in response to a decrease in odor concentration (when crawling down the gradient, away from the odor source). Paired group larvae avoid the odor by turning more in response to an increase in the odor concentration (when crawling up the gradient), and by turning less in response to a decrease in odor concentration (when crawling down the gradient). Values are mean s.e.m. *: p < 0.05, **: p < 0.01 in a Welch Z-test, N = 10 repeats.