fastDDM: Efficient DDM Analysis
- 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 , from which the intermediate scattering function 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 and diffusion coefficients , 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 pixels and sequence lengths from a few dozen frames up to at least 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 , 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
where is the image intensity, its spatial Fourier transform, 0 the lag time, and 1 a temporal average. For isotropic systems, the standard reduction is
2
The structure function is related to the intermediate scattering function through
3
where 4 is an amplitude term related to static structure and contrast, and 5 is a noise baseline or camera-noise-plus-static term (Lattuada et al., 7 Jul 2025). The supplementary formalism also introduces
6
Operationally, fastDDM computes 7, estimates 8, and supports extraction of 9 and 0 for model-based parameter inference.
Several baseline estimators are documented: 1
2
3
4
together with a polynomial baseline fit 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 6, especially at high 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 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 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
0
which can be evaluated for all 1 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 2 (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 3, where 4 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 5.
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 6-binning: fine bins preserve 7-dependence but increase noise, while coarse bins improve statistics at the cost of resolution.
Baseline estimation is then applied using one of the documented 8 strategies. Once 9 and 0 are available, the standard DDM relation can be fitted to extract 1. For diffusive Brownian particles, the tutorial uses
2
so that
3
From 4 versus 5, 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 6, with the number of frames varied from 7 to 8 (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 9 scaling, whereas fft mode follows 0.
The benchmark script makes the practical implications explicit. For 1, 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 2 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 3 to 4 in steps of 5, 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 6, the variance of 7 is decomposed into signal, noise, and mixed contributions,
8
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 9 becomes distorted. If 0 is estimated poorly, the resulting 1 can be strongly biased, particularly in weak-signal or high-2 regimes. And if a large dataset is processed in mode='diff', the 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 4-space; and increase 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 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,
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).