fish, bouts, mean of 7 trajectories per fish. (A) Experimental setup: real-time monitoring of the larva’s position and orientation using IR illumination, enables closed-loop visual stimulation using a video projector. (B) Typical trajectory of a 6 days old larva in the region of interest (ROI) of the arena under constant, uniform illumination. Each point indicates the fish position at the onset of a swim bout. Dots’ size and color encode the bout distance and bout reorientation angle, respectively. Insets: blow-up of an example frame (left) and definition of the reorientation angle at bout index (right). b.len: body length. (C) Time-sequence of the fish body orientation (top). Swim bouts elicit rapid re-orientations. The angular dynamics can thus be represented as a series of discrete reorientation events of various amplitudes (color code as in (B)). (D) Experimental (dark) and analytical (blue) distributions (pdf: probability density function) of reorientations . The two normal distributions used in the fit with Equation A1, weighted by and , are also displayed in dashed blue lines. (E) Two independent Markov chains model for spontaneous navigation: the bout type chain controls the forward scoot () versus turning () state, with transitions rates and . The side chain controls the transitions between left () and right () headings when the animal is in the turning state, with transition rate . (F) Mean squared reorientation amplitude of bout as a function of the squared amplitude of bout (grey), and its associated analytical fit (blue, Appendix From behavior to circuit modeling of light-seeking navigation in zebrafish larvae Equation A5). (G) Average reorientation of bout as a function of the reorientation at bout (grey), and its associated analytical fit (blue, Equation A11). (H) Correlation in reorientation angles as a function of the number of bouts (grey) and associated fit (blue, Equation A14). (I) Mean square reorientation (MSR) as a function of the number of bouts, and associated fit (blue, Equation A17). The dotted line is the linear extrapolation of the first two data points and corresponds to the diffusive process expected for a memory-less random walk (no correlation in bout orientation). (J) Orientation correlation of turning bouts (thresholded at 0.22rad) as a function of the time elapsed between those bouts. The blue line is the exponential fit. Data from this and the following figures are available at Karpenko (2019a) (copy archived at https://github.com/elifesciences-publications/programs_closed-loop_phototaxis).