Particles carried by a flow, by gravity or by heat
Particles in a liquid jiggle at random, but they can also be carried in one direction: by a flow of the liquid, by gravity when they are denser than the liquid, or by a temperature gradient, which pushes most colloids towards the cold side (thermophoresis). Differential dynamic microscopy (DDM) sees both motions in the same movie. The random part makes each stripe pattern fade; the drift makes it travel, so patterns along the drift fade and oscillate at the same time. Here a simulated microscope lets you measure the speed and the direction of the drift, and find out how slow a drift a movie can still show.
Simulating the movie...
Live simulated bright-field movie
Hands on
The bench
Choose what carries the particles, then the sample, the microscope and the camera (controls on the left, or just below on a phone). The movie is recorded again and every step below updates. "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. For a drift the size of the field matters more than usual: the widest stripe pattern the image holds is what shows a slow drift first.
A microscope usually stands upright, with its optical axis vertical. Gravity then pulls the particles along the axis, where DDM does not look. Laid on its side, with the axis horizontal, gravity points down the image.
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
As on the sizing page: the light scattered by each sphere (Mie theory) interferes with the transmitted light through the condenser and objective apertures (bright field, phase contrast, dark field, DIC), or the dyed sphere is convolved with the point spread function (fluorescence and confocal). Each frame is the sum of the images of all particles at their positions, with the detector's pixel size, quantum efficiency, shot noise, read noise and full well.
Motion. Each particle diffuses in 3D with the Stokes-Einstein coefficient D = kBT / (3πηd) and is carried by a drift v: in the image plane (a flow, sedimentation with the microscope on its side, a temperature gradient across the image) or along the axis (sedimentation with an upright microscope, a gradient along the axis, with reflecting walls). A flow pushed through the chamber has the Poiseuille profile v(h) = 6 v̄ h(H − h) / H2, with v̄ its mean over the chamber of thickness H. The particles do not interact, and they do not change the flow.
2
Record a movie
32-bit, photoelectrons per pixel; opens in ImageJ, Fiji and fastDDM.
Particles that leave the image on one side come back on the other: the simulated field repeats like a tile, as the Fourier transform assumes.
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 movie you would start from the image files:
import fastddm as fd
img_seq = fd.read_images(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
-1, reversed0, gone1, all there
How far each pattern travelled (phase)
0+π/2±π−π/20
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.
Without a drift the map is round: the particles wander equally in all directions. A drift makes the patterns along it travel. After the delay, a pattern that moved by exactly one stripe looks as before and almost cancels in the difference; one that moved by half a stripe is reversed and shows twice as strongly. So the map is crossed by dark and bright fringes at right angles to the drift, closer together for a faster drift or a longer delay. Move the delay slider and watch them close in.
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, blue where it came back reversed, a value below zero. Among the causes on this page only a drift can turn a pattern around: carried by half a stripe, a pattern swaps bright and dark: the value first turns negative after a shift of a quarter of a stripe, stays negative up to three quarters, and turns positive again as the shift nears a whole stripe, while diffusion weakens it all along. (Cells swimming in all directions can do it too, on the swimmers page.)
Each pattern has a direction: across its stripes, from one bright stripe to the next (the direction of q). A pattern along the drift has stripes that the drift crosses at right angles, so it is carried away; a pattern across the drift has stripes parallel to it, which the drift only slides along without changing them.
How strong a pattern is cannot tell which way it was carried: a shift to the right and one to the left change it equally. Where the pattern sits within its cycle can, as the animation below shows. That position is called the phase: it advances when the pattern moves one way and goes back when it moves the other. Step 6 reads the drift, and its direction, from the phase of all the patterns.
The same pattern carried to the right (top) and to the left (bottom). The dotted line stays put; the dial shows where a bright stripe is within its cycle, the phase. Its strength is the same in both rows; its phase turns opposite ways.
The dashed circle on the strength map marks the finest pattern the objective can resolve.
The difference image cannot tell a drift to the right from one to the left: the fringes are the same for both. The phase of each pattern can. Comparing the Fourier transform of a frame with that of a later frame, each pattern has moved along by a phase, and the phase map (colour wheel) shows it: the colours run along the drift and turn faster for finer stripes. Reverse the flow and the colours run the other way. Faint colours: patterns already faded.
Predict first: the flow is reversed. Does the strength map (top left) change?
No. The difference only keeps how far each pattern travelled, not which way, so the fringes stay where they are. The phase map (Student level) turns its colours around. The bench now runs with a flow in the opposite direction.
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 and cross spectrum with a drift
A particle carried by a drift v while it diffuses multiplies the Fourier transform of the image by e−iq·vΔt as well as letting it fade. For independent particles
The fringes in d are the lines cos(q·vΔt) = 1, spaced 2π / (vΔt) along v. The normalised map is f = 1 − (d − B) / A = e−Dq2Δt cos(q·vΔt), between −1 and 1. The cosine is even in v, so d gives the speed and the line of the drift but not its sign. The phase of C is −q·vΔt, sign included; the camera noise, uncorrelated between frames, drops out of C at Δt > 0. The phase map shows arg C, with its brightness set by |C| / (A/2). Map axes: qx to the right, qy up.
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(20) # frames per second of this setup: sets the delays in seconds
# dqt.data[k] is d(q, dt) on the full (qy, qx) plane: with a drift, keep
# it 2D (or average in sectors of direction) instead of along circles
5
Watch each pattern change, in two directions
For each stripe spacing, follow how much of the pattern is left as the delay grows (curves drawn for four of the wider spacings). Patterns across the drift (stripes parallel to it) are not moved by it: they only fade, as without a drift. Patterns along the drift fade at the same rate but also travel, so the curves swing below zero and back before they die out. Fine stripes swing sooner, because the drift needs less time to carry them by one spacing; but they also fade sooner, and may be gone before they swing. Patterns almost across the drift are carried a little too, so with a fast drift even their curves dip below zero at long delays.
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 lines are drawn with the diffusion and the drift found in step 6, so they show that those two numbers describe the points; the comparison with the simulated drift in step 6 shows whether they are right.
The curves are f(q, Δt) = 1 − (d − B) / A averaged over the directions of q within 15° of the drift (left) or of the direction across it (right). The lines are the model e−Dq2Δt cos(q·vΔt), with the D and v of the result, averaged over the same directions: across the drift q·v is small but not zero, so at long delays even those curves dip below zero when the drift is fast. The order of the analysis.d is measured first; B comes from the camera and A from a fit of each curve; the points follow. D and v come from step 6, so the lines test only that they describe the points; the comparison with the simulated drift tests the result.
Along the driftAcross the drift
What this step gives: curves along and across the direction of motion (along x and y of the image when no drift is found). A swing below zero is a drift showing in the structure function itself; without a swing a drift can still be in the phase.
6
From the curves to the drift
Each pattern gives two numbers: how fast it fades, and how fast it swings along the drift. Fading comes from the random motion: halving the stripe spacing makes it four times faster, a line of slope 2 on these logarithmic axes. Swinging comes from the drift: halving the spacing makes it only twice as fast, a line of slope 1. The height of the first line gives the diffusion coefficient, and from it the size; the height of the second gives the speed.
The two lines cross where the drift and diffusion act equally fast (for fast drifts, beyond the right edge of the plot). Where they cross, the drift shifts each pattern by one radian of its cycle, about a sixth of a stripe, in the time diffusion takes to renew it. To their left the shift is larger, and once it passes a quarter of a stripe before the pattern fades, the curves swing below zero. To their right diffusion wins and no curve swings, but the drift is still there: each pattern is carried a little before it fades, and the page measures this small shift from the phase of the pattern, averaged over all patterns and the whole movie. As with tracking, a slow drift then only takes a longer movie (four times longer halves the noise) or a wider field. The result says how slow a drift this movie can show.
The numbers behind this chart: rates of fading and of swinging against wave vectorSignal A(q) and camera noise B(q) of the patterns used. A falls at high q because the optics blur fine patterns. As the signal becomes small next to the camera noise, more averaging is needed: a pattern is usable as long as its amplitude and its changes can be estimated reliably, and the checks of this step decide which are kept. A signal below the noise is not unusable as such: on the proteins page it is far below it and still gives the diffusion coefficient.The numbers behind this chart: signal and noise amplitudes
Predict first: 200 nm polystyrene beads settle at about 1 nm/s, with the microscope on its side. What will the page report?
Too slow for this movie. In this movie a drift of 1 nm/s and no drift at all look the same, so the page does not claim the beads stand still: it gives the slowest drift this movie could show, and a slower one is not ruled out, only not seen. The bench now runs with these beads; the result above says where the limit is.
The drift seen by patterns of each direction: the same fit as the velocity, with only the patterns within 7.5° of each direction, gives the speed along q, which should be v cos(θ − θv): largest along the drift, zero across it and negative beyond. Error bars: jackknife over groups of q. The line is the result.
Predict first: you double the flow speed. Do the dots (the fading rates) move?
No. Fading comes from diffusion alone, which does not care about the flow: the dots stay on the same line, and the size does not change. The squares (swinging) move up by a factor two, and the crossing of the two lines moves to finer stripes, so the drift shows in more patterns. The bench now runs with twice the speed (at most 20 µm/s, the end of the slider).
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 optics of the microscope, for the depth-of-field correction.
Found from the movie: the diffusion coefficient and the drift velocity, its size and direction. Naming the cause, and comparing the speed with a flow, a sedimentation speed or a Soret coefficient, uses what is known about the particles and the liquid.
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 drift velocity and the diffusion, measured from how the patterns fade and shift. Which cause carried the particles, a flow, gravity or a temperature gradient, is an interpretation, made with what is known about the particles and the liquid.
A question to think about: Two samples give the same strength map, but in one the flow goes left and in the other right. Which measurement tells them apart?
The strength map only shows how much each pattern changed, which is the same for opposite flows. The phase is not: a pattern carried to the left shifts its phase one way, carried to the right the other way. The page reads the direction from the phase of all patterns (step 6); at the Student level the second map of step 4 shows it.
The math: fading, swinging, and when a drift can be seen
Γ(q) = D q2, ω(q) = q v (along v) ⇒ dh = kBT / (3πηD)
The two rates are equal at q* = v/D. A pattern along the drift swings when qvΔt reaches about 1 before diffusion has erased it, Dq2Δt of about 2: that is for q below 2v/D, and above 1/(vΔtmax) for the longest delay of the movie. The widest pattern of the image has q = 2π/L, so patterns swing only if the Peclet number over the field, v L/D, is above π; the analysis starts at q = 4π/L, which raises this to about 2π. The structure function alone needs this. The phase of C does not: the page reports a drift when its speed is more than three times its uncertainty (uncertainty per component; as the uncertainty is itself estimated from the movie, a few percent of movies without a drift may show one by chance).
Velocity. The phase of the Fourier transform carries the drift, as in phase differential microscopy (phiDM: Colin, Zhang and Wilson 2014, used with DDM by Richards, Martinez and Arlt 2021), which fits the phase steps between consecutive frames of the widest patterns. Here a first guess comes from the phase difference between neighbouring pixels, which does not wrap, refined by a fit of the phase of C where it has not wrapped. Then, for the current v, each C is turned back, z = C eiq·vΔt, so that Im z = −aq·δv Δt + noise, with a the part of the pattern still there, taken as the mean of Re z over the pixels of the same q. The correction δv follows by weighted least squares over all pixels and all delays, each q used from the shortest delay until its pattern has faded below a tenth of A/2; the weights are 1/(noise variance of Im z), estimated from the scatter between the pixels of each q. The fit is repeated until v no longer changes, also from a start at v = 0. In this fit no phase is taken, so phases of a few hundredths of a radian, far below a full swing, still count: the drift is found like the mean displacement in tracking, by averaging small shifts over many patterns. The slowest drift a movie can show is three times the uncertainty below; in our simulations the uncertainty falls as one over the square root of the duration of the movie. The uncertainty adds two jackknifes in quadrature, the fit repeated with one part left out each time: over ten parts of the movie (noise from frame to frame; at about ten of the delays) and over eight interleaved groups of q (the arrangement of the particles, which the widest patterns keep through the whole movie, so parts of one movie share it). Against new movies this was on the safe side by up to 1.45 times. With a window (Analysis), each frame first loses its own mean brightness: through the window the bright, unchanging background would otherwise add to every pattern a part that never fades. D then comes from a fit of d over 12 sectors of direction with v fixed, A free at each q, B from the camera, and the depth of field as on the sizing page (particles that diffuse up or down also fade from each pattern). The fits of Γ and ω at each q (the plot) are for the eye and for the scatter of D.
Sedimentation. Stokes: vs = (2/9) Δρ g a2 / η, with a the radius. From the measured vs and D (which gives a), Δρ = 9ηvs / (2g a2). Thermophoresis.v = −DT ∇T, and the Soret coefficient is ST = DT/D; positive ST sends the particles to the cold side. For polystyrene beads ST grows with temperature and changes sign near 5-15 °C for beads larger than about 50 nm in radius (Iacopini, Rusconi and Piazza 2006; Braibanti, Vigolo and Piazza 2008). In a gradient along the axis the particles pile up against one wall within 1/(ST |∇T|).
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
A drift shows in the phase of the Fourier transform of the images: phase differential microscopy (phiDM; Colin, Zhang and Wilson 2014) measures it from the phase steps between consecutive frames of the widest patterns, and Richards, Martinez and Arlt (2021) used it together with DDM. Fits of the structure function with its cos(q·vΔt) term are also used; they need the patterns to swing and give no sign. The steps below are not in the papers we cite: we added them while testing the page against its own simulations. Some may exist elsewhere in the literature. At the "Addict" level each can be switched off, and the result table shows a baseline: the published steps alone, as implemented here, (phiDM for the velocity, B fitted at each q, no depth of field) on the same movie. 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.
Velocity from all delays and all q. Instead of the phase steps between consecutive frames of the widest patterns, the cross spectrum 〈F(q, t + Δt) F*(q, t)〉, turned back by the current v, has its imaginary part fitted at every q and every delay while the pattern is still there, each q weighted by its own noise. Step 6. For 200 nm beads at 2 µm/s phiDM scattered by about 1.5 µm/s between movies, this fit by 0.06; for the 1 µm beads of the standard sample 0.1 and 0.01 µm/s. The structure function alone gave 2.9 µm/s for 2, and 1.4 µm/s for a sample with no drift at all. A drift of 0.3 µm/s, which makes no pattern swing (vL/D = 5), was found in a movie of 512 frames at 2 per second.
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. Step 6.
Uncertainty from the movie itself. The velocity fit repeated with one tenth of the movie left out, and with one of eight interleaved groups of q left out (jackknifes), added in quadrature; speed and direction from each repetition. Step 6. Either one alone came out too small in some of our simulations (up to three times for parts of the movie, because the widest patterns keep the same particles through the whole movie).
Depth of field in the fit of D, as on the sizing page. Step 6. Without it, 200 nm beads at 20x read about 3 % small.
Windowing without the background. With a window, each frame first loses its own mean brightness. Step 4; only with windowing on. Without it the bright background leaked through the window into every pattern and the speed read zero.
How slow a drift the movie can show, said in words: three times the uncertainty of the speed, and what lowers it. Step 6.
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 study colloidal particles that diffuse and drift. The microscope, light sources, cameras, spinning disk and point scanner are modelled mostly on the instruments of our SoMeX lab. The particles are spheres that do not interact with each other, so every sample is a dilute suspension; the thermophoretic values come from the measurements cited on the page. The aim is not to produce research-quality data, but to give anyone thinking of using DDM an idea of what a drift does to a DDM experiment, and of when it can be measured.
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: drifting particles, rcerbino.github.io/ddm/drift/ (2026), with the date you used it.
Go further
Sizing particles: the same movie without a drift, and how the size follows from the motion.
R. Colin, R. Zhang and L. G. Wilson, Fast, high-throughput measurement of collective behaviour in a bacterial population, J. R. Soc. Interface 11, 20140486 (2014). Phase differential microscopy: the drift of a whole population from the phase of the Fourier transform, almost an order of magnitude more precise than particle tracking in their tests.
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 velocity, its direction and D, with numpy, every input and step written out. On the standard movie it finds 10.00 µm/s to the right and D = 0.468 µm2/s (this page: 0.461); it leaves out the depth of field and the jackknifes.