Papers
Topics
Authors
Recent
Search
2000 character limit reached

fastDDM: Efficient DDM Analysis

Updated 6 July 2026
  • fastDDM is an open-source software for Differential Dynamic Microscopy that processes time-lapse images to compute the image structure function.
  • It employs both direct pairwise-difference and FFT-based algorithms with Python, C++, and CUDA backends to optimize computational efficiency.
  • Benchmarks demonstrate that fastDDM can reduce analysis times by up to four orders of magnitude, making it ideal for large datasets.

fastDDM is an open-source software package for Differential Dynamic Microscopy (DDM), introduced in the tutorial literature as the computational component that turns DDM into a practical, high-throughput analysis workflow for time-lapse microscopy data (Lattuada et al., 7 Jul 2025). Its core function is to process image sequences and compute the DDM image structure function D(q,Δt)D(q,\Delta t), from which the intermediate scattering function f(q,Δt)f(q,\Delta t) and system-specific dynamical parameters are typically extracted by fitting. In the setting described for DDM, the method uses conventional microscopy with a digital camera to obtain time- and wavevector-resolved information analogous to multi-angle Dynamic Light Scattering (DLS), while retaining the spatial flexibility of imaging; fastDDM is designed to lower the technical barrier to this analysis and, on typical datasets of 10,000 frames, can reduce analysis times by up to four orders of magnitude (Lattuada et al., 7 Jul 2025).

1. Position within differential dynamic microscopy

Differential Dynamic Microscopy has, over nearly two decades, become a standard technique for extracting dynamic correlation functions from time-lapse microscopy data, with applications spanning colloidal suspensions, polymer solutions, active fluids, and biological systems (Lattuada et al., 7 Jul 2025). In its most common implementation, an image sequence is acquired with a conventional microscope equipped with a digital camera, and the temporal evolution of Fourier modes of the image intensity is analyzed as a function of wavevector. This yields dynamical observables directly comparable to those of DLS, including diffusive relaxation rates Γ(q)\Gamma(q) and diffusion coefficients DD, but in a microscopy-native framework.

Within that workflow, fastDDM serves as the software layer that processes large image stacks efficiently. The input is a time-lapse sequence of images, typically 16-bit, with benchmark examples using 512×512512\times 512 pixels and sequence lengths from a few dozen frames up to at least N=16384N=16384 frames (Lattuada et al., 7 Jul 2025). The accessible wavevector range is determined by pixel size, magnification, and the Nyquist condition. For isotropic samples, the two-dimensional Fourier information is ordinarily reduced by azimuthal averaging to a scalar q=qq=|\mathbf q|, which is the conventional representation used in most downstream fitting and interpretation.

2. Central observables and formalism

The principal quantity computed by fastDDM is the image structure function

D(q,Δt)=i~(q,t+Δt)i~(q,t)2t,D(\mathbf q,\Delta t)=\left\langle \left|\tilde i(\mathbf q,t+\Delta t)-\tilde i(\mathbf q,t)\right|^2\right\rangle_t,

where i(r,t)i(\mathbf r,t) is the image intensity, i~(q,t)\tilde i(\mathbf q,t) its spatial Fourier transform, f(q,Δt)f(q,\Delta t)0 the lag time, and f(q,Δt)f(q,\Delta t)1 a temporal average. For isotropic systems, the standard reduction is

f(q,Δt)f(q,\Delta t)2

The structure function is related to the intermediate scattering function through

f(q,Δt)f(q,\Delta t)3

where f(q,Δt)f(q,\Delta t)4 is an amplitude term related to static structure and contrast, and f(q,Δt)f(q,\Delta t)5 is a noise baseline or camera-noise-plus-static term (Lattuada et al., 7 Jul 2025). The supplementary formalism also introduces

f(q,Δt)f(q,\Delta t)6

Operationally, fastDDM computes f(q,Δt)f(q,\Delta t)7, estimates f(q,Δt)f(q,\Delta t)8, and supports extraction of f(q,Δt)f(q,\Delta t)9 and Γ(q)\Gamma(q)0 for model-based parameter inference.

Several baseline estimators are documented: Γ(q)\Gamma(q)1

Γ(q)\Gamma(q)2

Γ(q)\Gamma(q)3

Γ(q)\Gamma(q)4

together with a polynomial baseline fit Γ(q)\Gamma(q)5 used in the main text of the tutorial (Lattuada et al., 7 Jul 2025). These alternatives represent different practical ways of estimating the offset entering the DDM structure function, and their choice can materially affect the inferred Γ(q)\Gamma(q)6, especially at high Γ(q)\Gamma(q)7 or low signal-to-noise ratio.

3. Computational architecture and algorithms

The documented programmatic entry point is fastddm.ddm(img_seq=..., lags=..., core=..., mode=...), where img_seq is a three-dimensional image array, lags specifies the delay indices, core selects the implementation backend, and mode selects the computational scheme (Lattuada et al., 7 Jul 2025).

Component Options Function
core py, cpp, cuda Pure Python, C++ backend, or NVIDIA CUDA implementation
mode diff, fft Pairwise-difference scheme or FFT-based temporal-correlation scheme

In mode='diff', fastDDM follows the direct pairwise formulation of DDM. For each lag Γ(q)\Gamma(q)8, it forms image differences, Fourier transforms those differences, and averages the squared Fourier amplitudes. This corresponds to the conventional “naive” scheme and scales roughly as Γ(q)\Gamma(q)9 in the number of frames, because many frame pairs must be processed and the Fourier transforms are repeatedly applied.

In mode='fft', fastDDM computes the spatial Fourier transform of each frame once and then exploits temporal autocorrelation identities to reconstruct the structure function efficiently. The key object is the lag-dependent temporal correlation

DD0

which can be evaluated for all DD1 by FFTs along the time axis in a Wiener–Khinchin-like manner. For fixed image size and Fourier grid, this reduces the temporal scaling to DD2 (Lattuada et al., 7 Jul 2025). This places fastDDM in the same algorithmic lineage as earlier FFT-in-time DDM implementations that recast the temporal part of the calculation as an autocorrelation problem (Norouzisadeh et al., 2020).

The documented implementation parallelizes across frames, across wavevectors, and—especially in the direct-difference scheme—across lags. The three backends therefore represent different execution environments rather than different mathematical formalisms: py is a pure Python implementation, cpp uses a compiled backend, and cuda targets GPU execution. The available material does not describe a graphical or command-line interface; the primary documented interface is a Python module (Lattuada et al., 7 Jul 2025).

4. Experimental workflow and analytical use

A typical fastDDM workflow begins with experimental design and image acquisition. The frame rate must be chosen so that characteristic relaxation times of interest are sampled adequately; in the Brownian setting discussed in the tutorial, the analytic variance formulas assume DD3, where DD4 is the sampling interval (Lattuada et al., 7 Jul 2025). Field of view, magnification, numerical aperture, illumination stability, focus, and drift control are treated as integral to the eventual quality of DD5.

After acquisition, the image sequence is passed to fastDDM together with a selected lag set. The lags argument allows the use of all delays, range(1,N), or an arbitrary subset. This is important because lag selection defines a trade-off between temporal resolution and cost: linear sampling gives dense short-time coverage, whereas logarithmic or otherwise sparse sampling can span multiple decades in lag time with fewer evaluations. A similar trade-off applies to azimuthal DD6-binning: fine bins preserve DD7-dependence but increase noise, while coarse bins improve statistics at the cost of resolution.

Baseline estimation is then applied using one of the documented DD8 strategies. Once DD9 and 512×512512\times 5120 are available, the standard DDM relation can be fitted to extract 512×512512\times 5121. For diffusive Brownian particles, the tutorial uses

512×512512\times 5122

so that

512×512512\times 5123

From 512×512512\times 5124 versus 512×512512\times 5125, diffusion coefficients can be inferred. The provided material also notes that more elaborate models, such as ballistic or stretched-exponential forms, may be appropriate in other systems, although explicit non-Brownian fitting examples are not detailed in the excerpt (Lattuada et al., 7 Jul 2025).

5. Performance, scaling, and benchmark regime

The explicit benchmark regime reported for fastDDM uses synthetic 16-bit images of size 512×512512\times 5126, with the number of frames varied from 512×512512\times 5127 to 512×512512\times 5128 (Lattuada et al., 7 Jul 2025). The workstation specification is given as an AMD Ryzen 7 5800x CPU, 128 GB RAM, an NVIDIA RTX 3080 Ti with 12 GB VRAM, and Ubuntu 20.04.6. Under these conditions, the performance figures confirm the expected asymptotic behavior: diff mode follows 512×512512\times 5129 scaling, whereas fft mode follows N=16384N=163840.

The benchmark script makes the practical implications explicit. For N=16384N=163841, the direct-difference mode is skipped for the Python and C++ backends because of excessive runtime, and the pure Python FFT mode is skipped for N=16384N=163842 for the same reason (Lattuada et al., 7 Jul 2025). By contrast, the cpp and cuda backends in FFT mode keep runtimes under or around one minute even for the largest tested sequence lengths. This is the computational basis for the article’s headline claim that optimized, parallel algorithms can reduce analysis times by up to four orders of magnitude on typical 10,000-frame datasets (Lattuada et al., 7 Jul 2025).

A second benchmark result is that FFT performance does not show a significant slowdown when the number of images is not a power of two. The non-power-of-two test covers N=16384N=163843 to N=16384N=163844 in steps of N=16384N=163845, indicating that modern FFT libraries remain efficient when the transform length factors into small primes (Lattuada et al., 7 Jul 2025). In practical terms, this removes a common concern that DDM acquisition must be artificially tailored to powers of two to obtain acceptable compute performance.

6. Statistical reliability, best practices, and methodological context

The fastDDM tutorial does not restrict itself to computational speed; it also analyzes the intrinsic statistical reliability of the structure function. Under Brownian motion with N=16384N=163846, the variance of N=16384N=163847 is decomposed into signal, noise, and mixed contributions,

N=16384N=163848

with explicit formulas given for each term in the supplement (Lattuada et al., 7 Jul 2025). The derivation assumes stationary dynamics, ergodicity, and—where azimuthal averaging is used—often isotropy. These expressions are not part of the computation engine itself, but they govern how uncertainty decreases with increasing frame count and therefore inform acquisition planning and interpretation.

Several practical limitations follow directly from that analysis. If the characteristic decay time is much shorter than the frame interval, the dynamics are undersampled and the extracted N=16384N=163849 becomes distorted. If q=qq=|\mathbf q|0 is estimated poorly, the resulting q=qq=|\mathbf q|1 can be strongly biased, particularly in weak-signal or high-q=qq=|\mathbf q|2 regimes. And if a large dataset is processed in mode='diff', the q=qq=|\mathbf q|3 growth rapidly becomes prohibitive, making mode='fft' the operationally preferred choice for high-throughput work (Lattuada et al., 7 Jul 2025).

The tutorial also emphasizes several best practices: compare multiple baseline estimators; examine the effects of image windowing when Fourier-edge artefacts are relevant; choose magnification, numerical aperture, and illumination settings so that the length scales of interest are well resolved in q=qq=|\mathbf q|4-space; and increase q=qq=|\mathbf q|5 when quantitative parameter extraction demands tighter variance control (Lattuada et al., 7 Jul 2025). A related but distinct line of work, DDM with uncertainty quantification, uses Gaussian-process regression to reconstruct q=qq=|\mathbf q|6 from a sparse lag set and to propagate uncertainty explicitly (Gu et al., 2021). This suggests a broader methodological landscape in which fastDDM occupies the direct-computation, high-throughput end, while adjacent approaches emphasize statistical surrogate modeling and formal uncertainty propagation.

In that broader context, fastDDM can be understood as the computational engine that makes standard DDM analysis operational at scale. It preserves the canonical DDM formalism,

q=qq=|\mathbf q|7

while providing multiple execution backends, a direct and an FFT-based algorithmic mode, and a workflow spanning lag selection, azimuthal averaging, baseline estimation, and downstream fitting. Its significance lies less in altering DDM’s physical interpretation than in making that interpretation computationally tractable for modern microscopy datasets (Lattuada et al., 7 Jul 2025).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to fastDDM.