The microscope sees a round field 25 mm across in its image plane. A camera chip covers a rectangle in it, and you choose which part of the chip to read out: a smaller region can be read faster. A point-scanning confocal instead sweeps a laser spot over a square, line by line.
Differential dynamic microscopy
How fast do cells swim?
Many bacteria swim, and so do algae and sperm. How fast they swim and how many of them do it tells a biologist whether they are healthy, hungry or poisoned, and a clinician how well sperm move, one of the main measures of a semen analysis. Following cells one by one is slow and gives a few hundred tracks at best. Differential dynamic microscopy (DDM) reads the swimming speeds and the share of swimmers from an ordinary microscope movie of thousands of cells in a few minutes, without following any of them (Wilson et al. 2011). Here a simulated microscope lets you run this motility assay yourself, from the raw movie to the distribution of swimming speeds, and see where it can go wrong.
Hands on
The bench
Change the cells, the microscope or the camera with the controls (on the left, or just below on a phone). The movie is recorded again and every step below updates. A run takes from a few seconds to about a minute, because every cell is imaged through a detailed model of the microscope's optics. "Copy a link to this setup" gives an address that opens the bench with the same settings, to share or to come back to.
Set up the microscope
How one particle looks
What this step gives: the finest stripes the movie can hold, and how strongly each particle shows in them: the objective and the light decide both.
The math: how each image is computed
Bright field. The condenser fills its aperture with mutually incoherent plane waves (spatial coherence) at the wavelengths of the lamp spectrum (temporal coherence). For each of them, the light scattered by the sphere, computed exactly with Mie theory from the particle and liquid refractive indices, interferes with the transmitted light after passing the objective pupil. The intensities are then added. The same formula covers the other transmitted-light methods by changing the illumination and the pupil: phase contrast lights the sample through a thin annulus and gives the objective pupil a ring that dims the direct light and shifts its phase by a quarter wave; dark field uses illumination steeper than the objective can collect, so only the |Es|2 term is left; DIC multiplies the pupil by i sin((κ·s + φ)/2), with s the shear and φ the bias, so the image depends on the direction of q. For a particle at distance z from focus, the Fourier transform of its image is
with S = (S1 + S2)/2 the Mie amplitude at the scattering angle θ and P the pupil with aplanatic apodization. At q = 0 the interference term equals minus the extinction cross-section (optical theorem), which the code checks.
Fluorescence. Emission is incoherent: the image is the dyed sphere convolved with the Debye point spread function (scalar, or vector at high NA). Confocal (spinning disk or point scanning): excitation spread times emission spread convolved with the pinhole projected on the sample; cross-talk between the disk pinholes is neglected.
Swimmers. A chosen share of the cells swims along its own axis at a speed drawn from a Schulz (gamma) distribution, keeps its Brownian motion, turns slowly by rotational diffusion and, if asked, tumbles at random times into a new direction. Swimmers bounce off the walls of the cell by mirroring the vertical part of their direction. Along the glass all cells lie flat and move only within the plane. The cells do not interact and are not slowed down near the glass.
Movie. Dilute particles diffuse in 3D (Stokes-Einstein, reflecting walls); each frame is the sum of their images, recorded with the detector's pixel size, quantum efficiency, shot noise, read noise and full well. Each particle is imaged when its row is exposed (rolling shutters) or scanned (point scanners). Included: spherical aberration from focusing into the liquid; optionally vector (high-NA) optics, settling under gravity and slower translation near the glass. Neglected: multiple scattering, interference between light scattered by different particles, other aberrations (for example a wrong cover-glass thickness), polarizers acting on rods and ellipsoids beyond the paraxial approximation, imperfect DIC prisms, stray light in dark field other than a fixed share of the illumination, slower rotation near the glass.
Particles that turn. Each particle carries an axis u that diffuses on the sphere (rotational diffusion DR), and moves with D∥ along it and D⊥ across it in its own frame (Perrin's formulas for ellipsoids: F. Perrin, J. Phys. Radium 5, 497 (1934) and 7, 1 (1936), as corrected by S. H. Koenig, Biopolymers 14, 2421 (1975); for rods, M. M. Tirado, C. L. Martinez and J. Garcia de la Torre, J. Chem. Phys. 81, 2047 (1984)). Its polarizability is a tensor α = α⊥ I + (α∥ − α⊥) u u, from the material's birefringence and from the shape. With a polarizer along eP and an analyzer along eA, the interference term is weighted by (eA·eP)(eA·α·eP) and the scattered intensity by |eA·α·eP|2. Spheres keep their exact Mie field, scaled by these weights. Rods and ellipsoids are filled with small scatterers (Rayleigh-Gans), which also gives their shape in the image; in the scattered intensity the shape sets a tilt-dependent brightness 〈|F(Q)|2〉 over the illumination and collection angles.
Checked against miepython (amplitudes to 1e-10), the optical theorem, a brute-force sum over 3000 source points, and the amplitude formula of fastDDM tutorial 6 in its range of validity.
Record a movie
What this step gives: a stack of frames and the time of each. The time between frames and the length of the movie set the fastest and the slowest changes that can be measured.
In fastDDM
The analysis below uses the same steps as fastDDM. The code lines on this page are excerpts that show which call does each step; the fastDDM tutorial on bacteria runs a complete analysis. With your own movie you would start from the image files:
import fastddm as fd img_seq = fd.read_images(file_names)
Log-spaced frames: long movies from few frames
A camera can also be triggered at chosen times. With "Frame timing: log-spaced" the page takes the frames in cycles of M = 32 frames. In each cycle the first frames follow one frame interval δt apart; after that each gap is a factor r longer than the one before (rounded to whole intervals):
The page chooses r (about 1.1 to 1.2) so that the movie lasts 5, 10, 20 or 50 times longer than with evenly spaced frames. Pairs inside a cycle give the delays from δt to oM−1 δt; pairs in cycles k apart give k P ± oM−1, so the delays follow one another without gaps, as the channels of a multi-tau correlator do. The structure function is computed from pairs of frames grouped by delay (one group per frame interval up to 10, then 12 groups per factor of ten), with up to as many pairs per group as there are frames. Each group has fewer pairs at the shortest delays than with evenly spaced frames, so those points scatter more. The movie in step 2 is played one frame after the other, so the longer gaps show as sudden changes.
Subtract two frames
Subtract a frame from one taken a little later. Everything that stays still, such as dust or uneven light, cancels out. What is left is what moved, plus the camera noise.
Move the delay slider. With a short delay the difference is faint. With a longer one it grows, until the two frames have nothing left in common.
What this step gives: for every pair of frames a delay apart, an image of what changed. Random motion usually makes the difference grow with the delay; directed motion can also make it swing up and down.
The math: the difference image
Anything that does not change in time disappears from ΔI. This is why DDM tolerates dirty optics and uneven illumination.
Split it into stripe patterns
Any image can be built by adding up stripe patterns of different spacing and direction. The Fourier transform tells how much of each pattern the difference image contains, averaged over the whole movie.
The charts further down label each pattern by q, a number that grows as the stripes get finer: q = 2π divided by the stripe spacing, in inverse micrometres. Stripes 1 µm apart have q of about 6.
The centre of the map holds wide stripes, the edge holds fine ones. Click the map, or move the two sliders below it, to see which pattern a point stands for. The map uses the same delay as step 3.
Distance from the centre is the size of the wave vector, q = 2π / spacing. The particles have no preferred direction, so the map is round (DIC and drift are exceptions), and we average it along circles to get one value for each q. The dashed circle marks the finest pattern the objective can resolve.
What this step gives: for each stripe spacing (each q, one ring of the map) and each delay, how much the movie has changed.
The math: image structure function
Here F is the two-dimensional Fourier transform and the average runs over all start times t. For motion with no preferred direction, d depends only on q = |q|, and the azimuthal average gives d(q, Δt). The cross qx = 0 or qy = 0 is left out because image edges add artefacts there. Windowing (switch under Analysis, off by default; Giavazzi, Edera, Lu and Cerbino, Image windowing mitigates edge effects in differential dynamic microscopy, Eur. Phys. J. E 40, 97 (2017)): the transform treats each image as one tile of a repeating pattern, so anything that crosses an edge makes a jump at the tile border. The jump spreads over all q along the axes of the map and adds a fast decay, nearly the same at every q, that swamps the finest patterns. With the switch on, each frame is first multiplied by a Blackman-Harris window W(x)W(y), W = 0.3636 − 0.4892 cos(2πx/L) + 0.1366 cos(4πx/L) − 0.0106 cos(6πx/L), which falls smoothly to zero at the edges. The window has its own price: less of the field counts, and its transform mixes each pattern with its neighbours up to 3 steps away in q, so the widest patterns (below 5 steps) are left out. On two simulated movies of the standard sample it read the speed 1.5 and 3 % high (3.4 and 3.9 % without it) and the share 0.61 and 0.56 (0.68 and 0.56 seen). The camera noise B becomes 2 〈W2 × noise variance〉. The paper keeps the peak of the window at 1, which lowers A(q) and B by more than 90 %; here the window is scaled so that the mean of W2 over the image is 1, so A(q) and B keep the height they have without it and the two analyses can be compared on the same axes. Rates, sizes and speeds do not depend on this choice.
dqt = fd.ddm(img_seq, range(1, len(img_seq) // 2)) dqt.pixel_size = 0.65 # um, the pixel of this setup (step 2) dqt.set_frame_rate(50) # frames per second of this setup: sets the delays in seconds ccm = fd.mask.central_cross_mask(dqt.shape[1:]) aa = fd.azimuthal_average(dqt, bins=len(dqt.ky) // 2, range=(0, dqt.ky[-1]), mask=ccm)
Watch each pattern change
For each stripe spacing, ask how different the movie looks after a given delay. Fine stripes (red) change quickly, because a cell only has to move a little to shift them. Wide stripes (blue) take longer. For the standard mixture of swimming and non-swimming cells, each curve rises in two steps: first quickly, because the swimmers carry the pattern away, then slowly, as the cells that only jiggle wander off.
The page first measures how different two frames a delay apart look, for each stripe spacing. Two numbers for each spacing then put all the curves on one scale: the camera noise, there even at the shortest delay, is taken away, and what is left is divided by the full change, reached once the pattern is completely renewed. So each curve rises from 0, nothing has changed, to 1. The points are this measurement. The lines are one swimmer model fitted to all of them at once (step 6): a good match shows that the model describes the points, and the comparison with the simulated cells in step 6 shows whether the speed is right.
Each curve is the structure function d(q, Δt) for one q. It rises from the camera noise level B(q) to A(q) + B(q). The lines are one swimmer model fitted to all q at once, with a shared speed distribution, share of swimmers and diffusion coefficient. The "Change" view removes A and B so all curves share one scale. Camera noise is white, so B is the same at every q: with a camera the page takes it from the frames themselves, B = 2(〈N〉 + σread2), with 〈N〉 the mean count in electrons and σread the read noise, instead of fitting it at each q, where it would soak up any misfit of the model. The order of the analysis. d is measured first; B comes from the camera (with the point scanner it is fitted, between 0 and the first point of each curve); A of each q follows from the swimmer fit. The points of the "Change" view are (d − B)/A, rising from 0 to 1; step 6 plots what remains, f = 1 − (d − B)/A, which a swimmer can push a little below zero. The lines show how well the model describes the points; the comparison with the simulated cells tests the result.
The numbers behind this chart: curves for several wave vectors
What this step gives: one curve per stripe spacing. Swimming makes a quick rise and diffusion a slow one; a mixture of swimming and non-swimming cells shows both.
The math: the swimmer model
For independent cells f is the average of e−iq·Δr over all cells. A share α swims in straight lines, in random directions, at speeds v from a Schulz distribution of mean v̄ and relative spread σ (shape Z = 1/σ2 − 1); all cells also diffuse with D (Wilson et al. 2011):
The sine over its argument is the average of e−iq·vΔt over directions in 3D. For cells swimming in the image plane the average over directions in the plane is the Bessel function J0(qvΔt) instead. The page fits α, v̄, σ and D to all q at once; A of each q follows by linear least squares, and B too when the camera does not give it (step 5). Several starting points are tried and the best fit is kept.
The shape of the cells. Wilson's model treats each cell as a point. A rod swims along its own axis u, and its image at q depends on the angle between the two: for a cylinder of length L and radius R the weight is |F|2 = sinc2(qμL/2) [2J1(x)/x]2, with μ the cosine of the angle between q and u and x = qR(1 − μ2)1/2. A swimmer moves along u, so q·Δr = qvΔtμ, and the page averages over directions with this weight:
μ is spread evenly over [0, 1] for cells swimming in 3D, and μ = cos φ with φ spread evenly for cells in the plane; with |F|2 = 1 this gives back the sine over its argument and J0. When qL is large, the swimmers moving across q, which renew the pattern slowly, dominate. The length and width are those of the simulated cells, which an experimenter measures in the images. In a simulation with fluorescent 50 μm Euglena the point model reads the speed 40 % low and the weighted model is within 1 %. In bright field at very low aperture the image of a thick cell is not its flat outline at patterns finer than its length, so the page keeps by default to patterns at least as wide as a cell is long.
Two safeguards. When the cells that do not swim barely move during the movie, a smaller α with a larger A describes the curves just as well (cells that stay put add nothing to the changes from frame to frame). So the page also tries D fixed at the value expected from the size and shape of the cells and the viscosity of the liquid, and keeps it when the data do not ask for another one (cost at most 3 % higher); for rods it may add the fading of the still cells as they turn, a share b at rate 6DR. The swimmers turn too, and their images fade in the same way: the same share b (it belongs to the image of a rod at that q, whatever the rod does), at rate 6Ds, with Ds the rotational diffusion of their heading, fitted, at most that of the body alone (from its size and the viscosity, as D; the flagella only add drag). Without this term the share of swimmers came out about 8 % low in a sample where all cells swim (the fading of the swimmers was taken for still cells that turn) and the speed of the standard sample 5 % high instead of 3-4 %. Without the limit, for long rods the fading stood in for the errors of the shape weight and the speed came out up to 23 % low. And it fits cells that do not swim at all (α = 0, with b and DR free): if that is about as good (cost at most 10 % higher), it reports no swimming, because turning rods alone can pass for slow swimmers. Last, A of each q stays below the whole amplitude from the mean power of the images, and below three times twice the variance in time of that pattern. The second limit is dropped when the cells that do not swim hardly move during the movie at every q used (Dq2 times the longest delay below 1): then most of their amplitude never shows up in the variance in time, and with it a sample of dead sperm passed for 40 % slow swimmers.
Uncertainties. The points of d(q, Δt) are not independent: all delays come from the same frames, and the same cells make every curve. The covariance of the fit treats them as independent and gives errors several times too small. The page therefore repeats the fits K = 5 times, each time with one fifth of the movie left out (a pair of frames counts in the block of its first frame), and quotes the jackknife error √[(K − 1)/K Σ (xj − x̄)2]. In simulations of the standard sample and of wild-type E. coli, six movies each, the speed scattered from movie to movie by 1.2-1.3 times the quoted error (the covariance of the fit gave 5-8 times too little). The error does not include the errors of the model, such as a few % from the shape of the cells in phase contrast; the true values, and "Repeat 5 times with new cells", show those. Nor does it include which cells happen to be in view: the parts of the movie show the same cells. With few cells this matters. In five simulated movies of Chlamydomonas (about 170 cells, all with the stroke frequency found within 0.5 %) the speed scattered by 3.4 % against a quoted 1.2 %, one movie being 7 % off; with 250-340 cells (E. coli, standard sample) the factor was 1.2-1.3. The page adds a note when fewer than 200 cells are in view.
The depth of field. Wilson's model counts only sideways motion. A cell at depth z adds K(q, z) e−iq·x to the image, with K the optical kernel of step 1, so a swimmer that also moves up or down fades from each pattern. With Cq(δz) the overlap of K(q, z) and K(q, z + δz) averaged over the cell, a swimmer that has moved s = vΔt gives
in place of the sine over its argument (they are equal when C = 1), averaged over the speeds; the cells that do not swim get Cq averaged over their axial diffusion, and the swimmers get the same factor on top, as they diffuse up and down too (for those swimming along the slice that is all their axial motion). Without it, at 60x with all cells swimming the fit needed a diffusion coefficient three times too large; with it the true one fits and the speed is within 1 %. With 60 % swimming at 60x the share still reads about 0.76 for 0.62 seen. This model is used automatically in the confocal modes. As far as we know it has not been published.
The stroke. Algae and sperm do not glide: each beat moves the cell, or the sperm head, back and forth about its mean path. Martinez et al. (2012) wrote the displacement as vΔt + A[sin(2πfΔt + φ) − sin φ], with a random phase φ for each cell. Averaged over φ and over the speeds, the sine over its argument of Wilson's model becomes
with μ the cosine between the path and q. The curves dip and rise again once per beat, so the camera needs at least two frames per beat. For a stroke across the path (the sperm head) in a random direction about it, the Bessel factor becomes J0(qA |sin(πfΔt)| √(1 − μ2))2. The page fits A and f with the other parameters, after a search over a grid of beat frequencies.
B_est, _ = fd.noise_est.estimate_camera_noise(aa, mode='polyfit', num_points=5) A_est = 2 * aa.var - B_est # swimmer model: write it as an lmfit model and fit all q together, as in # fastDDM tutorial 8a (there with a compressed exponential at each q)
Who swims, who only diffuses, and how fast
The charts below show the curves of step 5 the other way up: how much of each pattern is still there after the delay (1, all of it; 0, gone). When only some cells swim, this falls in two steps, just as the change of step 5 rises in two. Two ways of plotting the same curves tell the two kinds of motion apart. A swimmer at constant speed covers a distance in a time proportional to it, so a pattern renews when qΔt reaches a fixed value: against qΔt (first chart) the fast first steps of all patterns fall on one curve. A cell that only diffuses needs four times as long to go twice as far, so against q2Δt (second chart) the slow last steps fall on one curve instead. The level between the two steps is the share of the image signal that comes from cells that do not swim (in the model, which takes the two groups as independent); when all cells look alike, it is their share of the cells.
Now plot how fast each pattern changes against how fine it is. A swimmer covers twice the distance in twice the time, so for point-like swimmers halving the stripe spacing makes the change twice as fast: on these logarithmic axes a line of slope 1. Cells of finite length rise more slowly at the finest patterns, where the cells moving across the stripes count more; the result gives the slope found. Cells that only jiggle need four times as long to wander twice as far, which gives slope 2. The dots are not an independent test of the swimmer model: each is fitted with the share of swimmers, the diffusion and the turning taken from it.
The speed itself comes from fitting one swimmer model to all the curves of step 5 at once. It gives the mean speed of the swimming cells, how much their speeds spread, the share of the signal from swimming cells and how fast the others diffuse.
Hollow grey points are outside what this movie can measure: patterns as large as the image or finer than the microscope resolves, changes faster than one frame or too slow for the movie, signal lost in the camera noise. They are left out of the result.
The numbers behind this chart: rate against wave vector
The numbers behind this chart: speed against wave vector
What the analysis is told, and what it finds
Told (inputs): the pixel size and the time between frames; the read noise and the gain of the camera, for B; the length and the width of the cells, which set how their shape weighs the patterns; the diffusion expected from that size and shape in this liquid, kept only when the data do not ask for another; for cells swimming along the glass, their height; the optics, for the cells' turning.
Found from the movie: the share of the signal from swimming cells, their mean speed and how much the speeds spread, and how fast the other cells diffuse.
In this simulation the analysis uses the same model of the optics that made the movie, so agreement here shows that the analysis recovers what was simulated under those assumptions; with a real microscope the optics are another input that can be wrong.
What this step gives: a measured trend, which curves fall on one another against qΔt or against q2Δt, says whether the cells swim, only diffuse, or both. The speeds and the share of swimmers are an interpretation: they come from the swimmer model fitted to the curves.
A question to think about: In another sample the quick rise of each curve shrinks, but it happens after the same delay. Which fitted number should change, and which should not?
The share of the signal from swimming cells drops, because the quick rise is smaller. The mean speed stays, because the quick rise happens after the same delay: the swimmers left are as fast as before. The exercise with half the swimmers stopping shows it; compare the result tables before and after.
The math: rates, v₀ and the distribution of speeds
The points of the plot come from fitting each q on its own with a compressed exponential, f = exp[−(ΓΔt)β], as fastDDM tutorial 8a does for swimming bacteria (Lu et al. 2012). For swimmers Γ = v₀ q. This v₀ is a speed scale, not the mean speed: in 3D the sine over its argument falls to 1/e at qvΔt ≈ 2.2, the compressed exponential at qv₀Δt = 1, so v̄ ≈ 2.2 v₀ for a narrow distribution of speeds and 2.4-2.8 v₀ for broad ones (in the plane 1.7-2.0 v₀). A compressed exponent β ≈ 1.35 corresponds to a broad distribution, with a relative spread of about 70 %.
When only part of the cells swim, each curve rises in two steps, and one compressed exponential per q follows the swimmers at small q but the slow step of the other cells at large q, where the swimmers' step is over within a frame or two: its rate levels off and the slope falls well below 1. When the swimmer model has found swimmers, the dots therefore show the rate of the swimmers' step alone: d = A{1 − e−Dq2Δt[(1 − α)T(Δt) + α exp(−(ΓΔt)β)]} + B, with α, D, the turning T of the still cells and A, B from the swimmer fit, and only Γ and β fitted at each q. The solid line is the same rate from the fitted model (where its swimmer part has fallen to 1/e). For long cells it bends below a straight line at large q (see the shape of the cells), so the line is not v₀q.
The distribution of speeds can be found without assuming its shape (the motion of each swimmer is still modelled): for swimmers in 3D f(x) = ∫ dv P(v) sin(xv)/(xv) with x = qΔt, which inverts to P(v) = (2v/π) ∫ dx x f(x) sin(xv) (Lattuada et al. 2025, Eq. 58). Applied to the measured curves the integral is noisy, so the page instead finds non-negative weights on a grid of speeds (with one weight at zero speed for the cells that do not swim) that reproduce the curves of all q together, with a small penalty on sharp wiggles.
Motility report
Settings used for this run
In a real experiment
What matters
Each card sets the bench to a typical problem and shows where to look. Use "Back to the standard sample" to start again.
The organisms on this page
The Organism menu in step 1 sets up the bacteria, algae and sperm that have been measured with DDM, with the speeds, shares and strokes the papers report. Where a paper gives no value the page assumes one, and says so. Every setting can be changed afterwards.
- E. coli, wild type, smooth swimmers and paralysed cells: L. G. Wilson et al., Phys. Rev. Lett. 106, 018101 (2011); V. A. Martinez et al., Biophys. J. 103, 1637 (2012). Cells without flagella, and with glucose: A. Jepson et al., Enhanced diffusion of nonswimmers in a three-dimensional bath of motile bacteria, Phys. Rev. E 88, 041002 (2013). Cell size and strains: J. Schwarz-Linek et al., Escherichia coli as a model active colloid: a practical introduction, Colloids Surf. B 137, 2 (2016).
- E. coli in polymer solutions: V. A. Martinez, J. Schwarz-Linek, M. Reufer, L. G. Wilson, A. N. Morozov and W. C. K. Poon, Flagellated bacterial motility in polymer solutions, PNAS 111, 17771 (2014).
- E. coli powered by light: J. Arlt, V. A. Martinez, A. Dawson, T. Pilizota and W. C. K. Poon, Painting with light-powered bacteria, Nat. Commun. 9, 768 (2018).
- E. coli with tunable tumbling: C. Kurzthaler et al., Phys. Rev. Lett. 132, 038302 (2024).
- E. coli seen turning in dark field: R. Cerbino et al., Dark field differential dynamic microscopy enables accurate characterization of the roto-translational dynamics of bacteria and colloidal clusters, J. Phys.: Condens. Matter 30, 025901 (2018).
- Salmonella Typhimurium: D. Germain et al., Differential dynamic microscopy to characterize Brownian motion and bacteria motility, Am. J. Phys. (2016).
- Bacillus subtilis: P. J. Lu et al., Phys. Rev. Lett. 108, 218103 (2012), in a dense suspension, and the guide by E. Lattuada et al. (2025) below.
- Chlamydomonas reinhardtii: Martinez et al. (2012) above; for its helical path, O. A. Croze et al., Helical and oscillatory microswimmer motility statistics from differential dynamic microscopy, New J. Phys. 21, 063012 (2019).
- Euglena gracilis: M.-Y. Li et al., Detecting active Levy particles using differential dynamic microscopy, Phys. Rev. E (2025).
- Bull sperm: A. Jepson et al., High-throughput characterisation of bull semen motility using differential dynamic microscopy, PLoS ONE 14, e0202720 (2019).
Not simulated: the helical paths of algae, the Levy walks of Euglena, the time a tumble takes, and swimmers whose shape changes as they swim (the sperm tail, the flagella of the alga). We found no DDM study of deflagellated algae.
Beyond dilute swimmers
The cells on this page swim alone. DDM also studies swimmers that crowd, collide or move together:
- Dense and turbid suspensions. Confocal DDM looks inside samples too dense and turbid for an ordinary microscope; for swimming B. subtilis it found ballistic motion in the bulk and a different behaviour near the glass: P. J. Lu, F. Giavazzi, T. E. Angelini, E. Zaccarelli, F. Jargstorff, A. B. Schofield, J. N. Wilking, M. B. Romanowsky, D. A. Weitz and R. Cerbino, Characterizing concentrated, multiply scattering, and actively driven fluorescent systems with confocal differential dynamic microscopy, Phys. Rev. Lett. 108, 218103 (2012).
- Active colloids. Self-propelled Janus particles near a wall, with an exact model that includes their rotational diffusion: C. Kurzthaler, C. Devailly, J. Arlt, T. Franosch, W. C. K. Poon, V. A. Martinez and A. T. Brown, Probing the spatiotemporal dynamics of catalytic Janus particles with single-particle tracking and differential dynamic microscopy, Phys. Rev. Lett. 121, 078001 (2018).
- Run and tumble. The tumbles of E. coli measured from the patterns at small q: C. Kurzthaler, Y. Zhao, N. Zhou, J. Schwarz-Linek, C. Devailly, J. Arlt, J.-D. Huang, W. C. K. Poon, T. Franosch, J. Tailleur and V. A. Martinez, Characterization and control of the run-and-tumble dynamics of Escherichia coli, Phys. Rev. Lett. 132, 038302 (2024).
- Collective motion. Swarming bacteria and moving cell sheets, whose motion is shared by many cells over large distances.
Run and tumble is simulated here (the wild-type E. coli under Organism), but the analysis fits straight swimming and leaves the tumbles out, so they show only as a departure from the model at small q. The others are not simulated: they need cells that interact, or models the page does not include.
What this page adds to the published methods
The analysis follows Wilson et al. (2011) for straight swimmers and Martinez et al. (2012) for the stroke of algae and sperm. The steps below are not in those papers: we added them while testing the page against its own simulations, each to remove a bias or a failure we saw there. Some may exist elsewhere in the literature. At the "Addict" level each can be switched off (in their own group among the settings), and the result table shows a baseline, the published model alone as implemented here, on the same movie, next to the headline. This baseline is one implementation of the published steps, run on movies from this page's own simulation: it shows what each added step changes here, not how the published method performs in general. The simulation itself (steps 1 and 2) is ours throughout and is not part of this list.
- Camera noise known from the detector. B = 2 (excess-noise factor × mean count + read noise2), the same at every q, instead of a free B at each q, which trades against the amplitude and the rates. Step 5; cameras only.
- Shape of the cells. Wilson's model treats each cell as a point; here each direction of swimming is weighted by how a rod of the cells' length and width shows at that q. Step 6. With 50 μm Euglena the point model read the speed 40 % low, the weighted one within 1 %.
- Expected diffusion of the cells. D also tried fixed at the value expected from the size and shape of the cells and the viscosity, and kept when the data do not ask for another one; when the still cells barely move, the share of swimmers also from the amplitude. Step 6. Without it, still cells that barely move leave the share of swimmers and the amplitude free to trade.
- Turning of the cells. Rods fade from each pattern as they turn: a share b at each q, at rate 6DR for the still cells and 6Ds for the swimmers, Ds at most that of the body. A fit with no swimming at all is also tried, since turning rods alone can pass for slow swimmers. Step 6. Without it the share of swimmers came out about 8 % low where all cells swim.
- Tumbles. For cells known to tumble, the swimmers' images also fade at the tumble rate, fitted. Step 6; only for tumbling cells.
- Swimmers leave the focus. With the depth-of-field model (itself our addition: how each pattern fades as a cell moves up or down through the optics of step 1), the swimmers fade with depth as the still cells do. Step 6; used automatically in the confocal modes, or chosen under Analysis.
- Limits on the amplitude. A of each q below the whole amplitude from the mean power of the images, and below three times twice the variance in time of that pattern. Step 6. Without them a sample of dead sperm passed for 40 % slow swimmers.
- Uncertainty from the movie itself. The fits repeated five times with one fifth of the movie left out (jackknife). It changes the quoted uncertainties, not the results. Step 6. The covariance of the fit gave errors 5-8 times too small.
- Window corrections. With windowing on: the window scaled so that the mean of W2 is 1 (heights only), and the patterns below 5 steps in q left out. Step 4; only with windowing on.
Glossary
- Numerical aperture (NA)
- How wide a cone of light the objective collects, or the condenser sends: n sin(half-angle). A larger NA resolves finer details and keeps a thinner layer in focus.
- Wave vector q
- Describes a stripe pattern of the image: q = 2π divided by the stripe spacing, in µm-1. Not the wave number of the light, k = 2πn/λ.
- Structure function d(q, Δt)
- The average strength of pattern q in the difference of two frames taken Δt apart.
- Amplitude A and noise B
- A(q): how much pattern q changes once the sample has fully renewed it. B: what the camera noise adds, at every delay.
- Intermediate scattering function f(q, Δt)
- How much of pattern q is still there after a delay Δt: 1, all of it; 0, gone.
- Hydrodynamic radius
- The radius of a sphere that would diffuse as the particle or protein does (Stokes-Einstein relation).
- Self and collective diffusion
- Self: how one particle wanders among the others. Collective: how ripples in the number of particles even out.
- Mean squared displacement
- The average of the squared distance the particles travel in a given time.
- Storage and loss moduli G', G''
- How elastic and how viscous a material is, at an angular frequency ω (rad/s; the frequency in hertz is ω/2π).
- Molar mass M
- The mass of one mole of a protein, in g/mol; a protein of 148 kDa has M = 148 000 g/mol.
- Second virial coefficient
- How two molecules interact, on balance: B2 per pair of molecules (a volume), A2 = B2NA/M2 per gram (mol mL/g2), with NA Avogadro's number. Positive: they keep apart; negative: they attract.
- Diffusion interaction parameter kD
- How fast collective diffusion changes with the concentration: D = D0(1 + kDc). It holds the interactions and the drag of neighbours through the liquid.
About this tool
This page is a simple tool, generated with Claude Opus 5.5, that simulates a realistic motility assay in which DDM measures how fast cells swim. The microscope, light sources, cameras, spinning disk and point scanner are modelled mostly on the instruments of our SoMeX lab. The cells do not interact with each other: each one swims or diffuses on its own, so every sample is a dilute suspension. The aim is not to produce accurate, research-quality data, but to give anyone thinking of using DDM an idea of the many options and of how each one affects a DDM experiment.
If you find something that looks wrong or does not work, please let us know through the contact page.
To cite this page: R. Cerbino, DDM, hands on: swimming cells, rcerbino.github.io/ddm/swimmers/ (2026), with the date you used it.
Go further
- Research: what the SoMeX group measures with DDM, from colloids to living cells and experiments in space.
- Talks, including public lectures.
- Switch to Student above for the equations behind each step.
- L. G. Wilson, V. A. Martinez, J. Schwarz-Linek, J. Tailleur, G. Bryant, P. N. Pusey and W. C. K. Poon, Differential dynamic microscopy of bacterial motility, Phys. Rev. Lett. 106, 018101 (2011). The motility assay simulated here.
- V. A. Martinez, R. Besseling, O. A. Croze, J. Tailleur, M. Reufer, J. Schwarz-Linek, L. G. Wilson, M. A. Bees and W. C. K. Poon, Differential dynamic microscopy: a high-throughput method for characterizing the motility of microorganisms, Biophys. J. 103, 1637 (2012). The method in detail, with its limits.
- R. Cerbino and V. Trappe, Differential dynamic microscopy: probing wave vector dependent dynamics with a microscope, Phys. Rev. Lett. 100, 188102 (2008). The paper that introduced DDM.
- E. Lattuada, F. Krautgasser, M. Lavaud, F. Giavazzi and R. Cerbino, The hitchhiker's guide to differential dynamic microscopy, J. Chem. Phys. 163, 161501 (2025). A practical guide with the notation used here, including swimming bacteria (section V B).
- F. Giavazzi, P. Edera, P. J. Lu and R. Cerbino, Image windowing mitigates edge effects in differential dynamic microscopy, Eur. Phys. J. E 40, 97 (2017). The windowing switch under Analysis.
- A complete notebook for this page (read it here, download it, or open it in Google Colab): from the downloaded movie (step 2) to the mean speed and the share of swimmers, with numpy and scipy, every input and step written out. It fits the published model of Wilson et al. (2011) alone, this page's baseline: on the standard movie it finds 19.6 µm/s and 64 % swimmers (as the microscope sees the simulated cells: 20.2 µm/s and 67 %); it leaves out the shape of the cells, the depth of field and the jackknife.
- Exercises with model answers for this page: questions to predict, compute and discuss, printable, for a class or on your own.
- fastDDM tutorial notebooks on real movies of bacteria: tutorial 8; all tutorials.
- fastDDM (Python, CPU and GPU, GPL 3.0):
pip install fastddm. Documentation. - Planned for this page: load your own movie and analyse it here, on your computer, with nothing uploaded.
- For collaborations or questions about applying DDM to your samples, see Contact.