Python Algorithms in Particle Tracking
Python Algorithms in Particle Tracking
http://journal.chemistrycentral.com/content/6/1/144
SOFTWAR E
Open Access
Background
Particle tracking microrheology is a modern tool to investigate the viscoelastic properties of soft matter, for example, biopolymers and the interior, or the membrane of
living cells [1,2] on the microscopic scale. Though embedding tracer particles into such a sample alters the local
structure, this method is still considered non-invasive and
provides important information not available by other
methods [1-4].
The physical background of the method lies in the thermal motion of the tracer particle, which can be connected
to the viscoelastic properties of the local environment
through the generalized Langevin equation [5,6]. Neglecting the inertia term, which contributes to frequencies
in the megahertz range, and assuming that the memory
function is linearly related to the frequency dependent
*Correspondence: [email protected]
1 Max-Planck Institute for Intelligent Systems, Advanced Materials and
Biosystems, Heisenberg str. 3, 70569 Stuttgart, Germany
2 Biophysical Chemistry, Institute of Physical Chemistry, University of
Heidelberg, Im Neuenheimer Feld 253, 69120 Heidelberg, Germany
viscosity of the medium (through a generalized StokesEinstein relation)[3,5-8], the mean square displacement
(MSD) of the particle can be directly related to the creep
compliance as:
J( ) =
3 a
< r2 ( ) >,
ND kB T
(1)
2012 Maier and Haraszti; licensee Chemistry Central Ltd. This is an Open Access article distributed under the terms of the
Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use,
distribution, and reproduction in any medium, provided the original work is properly cited.
Page 2 of 9
The two types of description are equivalent and interconnected with the relation:
G () =
1
,
iJ ()
(2)
Implementation
Dependencies
After installation, its functions are available using following import command within the interpreter or a
Python script:
from Rheology import *
Data presentation, data format
Particle tracking microrheology starts with the imaging experiments and the image treatment in a strict
Page 3 of 9
Page 4 of 9
MSD, m2
0.1
0.01
0.001
0.01
0.1
10
100
, seconds
Page 5 of 9
Because these methods have their strength and weakness, we summarize them and their implementation
below. Recently we have shown that the accuracy of the
Evans method can be greatly improved by using local
interpolation of the data in a splinelike manner without
forcing a single function to be tted to the whole data
set. This improvement is also included in the Rheology
framework and will be discussed below.
The Mason method
(3)
G () = e
i
2
e 2
=
. (4)
J0 (1 + )
J(t = 1/) (1 + )
1000
G, G, Pa
100
10
0.1
0.01
0.001
0.01
0.1
10
100
, 1/s
G () =
iJ0 +
N
k=0 (Ak+1
Ak )eitk
(5)
Jk Jk1
1
, where 0 < k N, A0 = 0, AN+1 = .
tk tk1
(6)
Page 6 of 9
bandwidth causes the Ak values to be a poor representation of the local derivative of the creep compliance,
resulting in a strong deviation (usually an unphysical cuto ) of the calculated shear modulus. This latter problem is
well represented on a test example of a Kelvin-Voigt solid
characterized by a Youngs modulus of E = 10 Pa and
viscosity = 0.2 Pas (Figure 5).
The conversion can be improved by increasing the
bandwidth of the data, or decreasing the frequency range
where G () is calculated (using the omax parameter). A
third alternative is using model interpolations to increase
the bandwidth numerically. Because most experimental
data cannot be tted with a single analytical function for
all values, we have developed a method to t the MSD at
consecutive intervals in a splinelike manner [41].
Adaptive splinelike tting
10
100
0.1
10
G, G, Pa
G, G, Pa
0.01
0.001
0.1
0.0001
0.1
10
, 1/s
100
1000
0.01
0.1
10
, 1/s
100
1000
Page 7 of 9
The above example uses a static approach, simply inserting factor points between every two original data points,
which results in a very large equidistant data set. Alternatively we provide a dynamic method, which is controlled
by an error parameter.
Investigating the form of equations (2) and (6), one can
see that the accuracy of the Evans method is strongly
related to how accurately equation (6) approximates the
local derivative of J(t). Knowing the analytical form of
the interpolating functions, this error can be approximated using the function (f ) and its second derivative
(f ) [32,41]. Based on this approximation and specifying a
local error , the minimal step size at any time point h(t)
can be estimated as:
fk (tk )
.
(7)
h=
fk (tk )
Using h as a minimal step size for each tted segment, the program can dynamically interpolate the data
and increase the number of points only where the creep
compliance changes faster. This results in a non-equally
sampled data set, which (after calculating the creep compliance) can be well handled by both the MSD to J() function and subsequently the numerical conversion method
J to G(), resulting in an improved complex shear modulus. To eliminate further bandwidth problems, the maximal desired circular frequency max can be forced to N
T
using the omax parameter.
The consequence of this tting and interpolation procedure is an increased bandwidth and decreased noise
in the interpolated data set. The resulting accuracy is
some orders of magnitude larger than the specied but
strongly related to it. Therefore the user has to estimate
the suitable for the given problem. For example, inserting 10 new points between 0 t0 and requesting an
accuracy of = 5 104 , the algorithm has corrected
the errors of Figure 5 to about 1% relative error on average (Figure 6). The Mason method produces about 100%
relative error for the loss modulus of the same conversion,
originating from the failure of its power law assumption,
and can not be improved by interpolation [41].
The advantage of employing non-equally sampled data
as the result of the dynamic interpolation is clear if we
compare the required smallest time step produced by this
method. The results indicate hmin 2 106 s, which
would increase the number of data points about 5000
in the case of equidistant sampling. In comparison, the
increment of the number of data points is only about 20%.
For data sets following various trends in the dierent
time segments (thus the tting procedure identies multiple tted regions), the transition between the regions can
be smoothened using a linear interpolation between the
two smoothing functions. The range of this smoothing is
Page 8 of 9
Additional le
100
G, G, Pa
10
0.1
0.01
0.1
10
, 1/s
100
1000
Abbreviations
MSD, Mean square displacement.
Competing interests
The Authors declare that they have not competing interests.
dened by the NSmooth parameter. The range is identied in the original data, but then applied to the rened
data set. The result is an MSD, where sudden jumps are
reduced, minimizing the presence of oscillatory artifacts
in the resulted complex shear modulus G ().
Conclusions
In this paper we have presented a free software solution
for analyzing particle tracking data for microrheology.
Our software library implements the time average calculation of mean square displacement with control over the
time shift in the data, and conversion methods to calculate the creep compliance and the complex shear modulus.
Beyond the two most common methods mentioned in the
literature, we have developed a dynamic local tting procedure, which allows spline-like tting of the MSD and
improved conversion accuracy to about 1% from about
100% for a Kelvin-Voigt model test.
Authors contributions
TM and TH have developed the Python software together discussing and
testing the various features, and both contributed to writing this manuscript.
Both authors read and approved the nal manuscript.
Acknowledgements
This work was supported by the Ministry of Science, Research, and the Arts of
Baden-Wurttemberg
(AZ:720.830-5-10a). The authors would like to thank to
Professor Dr. Joachim P. Spatz, Dr. Heike Boehm and the Max-Planck Society
for the generous nancial support and Dr. Claire Cobley for assistance.
Received: 13 September 2012 Accepted: 14 November 2012
Published: 27 November 2012
References
1. Dangaria JHH, Butler PJJ: Macrorheology and adaptive microrheology
of endothelial cells subjected to uid shear stress. Am J Physiol Cell
Physiol 2007, 293:C1568C1575.
2. Bausch AR, Moller W, Sackmann E: Measurement of local viscoelasticity
and forces in living cells by magnetic tweezers. Biophys J 1999,
76:573579.
3. Waigh TA: Microrheology of complex uids. Rep Prog Phys 2005,
68(3):685.
4. Wirtz D: Particle-tracking microrheology of living cells: principles
and applications. Annu Rev Biophys 2009, 38:301326.
5. Mason TG, Weitz DA: Optical measurements of frequency-dependent
linear viscoelastic moduli of complex fluids. Phys Rev Lett 1995,
74(7):12501253.
6. Mason TG, Ganesan K, van Zanten JH, Wirtz D, Kuo SC: Particle tracking
microrheology of complex uids. Phys Rev Lett 1997, 79:3282 3285.
7. Mason TG: Estimating the viscoelastic moduli of complex uids using
the generalized Stokes-E, instein equation. Rheologica Acta 2000,
39(4):371378.
8. Squires TM, Mason TG: Fluid mechanics of microrheology. Annu Rev
Fluid Mech 2010, 42:413438.
9. Goodwin JW, Hughes RW: Rheology for Chemists. An Introduction. Second
edition. Cambridge: RSC Publishing; 2008.
10. Mezger TG: The Rheology Handbook. 3rd revised edition. Vincentz Network
GmbH & Co. KG , Plathnerstr. 4c, Vol. 30175. Hannover, Germany: European
Coatings Tech Files, Vincentz Network; 2011.
11. Crocker J, Weeks E: Microrheology tools for IDL . [http://www.physics.
emory.edu/weeks/idl/rheo.html]
12. Kilfoil M, et al.: Matlab algorithms from the Kilfoil lab. [http://people.
umass.edu/kilfoil/downloads.html]
13. Tassieri M: Compliance to complex moduli, version 2. 2011. [https://
sites.google.com/site/manliotassieri/labview-codes]
14. Jones E, Oliphant T, Peterson P, et al.: SciPy: Open source scientic
tools for Python. 2001. [http://www.scipy.org/]
15. Hunter JD: Matplotlib: A 2D graphics environment. Comput Sci Eng
2007, 9(3):9095. [http://matplotlib.sourceforge.net/]
16. Crocker JC, Grier DG: Methods of digital video microscopy for
colloidal studies. J Colloid Interface Sci 1996, 179:298310. [http://www.
physics.emory.edu/weeks/idl/]
17. Brangwynne CP, Koenderink GH, Barry E, Dogic Z, MacKintosh FC, Weitz
DA: Bending dynamics of fluctuating biopolymers probed by
automated high-resolution filament tracking. Biophys J 2007,
93:346359.
18. Gosse C, Croquette V: Magnetic tweezers: micromanipulation and
force measurement at the molecular level. Biophys J 2002,
82(6):33143329.
19. Rogers SS, Waigh TA, Lu JR: Intracellular microrheology of motile
amoeba proteus. Biophys J 2008, 94(8):33133322.
20. Carter BC, Shubeita GT, Gross SP: Tracking single particles: a
user-friendly quantitative evaluation. Phys Biol 2005, 2:60.
21. Savin T, Doyle PS: Statistical and sampling issues when using multiple
particle tracking. Phys Rev E 2007, 76(2):021501.
22. Savin T, Doyle PS: Static and dynamic errors in particle tracking
microrheology. Biophys J 2005, 88:623638.
23. Savin T, Spicer PT, Doyle PS: A rational approach to noise
discrimination in video microscopy particle tracking. App Phys Lett
2008, 93(2):024102.
24. Smith R, Spaulding G: User-friendly, freeware image segmentation
and particle tracking. [http://titan.iwu.edu/gspaldin/rytrack.html]
25. Blair D, Dufresne E: The Matlab particle tracking code
respository.:2005 - 2008. [http://physics.georgetown.edu/matlab/]
26. Milne G: Particle tracking. 2006. [http://zone.ni.com/devzone/cda/epd/
p/id/948]
27. Caswell TA: Particle identication and tracking. [http://j.uchicago.
edu/tcaswell/track doc/]
28. Haraszti T: ImageP: image processing add-ons to Python and numpy.
2012 2009. [https://launchpad.net/imagep]
29. Flyvbjerg H, Petersen HG: Error estimates on averages of correlated
data. J Chem Phys 1989, 91:461466.
30. Saxton M: Single-particle tracking: the distribution of diusion
coecients. Biophys J 1997, 72(4):17441753.
31. Evans RML, Tassieri M, Auhl D, Waigh TA: Direct conversion of
rheological compliance measurements into storage and loss
moduli. Phys Rev E 2009, 80:012501.
32. Press WH, Teukolsky SA, Vetterling WT, FB P: Numerical recipes in C++.
second edition. Cambridge: Cambridge University Press; 2002.
33. Addas KM, Schmidt CF, Tang JX: Microrheology of solutions of
semiexible biopolymer laments using laser tweezers
interferometry. Phys Rev E 2004, 70(2):021503.
34. Morse DC: Viscoelasticity of concentrated isotropic solutions of
semiexible polymers. 2. Linear Response. Macromolecules 1998,
31(20):70447067.
35. Morse DC: Viscoelasticity of concentrated isotropic solutions of
semiexible polymers. 1. model and stress tensor. Macromolecules
1998, 31(20):70303043.
36. Gittes F, Schnurr B, Olmsted PD, MacKintosh FC, Schmidt CF: Microscopic
viscoelasticity: shear moduli of soft materials determined from
thermal fluctuations. Phys Rev Lett 1997, 79(17):32863289.
37. Crocker JC, Valentine MT, Weeks ER, Gisler T, Kaplan PD, Yodh AG, Weitz
DA: Two-point microrheology of inhomogeneous soft materials.
Phys Rev Lett 2000, 85(4):888891.
38. Dasgupta BR, Tee SY, Crocker JC, Frisken BJ, Weitz DA: Microrheology of
polyethylene oxide using diusing wave spectroscopy and single
scattering. Phys Rev E 2002, 65(5):051505.
Page 9 of 9