^{1}

^{2}

^{3}

^{*}

^{1}

^{1}

^{2}

^{1}

^{*}

Conceived and designed the experiments: WR. Performed the experiments: BJ-K. Wrote the paper: GS WB WR. Analyzed the image data and developed the associated theory: GS WB WR. Analyzed the worm steering data: WR BJ-K.

The authors have declared that no competing interests exist.

A major challenge in analyzing animal behavior is to discover some underlying simplicity in complex motor actions. Here, we show that the space of shapes adopted by the nematode

A great deal of work has been done in characterizing the genes, proteins, neurons, and circuits that are involved in the biology of behavior, but the techniques used to quantify behavior have lagged behind the advancements made in these areas. Here, we address this imbalance in a domain rich enough to allow complex, natural behavior yet simple enough so that movements can be explored exhaustively: the motions of

The study of animal behavior is rooted in two divergent traditions. One approach creates well-controlled situations, in which animals are forced to choose among a small discrete set of behaviors, as in psychophysical experiments

Here we explore the motor behavior of the nematode,

We use tracking microscopy with high spatial and temporal resolution to extract the two-dimensional shape of individual

(A) Raw image in the tracking microscope. (B) The curve through the center of the body. The black circle marks the head. (C) Distances along the curve (arclength

We analyze the worm's shapes in a way intrinsic to its own behavior, not to our arbitrary choice of coordinates (

Although the worm has no discrete joints, we expect that the combination of elasticity in the worm's body wall and a limited number of muscles will lead to a limited effective dimensionality of the shape and motion. In the simplest case, the relevant low dimensional space will be a Euclidean projection of the original high dimensional space. If this is true, then the covariance matrix of angles,

(A) The covariance matrix of fluctuations in angle ^{2}_{K}_{μ}(s). The population-mean eigenworms (red) are highly reproducible across individual worms (black). (D) The fraction of variance, ^{2}_{K}^{2}_{K}

Associated with each of the eigenvalues _{μ} is an eigenvector _{μ}(_{μ}} are the amplitudes of motion along the different principal components,

Thus far we have considered only worms moving in the absence of deliberate sensory stimuli. Do the worms continue to move in just a four dimensional shape space when they respond to strong inputs? To test this, we delivered intense pulses of heat (see

The projection of worm shapes onto the low-dimensional space of eigenworms provides a new and quantitative foundation for the classical, qualitative descriptions of _{1}, _{2}), shows a ring of nearly constant amplitude (

(A) The joint probability density of the first two amplitudes, ρ(_{1}, _{2}), with units such that ^{-1}(-_{2}/_{1}). (B) Images of worms with different values of _{1}, _{2}} plane, with occasional, abrupt reversals. (D) The joint density ρ(|

In contrast to the first two modes, the third mode _{3}(_{3} has a long tail (_{3} also correspond to gradual turns in the worm trajectory along the agar (

(A) The distribution of amplitudes _{3}), shown on a logarithmic scale. Units are such that _{3}). (B) Images of worms with values of _{3} in the negative tail (left), the middle (center) and positive tail (right). Large negative and positive amplitudes of _{3} correspond to bends in the dorsal and ventral direction, respectively. (C) A two minute trajectory of the center of mass sampled at 4 Hz. Periods where |_{3}|>1 are colored red, illustrating the association between turning and large displacements along this mode.

The fourth mode _{4}(_{4}(

The connections between mode amplitudes and the motion of the worm along the agar—as in _{1} and _{2}; the speed of crawling is set by the speed of the rotation. Similarly, to change direction the worm changes shape toward larger magnitudes of the mode amplitude _{3}, and we see this connection even without defining discrete turning events.

The eigenworms provide a coordinate system for the postures adopted by _{1} and _{2}.

Here

In _{1},_{2}} plane and hence the relatively long periods of constant oscillation, and a rapidly fluctuating part

(A) The mean acceleration of the phase

We can imagine a hypothetical worm which has the same deterministic dynamics as we have found for real worms, but no noise. We can start such a noiseless worm at any combination of phase and phase velocity, and follow the dynamics predicted by Equation 4, but with

We can compare the predicted behavioral states with the motion of real worms that include transitions between these states.

The behavior of

We consider the response to brief (75 ms), small (Δ_{t}(

(A) The distribution of phase velocities _{t}_{1},_{2}} plane and _{3},

Arrival in the pause state is stereotyped both across trials and across worms. By analogy with conventional psychophysical methods

Our discussion thus far has separated the dynamics of the worm into two very different components: the {_{1}, _{2}} plane with its phase dynamics, responsible for crawling motions, and the mode _{3}, which is connected with large curvature turns. Because these modes are eigenvectors of a covariance matrix their instantaneous amplitudes are not linearly correlated, but this does not mean that the dynamics of the different motions are completely uncoupled. We found the clearest indications of mode coupling between the phase in the {_{1}, _{2}} plane and the amplitude _{3} at later times, which is illustrated by the correlation function in _{3} when worms are thermally stimulated with their head turned to either the dorsal or ventral side. Worms stimulated when making a ventral head swing (−2≤_{3}<0), and vice versa. Note that the thermal pulse itself does not have a handedness, so that if the pulses are not synchronized to the state of the worm there should be no systematic preference for dorsal vs. ventral handed turns. As a further test of this idea, we implemented our analysis online, allowing an estimate of the phase with a delay of less than 125 ms. We then deliver an infrared pulse when the phase falls within a phase window that corresponds to either dorsal– or ventral– directed head swings. The predicted consequence is that the worm should turn in the opposite direction to the laser stimulation, and is confirmed in

Our central result is a new, quantitative, and low-dimensional description of

The construction of the eigenworms guarantees that the instantaneous amplitudes along the different dimensions of shape space are not correlated linearly, but the dynamics of the different amplitudes are nonlinear and coupled; what we think of as a single motor action always involves coordinating multiple degrees of freedom. Thus, forward and backward motion correspond to positive and negative phase velocity in _{3}, but motion along this mode is correlated with phase in the ({_{1}, _{2}}) plane, and this correlation itself has structure in time (

Perhaps because of the strong coupling between the turning mode _{3} and the wriggling modes _{1}, _{2}, we have not found an equation of motion for _{3} alone which would be analogous to Equation 4 for the phase. Further work is required to construct a fully three dimensional dynamics which could predict the more complex correlations such as those in

We have shown that a meaningful set of behavioral coordinates can uncover deterministic responses. A response might seem stochastic or noisy because it depends on one or more behavioral variables that are not being considered. In our experiments, nonlinear correlations among the behavioral variables suggest that some of the randomness in behavioral responses could be removed if sensory stimuli are delivered only when the worm is at a well defined initial state, and we confirmed this prediction by showing that phase–aligned thermal stimuli can ‘steer’ the worm into trajectories with a definite chirality. A crucial aspect of these experiments is that the stimulus is scalar—a temperature change in time has no spatial direction or handedness—but the response, by virtue of the correlation between stimulus and body shape, does have a definite spatial structure. The alignment of thermal stimuli with the phase of the worm's movement in these experiments mimics the correlation between body shape and sensory input that occurs as the worm crawls in a thermal gradient, so the enhanced determinism of responses under these conditions may be connected to the computations which generate nearly deterministic isothermal tracking

More generally, all behavioral responses have some mixture of deterministic and stochastic components. In humans and other primates, it seems straightforward to create conditions that result in highly reproducible, stereotyped behaviors, such as reaching movements

More than forty years of work on

The imaging system consists of a Basler firewire CMOS camera (A601f, Basler, Ahrensburg, Germany) with 4x lens (55–901, Edmund Optics, Barrington, NJ) and a fiber optic trans-illuminator (DC-950, Dolan-Jenner, Boxborough, MA) mounted to an optical rail (Thorlabs, Newton, NJ). The rail is attached to a XY translation stage (Deltron, Bethel, CT) which is driven by stepper motors (US Digital, Vancouver, Washington). The stage driver is a homemade unit utilizing a SimpleStep board (SimpleStep, Newton, NJ) and Gecko stepper motor drivers (Geckodrive, Santa Ana, CA). Image acquisition, processing, and stage driver control was done using LabVIEW (National Instruments, Austin, TX). Images of worms were isolated and identified using the image particle filter. A raw unprocessed JPEG image and a filtered process binary PNG image were written to the hard drive at rates up to 32 Hz. Concurrently at 4 Hz, the center of mass of the worm was calculated and the distance from the center of the field of view in pixels was computed. An error signal was then calculated via a coordinate transformation between the camera reference frame and the translational stage reference frame and the XY stage was moved to center the worm in the field of view.

The _{2}, 1 mM MgSO_{4}, 25 mM potassium phosphate buffer, 5 µg/mL cholesterol) was removed by leaving them partially uncovered for 1 hr. A copper ring (5.1-cm inner diameter) pressed into the agar surface prevented worms from crawling to the side of the plate. Young adults were rinsed of

Images of worms captured by the worm tracker were processed using MATLAB (Mathworks, Natick, MA). Cases of self-intersection were excluded from processing. Images of worms were thinned to a single-pixel-thick backbone, and aligned so that the dorsal/ventral directions were consistent. A spline was fit through these points and then discretized into 101 segments, evenly spaced in units of the backbone arclength. The _{μ}(_{s}_{′} C(_{μ}(_{μ}_{μ}(^{2} = _{μ}λ_{μ}^{−1}(−_{2}/_{1}) where _{1} and _{2} were both normalized to unit variance. The crawling speed was defined as the time derivative of the worm's center of mass.

For the analysis of phase dynamics we sampled the worm shape at 32 Hz. Data for the construction of the equations of motion came from 12 worms, 5 trials per worm, with 4000 frames per trial. We also filtered each mode time series through a low-pass polynomial filter so that for each frame (26≤_{j}} are the best-fit polynomial coefficients. Mode time derivatives were calculated using derivatives of the polynomial filter. None of our results depend critically on the properties of the filter. The Langevin equations governing the phase dynamics are shown Eq. (4) and we learn the functions {_{max} = 5, _{max} = 5} were chosen to minimize error on held-out data (10%). Once ^{2}〉 so that

Worms were prepared as described earlier but raised at a lower temperature (17°C) leading to a lower average ω before the thermal stimulus. A collimated beam with a 1/e diameter of 5.6 mm (standard stimulus) or 1.5 mm (painful) from a 1440 nm diode laser (FOL1404QQM, Fitel, Peachtree City, GA) was positioned to heat the area covering the worm. The diode laser was driven with a commercial power supply and controller (Thorlabs, Newton, NJ). Power and duration of the beam was controlled through software using LabVIEW. For each worm, 1000 seconds of data was collected in cycles of 50 seconds. 12.5 seconds into each cycle the laser was turned on for a duration of 75 ms at 150 mW (standard) or 250 ms at 100 mW (painful). The temperature increase caused by the laser pulses was measured using a 0.075mm T-type thermocouple (coco-003, Omega, Stamford, CT) placed on the surface of the agar and sampled with a thermocouple data acquisition device (USB-9211, National Instruments). For each measurement, 60 trials of 30 s cycles were averaged. The temperature increase was calculated by subtracting the maximum temperature (recorded immediately after the laser pulse) from the baseline temperature (recorded 9 s after the laser pulse). The temperature increase for the standard pulse was 0.12°C and the increase of the painful pulse was 0.73°C.

Data were taken from a collection of 13 worms, each stimulated with 20 repetitions of a Δ_{t}(_{post}(_{post}(_{i}_{–j = Δ} is the true correlation function and ξ_{post}(_{stim}(_{stim}(_{stim}(_{post} and ξ_{stim}. We write each matrix ξ_{post/stim}(_{t″}_{post/stim}(_{post/stim}(_{post/stim}(_{stim} are significantly larger than ξ_{post}. We then reconstruct the two-point function around the stimulus as

Preparation of worms and instrumentation were the same as described for the thermal impulse response. However, instead of processing worm images off-line, real-time calculation of the eigenworms and shape phase

The time-average change in orientation of the worm's path, 〈_{1}, _{2}, _{3},…, _{N}_{2}– _{1}, _{3}– _{2}, _{4}– _{3},…, _{(N-1)}

We thank D. Chigirev, S. E. Palmer, E. Schneidman, and G. Tkačik for discussions, and A. R. Chapman for help in the initial building of the worm tracker and for programming the thinning algorithm used for real-time processing.