Differential dynamic microscopy

How does a crowd of particles move?

Fill a liquid with particles and each one ends up in a cage of neighbours: the crowd takes on a typical spacing, and it moves differently from particles on their own. Differential dynamic microscopy (DDM) reads both the order and the motion from one microscope movie (Lu et al. 2012); here you can check what it finds on a simulated crowd.

Try this first: what changes when only a few particles are dyed? Predict, then watch the page check it.

How deep do you want to go?
Simulating the movie...
Live simulated confocal movie

Hands on

The bench

Choose how crowded the sample is and how the particles interact, then the microscope and the camera (controls on the left, or just below on a phone). The particles are simulated one small step at a time, pushing each other, so a run takes from ten seconds to a minute. "Copy a link to this setup" gives an address that opens the bench with the same settings.

1

Set up the microscope

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. In a crowd the particles above and below the focus would blur into a haze: a confocal microscope, whose pinholes keep only a thin layer in focus, sees the crowd one layer at a time.

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, and how the particles move

As on the sizing page: each dyed particle is convolved with the point spread function of the microscope (fluorescence and confocal), or its scattered light interferes with the transmitted light (bright field and the other transmitted-light modes). Each frame is the sum of the images of the dyed particles at their positions, with the detector's pixel size, quantum efficiency, shot noise, read noise and full well. Undyed particles push like the others but do not show.

Motion. Brownian dynamics in a box that repeats sideways and in depth (no walls). At each time step h every particle gets a random kick of variance 2D0h along x, y and z, with D0 = kBT / 3πησ, plus the push of its neighbours; then any two spheres that overlap are moved apart along the line of their centres (Heyes and Melrose 1993). Charged spheres also repel with a screened Coulomb (Yukawa) potential,

U(r) / kBT = U0 σ e−κ(r − σ) / r,    r > σ

with 1/κ the Debye length. The free kicks are 3 % of the diameter, and the repulsion moves a particle by no more than that where it is 10 kBT. The particles start at random, are pushed apart, and wander for one Brownian time τB = σ2/D0 before the movie starts. The liquid between them is not simulated: no hydrodynamic interactions (see What matters). The true S(q) shown below is computed from the positions of all particles at eight moments of the movie.

2

Record a movie

32-bit, photoelectrons per pixel; opens in ImageJ, Fiji and fastDDM.

A second movie of the same particles, dilute (4 %), is recorded with the same microscope and camera, long enough for them to wander through the whole chamber: it tells how strong the pattern of one particle alone is, and how fast it fades. It is not shown. Here the reference particles do not interact at all, by construction. A real reference must be dilute enough for its own structure to be negligible at the accuracy wanted (at 4 % real hard spheres already have S(0) of about 0.7), or that structure must be corrected for. The page also knows how many dyed particles each movie holds; in an experiment that comes from the concentrations of the two samples, or from counting particles in the images.

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 structure function below is the same as fastDDM's. With your own movies (the sample and the dilute reference) you would start from the image files:

import fastddm as fd
img_seq = fd.read_images(file_names)
ref_seq = fd.read_images(reference_file_names)
3

Subtract two frames

Subtract a frame from one taken a little later. Everything that stays still cancels out; what is left is what moved, plus the camera noise.

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
ΔI(x; t, Δt) = I(x, t + Δt) − I(x, t)
4

Split it into stripe patterns

Strength of each pattern in the difference (click it, or use the sliders)
The pattern you picked
How much of each pattern is left
-10, gone1, all there

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 centre of the map holds wide stripes, the edge fine ones.

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.

In a crowd each pattern is a wave of density: more particles along the bright stripes, fewer along the dark ones. A pattern whose spacing matches the distance between neighbours fits the crowd's own order, so it is strong; wide patterns would need many particles to bunch up, which the crowd resists, so they are weak. The map does not show this order directly: the image of each particle, which fades at fine patterns, weighs on it more. Step 6 divides it out, using the dilute movie.

The second map shows how much of each pattern is left after the delay: red where it is still all there, the colour of the page where it has faded.

The dashed circle on the strength map 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: structure function of a crowd

For N identical dyed particles,

d(q, Δt) = ⟨ |F[ΔI](q; t, Δt)|2 ⟩ = A(q) [1 − f(q, Δt)] + B,    A(q) = 2N |K(q)|2 S(q)

with K the image of one particle (the optics of step 1), S(q) the structure factor, and f(q, Δt) = F(q, Δt) / S(q) the normalised collective intermediate scattering function, where F(q, Δt) = N−1 Σj,k ⟨exp{iq·[rj(Δt) − rk(0)]}⟩. With only a share x of the particles dyed, S becomes 1 + x(S − 1): with few dyed, only the terms j = k are left, and f follows single particles (self diffusion). Map axes: qx to the right, qy up.

fastDDM's fd.ddm(img_seq, lags) works on evenly spaced frames: its lags count frames. With log-spaced frames (the standard here; "Download the movie" and "Frame times" give both files), the frames are paired by their times instead. This routine does it as the page does; on an exported movie it gives the same delays and d(q, Δt), apart from a few pairs that fall exactly on the edge between two groups of delays:

import numpy as np, tifffile

frames = tifffile.imread("movie.tif").astype(np.float64)       # T x n x n, from "Download the movie"
t = np.loadtxt("movie-times.csv", delimiter=",", skiprows=1)[:, 1]   # time of each frame (s), from "Frame times"
pixel_um = 0.1083                                             # pixel size in the sample (um) of this setup (step 2): change it with the objective or the binning

T, n, _ = frames.shape
F = np.fft.fft2(frames)                                        # one transform per frame
dt = np.diff(t).min()                                          # shortest interval between frames

# every pair of frames up to half the movie apart, grouped by its delay: one group per whole number of
# shortest intervals up to 10, then 12 groups per decade; at most about T pairs per group, spread over the movie
i, j = np.triu_indices(T, 1)
gap = t[j] - t[i]
keep = gap <= (t[-1] - t[0]) / 2 * (1 + 1e-12)
i, j, gap = i[keep], j[keep], gap[keep]
u = np.round(gap / dt, 6)                                      # delay in shortest intervals (rounded: no float noise at the group edges)
group = np.where(u < 10.5, np.round(u) - 1, 10 + np.floor(12 * np.log10(u / 10.5))).astype(int)
taus, d2d = [], []
for g in np.unique(group):
    sel = np.flatnonzero(group == g)
    sel = sel[:: int(np.ceil(len(sel) / T))]
    if len(sel) < 4:
        continue
    acc = np.zeros((n, n))
    for a, b in zip(i[sel], j[sel]):
        acc += np.abs(F[b] - F[a]) ** 2
    taus.append(gap[sel].mean())                               # the delay of this group (s)
    d2d.append(acc / len(sel) / n**2)                          # d(q, dt) on the Fourier map
taus = np.array(taus)

# azimuthal average: rings of whole wave numbers, central cross left out (as fastDDM's central_cross_mask)
k = np.fft.fftfreq(n) * n
kx, ky = np.meshgrid(k, k)
ring = np.rint(np.hypot(kx, ky)).astype(int)
ring[(kx == 0) | (ky == 0) | (ring > n // 2)] = 0
count = np.bincount(ring.ravel(), minlength=n // 2 + 1)
dq = np.array([np.bincount(ring.ravel(), m.ravel(), n // 2 + 1) / np.maximum(count, 1) for m in d2d])[:, 1:]
q = 2 * np.pi * np.arange(1, n // 2 + 1) / (n * pixel_um)     # um^-1

With evenly spaced frames (log-spaced frames switched off), fastDDM does the same:

dqt = fd.ddm(img_seq, range(1, len(img_seq) // 2))   # lags in frames
dqt.pixel_size = 0.1083        # um, the pixel of this setup (step 2)
dqt.set_frame_rate(100)     # frames per second of this setup: sets the delays in seconds
aa = fd.azimuthal_average(dqt, bins=bins, range=(0, dqt.ky[-1]))
5

Watch each pattern change

For each stripe spacing, follow how much of the pattern is left as the delay grows. In a dilute sample fine stripes (red) fade first and wide ones (blue) last, each at the rate set by one particle diffusing. In a crowd with all particles dyed this order breaks down: wide patterns fade faster than one particle alone would make them, and the pattern at the spacing of neighbours more slowly, because changing it means rearranging the cages.

The points are measured: how different two frames a delay apart look, with the camera noise taken away and divided by the full change, then turned around so that 1 means the whole pattern is still there and 0 that it is gone.

The points are f(q, Δt) = 1 − (d − B) / A. The dashed lines are exp(−ΓΔt), with Γ the rate at which each pattern starts to fade, from the first delays (step 6). The order of the analysis. d is measured first; B comes from the camera and A from the mean power of each pattern; the points follow, and Γ is read from their first delays.

Things that never move vanish from the differences of step 3, but not from the full strength of each pattern, which the page needs in order to tell how much has changed. In a real sample dust or uneven light would bias that strength; a movie of the background, taken the same way, corrects for it.

The numbers behind this chart: how much of each pattern is left against the delay
Predict first: the volume fraction goes from 30 % to 45 %. Does the pattern at the spacing of neighbours fade faster or more slowly?

What this step gives: how fast each pattern fades in a crowd. The order of the curves shows where the crowd resists change.

6

Structure and collective motion

How strong each pattern is, compared with the same particles far apart, tells how the crowd is arranged (the structure factor). It is highest at the spacing of neighbours and low for wide patterns, because a crowd is hard to squeeze. How fast each pattern starts to fade, compared with one particle alone, tells how the crowd moves (collective diffusion): slowest at the spacing of neighbours, fastest for the widest patterns.

How strong each pattern is, against the same particles far apart, is the structure factor S(q): the order of the crowd. It peaks at the spacing of neighbours, about 2π / q, and is low for wide patterns, because a crowd is hard to compress. The rate at which each pattern starts to fade, against one particle alone, gives the collective diffusion D(q): roughly D0 / S(q), slowest at the peak (de Gennes narrowing) and fastest for the widest patterns.

Both come out as ratios to the dilute reference movie (described under the movie, step 2): the optics, which make each particle's pattern weaker at fine stripes and add motion along the axis of the microscope, largely cancel out. Small biases remain; the notes under the charts say where.

How the particles arrange: the structure factor
    What changes when only a few particles are dyed? Predict first: same crowd, but only one particle in twenty is dyed. What happens to the peak measured from the dyed particles?
    How fast each pattern starts to fade: collective diffusion
      The numbers behind this chart: collective diffusion coefficient against q
      Signal A(q) of this movie and camera noise B(q). A holds both the image of each particle and the order of the crowd (S(q)). More averaging is needed as it gets small next to B; the checks of this step decide which patterns are kept.
      The numbers behind this chart: signal and noise amplitudes
      What the analysis is told, and what it finds

      Told (inputs): a second, dilute movie of the same particles, filmed the same way; the number of dyed particles in each movie; the diffusion coefficient of one particle alone, D0 (from its size and the viscosity), to give D(q) in units; the pixel size, the times of the frames and the camera noise.

      Found from the movie: S(q), from the amplitudes of the two movies, and D(q)/D0, from their rates.

      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: the amplitudes and the rates of the patterns, as ratios to a dilute movie of the same particles: S(q), and an effective collective diffusion D(q) read over the first delays, a little below the value at the very first instant. Turning the ratios into S(q) and D(q) assumes that the reference adds the same optics; collective diffusion is meaningful with hydrodynamic interactions too (D(q) = D0 H(q) / S(q)), but this simulation has none (H = 1), so here it should approach D0 / S(q).

      A question to think about: With few particles dyed the measured structure factor is flat. What about the invisible neighbours is unchanged, and where in the plots can you still see them?

      Their arrangement: the crowd is as ordered as with all particles dyed, and the measured S(q) is 1 + x [S(q) - 1], flattened by the share x of dyed particles. You still see the neighbours in D(q): each dyed particle moves more slowly than alone, because its cage of invisible neighbours holds it back.

      The math: from the curves to S(q) and D(q)
      S(q) = [A(q) / N] / [Aref(q) / Nref]
      Γ(q) = −d ln f / dΔt at short times = D0 q2 H(q) / S(q),    D(q) = D0 Γ(q) / Γref(q)

      Amplitudes. A(q) = 2⟨|F(q)|2⟩ − B, from the mean power of each pattern, with B = 2 (excess-noise factor × mean count + read noise2), the camera noise, the same at every q. The mean power counts everything in the image that stays put during the movie, dust and uneven light included, which the difference images of step 3 ignore. The simulated movies have none. In a real experiment, subtract the power of a movie of the liquid alone, taken the same way, or use twice the variance over time of each pattern, which leaves out what never changes (fine for a crowd that flows, as here). The reference is a movie of the same particles at a volume fraction of 4 %, without interactions, through the same optics, long enough for its particles to wander through the whole depth of the box twice (the number near the focus sets the amplitude); Aref and its rates are smoothed over seven neighbouring q. Only q where both movies carry more signal than B are used. The uncertainty of S(q) is the scatter of seven neighbouring q about a parabola through them.

      Rates. At each q, a straight line through ln f against the delay, weighted by the noise of f, from the first delay down to f = 0.6 (at least three delays); its slope is −Γ. The same line through the reference movie gives Γref = D0q2 plus what motion along the axis adds: particles leaving the layer in focus change the patterns too. Their ratio, times D0, is what the page measures; the axial part largely, but not entirely, cancels in it (see below). It is read as the effective collective diffusion D(q) = D0H(q)/S(q) over the first delays, assuming that the reference adds the same axial part; in this simulation H = 1. Uncertainties from a jackknife over ten parts of the movie. Without hydrodynamic interactions the hydrodynamic function H(q) is 1. For hard spheres, the Percus-Yevick structure factor (Wertheim 1963) is drawn for comparison.

      What the page does not fix. Each pattern of the image collects particles over the depth in focus, so it mixes in wave vectors along the axis: at the widest patterns S(q) and D(q) take in some of their neighbours at larger q, and the peak looks a little lower and broader. The short-time rate needs delays before the cages are felt; the fit reaches a little beyond them.

      Settings used for this run
      
                

      In a real experiment

      What matters

      Each card sets the bench to a typical case and shows where to look. Use "Back to the standard sample" to start again.

      What this page adds to the published methods

      Lu et al. (2012) measured S(q) of concentrated colloids with confocal DDM, as the ratio of the amplitude to that of a dilute sample, and the collective dynamics from f(q, Δt). The steps below are not in the papers we cite: we added them while testing the page against its own simulations, and some may exist elsewhere. At the "Addict" level each can be switched off, and the result table shows a baseline: the published steps alone, as implemented here, on the same movies (B from the first delays, rates from a line through f = 1, D(q) = Γ / q², the reference bin by bin). 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 reference itself is recorded long enough for its particles to wander through the whole depth of the sample twice: with a short one the peak of S(q) came out 5-7 % low in our tests.

      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 microscopy experiment in which DDM is used to measure the structure and the collective motion of a concentrated suspension. The microscope, light sources, cameras, spinning disk and point scanner are modelled mostly on the instruments of our SoMeX lab. The particles are identical spheres that push each other by touching or by a screened charge repulsion, in a small box that repeats in every direction; the liquid between them is not simulated, so there are no hydrodynamic interactions. The aim is not to produce research-quality data, but to give anyone thinking of using DDM an idea of what it can see in a crowd, and of what limits it.

      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: crowded particles, rcerbino.github.io/ddm/crowded/ (2026), with the date you used it.

      Go further