Particle Tracking

A large number of models in physics focus on point-like behavior of objects rather than extended bodies. For systems with few bodies in motion with one degree of freedom, it is easy enough to use various methods to locate an object ( e.g. ultrasound, interferometery, or even a linear potentiometer). Finding the two-dimensional location of an object in real time tends to take careful engineering of the situation, and three-dimensional locations even more so. Furthermore, many traditional methods work poorly on situations that involve a number of moving bodies.

While photographs have been used for capturing data from experiments since the late 1800s, digitally processing images is (obviously) newer. One turning for physics point came in 1959, when Paul Hough developed an algorithm to identify linear tracks in photos of bubble chambers. While incredibly useful, it was still difficult to digitize images in the first place. With semiconductor breakthroughs in the 70's and 80's, CCD and CMOS detectors were developed as a way of quickly and cheaply gathering digital image data.

Getting Started

Nowadays processing video has become common, to the point that there are readily available libraries that help with routine tasks. For this experiment, we'll be using the Open Computer Vision library, which runs on nearly every OS and can be used with C++, Java, and Python. To get your computer ready to go, you should do the following:

  1. Open an Anaconda Prompt
  2. Make sure conda is up to date with the command conda update conda
    1. If you haven't updated in a while, this might not work. In that case, try the following command
      1. conda update -n base -c defaults conda –repodata-fn=repodata.json
    2. You should be around version 23.something of conda at this point.

Now type the following commands into the prompt:

  1. conda create -n tracking
  2. conda activate tracking
  3. conda install numpy
    1. If you're on a Windows machine and get an “SSL module is unavailable” error, try the instructions here.
  4. conda install matplotlib
  5. conda install scikit-image
  6. conda install -c conda-forge av
  7. pip install pims
  8. pip install opencv-python
  9. pip install ipympl
  10. pip install jupyter
  11. pip install pandas
  12. jupyter notebook

If you've succeeded, you should have set up a new Anaconda environment named tracking and installed the packages needed for the lab. To verify it worked, make a new Jupyter notebook and type the following commands

import os
print (os.environ['CONDA_DEFAULT_ENV'])

It should print out tracking; if not then we'll need to troubleshoot why you don't have the right environment set up.

Day 1: Brownian Motion

Brownian motion is the random motion exhibited by a particle suspended in a fluid (either a liquid or a gas). This random motion results from the constant bombardment of the particle from all sides by the constituents of the fluid. Early observations of Brownian motion provided some of the first evidence of atoms. In 1905, Einstein published a paper showing that Brownian Motion could be explained by assuming that fluids were composed of atoms moving randomly with an average kinetic energy. In 1908, Jean Perrin experimentally confirmed the predictions of Einstein's theory, for which he was awarded the Nobel Prize in Physics in 1929. In this experiment, we will observe the Brownian motion of silica beads suspended in water, and use particle-tracking software to measure the mean-squared displacement of these beads over a period of time. Using a simple model from statistical mechanics, we can look at how diffusion scales with particle size.

A simultation of Brownian motion. The yellow circle represents a microscopic particle undergoing Brownian motion, while the white circles represents molecules from the environment colliding with it. Use the play button in the top menu bar to start, or visit the source page for a smoother running model.

References

1 Objectives


In this experiment you will observe Brownian motion of silica beads in water, and compare their motion to that predicted by statistical mechanics. Specifically, your objectives for this experiment include the following:

  • to learn to mix particle dilutions and prepare microscope slides;
  • to learn to focus and adjust an optical microscope;
  • to use image and video capture software to record videos of random particle motion;
  • to work through processing recorded videos into computer-ready data;
  • to experiment with methods of processing and filtering data to isolate only the desired components of a video.

2 Theory


Consider a single particle immersed in a fluid. In a given time interval $t$, the random collisions with the particles in the fluid will give rise to a random displacement, and the probability for any particular displacement, $x$, is given by the Gaussian distribution

$P(x) = \sqrt{\dfrac{1}{2\pi\sigma^2}}e^{-x^2/2\sigma^2},$ (1)

where the width of the distribution can then be related to a quantity known as the diffusion coefficient,

$\sigma^2=\left< x^2\right>=2Dt.$ (2)

If one experimentally measures these displacements in one dimension (e.g. along either the x- or y-axes), you can plot a normalized histogram and fit to Eq. (1) in order to extract the diffusion coefficient.

What would we expect the diffusion coefficient to be?

The theory of the Brownian motion of spherical particles can be derived from statistical mechanical considerations. (See Refs [1] and [2] for a full treatment of the problem.) Here we will simply summarize the development of the theory. The motion of the particle is assumed to be governed by the following two forces:

  • a time-independent dissipative frictional force $\mu$, caused by the particle's motion through a fluid with a non-zero viscosity, and
  • a time-dependent random bombardment of the particle from all directions by the atoms of the fluid.

Using the equipartition theorem, it can be shown that the mean squared displacement of the particle in one dimension, $\langle x^2 \rangle$, is given by

$\dfrac{\partial \langle x^2 \rangle}{\partial t} = \dfrac{2k_BT}{\mu},$ (3)

where $k_B$ is Boltzmann's constant and $T$ is the absolute temperature of the fluid. Since we are assuming spherical particles, we can use Stokes' law for the frictional force on a spherical particle moving through a viscous fluid,

$\mu = 6\pi\eta a$, (4)

where $a$ is the particle radius and $\eta$ is the viscosity of water (which varies slightly with temperature). Thus, integrating we find

$\langle x^2\rangle = \dfrac{2k_BT}{6\pi\eta a}t=2Dt$, (5)

where $D = k_BT/6\pi\eta a$ is defined as the diffusion coefficient.

There are quite a few assumptions about the nature of the forces that exist (and those that don't exist) that may be violated in practice, so don't panic if your results don't match the prediction precisely; look for ways to alter the experiment or test for trends.

3 Equipment


3.1 The sample

The particles we will investigate are silica spheres of (close to) uniform size suspended in water. (Particle sizes ranging from about 0.5 to 5 μm are available.) Solutions may have been prepared ahead of time, or you may need to mix your own (with help from the lab staff).

Your sample will be a microscope slide consisting of a single drop of the sample solution held between the slide and a cover slip as shown in Fig. 1. It is important that the boundaries of the sample drop not reach the edges of the cover slip, microscope slide, or the spacer tape as this will create a flow of the solution towards the point of contact. Due to evaporation, your drop will disappear over the course of a day or so. Likewise, due to gravity, the particles will slowly settle out of solution on the scale of a few hours. It is therefore likely that you will not be able to reuse your sample slide from the first day on the second day of the experiment. Preparing a new sample on the second day (from the same dilution) will not impact the results of the experiment.

 A photograph of the sample slide.  A drop of water, containing silica microspheres, is sandwiched between two glass slides, with electrical tape used for spacing.
Figure 1: Sample drop contained between a microscope slide and cover slip.

The microscope

A compound binocular microscope will be used for viewing and recording movies of the particles undergoing Brownian motion. Several components of the microscope are illustrated in Fig. 2, and the device has the following characteristics of importance to the experiment:

  • a specimen stage which translates in both x and y;
  • coarse and fine focus controls;
    • The fine focus adjustment moves the eyepiece by 0.5 $\mu$m per small tick mark
  • a rotating turret containing 4x, 10x, 40x, and 100x objectives;
  • two 10x eyepieces, and a CCD camera for recording images and movies;
  • a variable-intensity light source; and
  • an Abbe condenser with adjustable iris.
(a) (b)
Figure 2: The features of the microscope are highlighted. Figure (a) shows the view below the sample stage, whereas figure (b) shows a bigger, overall view of the microscope. Click on an image for better resolution.

The total magnification of the microscope is given by the product of the 10x eyepiece and the selected objective's magnification.

The condenser is used to take the light coming from the light source and focus it into a cone which narrows to a point at the sample, and then expands back into a cone of light entering the objective. The condenser needs to be adjusted separately for each objective, so that the cone angle matches the numerical aperture (or acceptance angle) for that objective. Getting the best image means adjusting the position of the condenser, the opening diameter of the iris, and the brightness of the light source. 

Focusing the Microscope & Calibration (10 points)

For this exercise, you will be using the biological sample slides provided to practice using the microscope.

  • With the 4x objective lens, choose a feature on the sample and save an image of it on the computer.
  • Change the objective to 10x, find the same feature, and save another image.
  • Change the objective to 40x and repeat.
  • Using the calibration slide, save an image of the engraved rulings at 4x, 10x, and 40x objective power

4 Experimental procedure


4.1 Outline

On the first day of the experiment, you will gain experience in performing the following tasks:

  • preparing samples and using the microscope;
  • recording videos;
  • calibrating the plate scale of the CCD camera;
  • importing videos into Python
  • tuning parameters to make videos more machine-readable
  • measuring motion between video frames

At the end of the first day (or before returning on the second day), you should obtain a histogram of particle displacements extracted for at least one video, and you should calculate at least a preliminary estimate for diffusion coefficient.

To process the video files, we have a Python notebook as well as an example file that you can test with.

4.2 Day 2

The default plan for the second day is to continue experimenting with the Brownian motion system by choosing a parameter to modify (e.g. particle size, density, temperature, viscosity, etc.) and record a series of videos as you change the system. The goal is to then empirically determine how the diffusion coefficient was affected by your change. If you have a parameter that is easy to measure (such as particle size) then ideally you will create a functional relationship between that parameter and the diffusion coefficient. If you have a parameter that is difficult to precisely quantify (e.g. viscosity) then determining the presence (or absence) of a trend might be the best you can do.

To this end, you will want to have a fair number of trials (Think back to your first lab report about what datasets were characterized well and which ones were difficult to interpret).

For your analysis, you will need a plot of diffusion versus the modified parameter. If there is a notable trend in the data (or an expected trend) you should fit a function to it; otherwise you should explain why that is not possible.

Possible systems to analyze:

If you choose a different system for day 2, then the specifics will be more flexible. For instance, some experiments might require more work in getting proper lighting for a video to be measurable, or more work with OpenCV to actually parse the video into manageable data.

Saving Processed Video

If you want to save a video you've been processing, the following code _should_ be a good starting place. You might need to alter the codec at the start.

fourcc = cv.VideoWriter_fourcc(*'DIVX')
out = cv.VideoWriter('output.avi', fourcc, 30.0 , (frames[0].shape[1],frames[0].shape[0]),False))
  #True if color

for f in frames:
    out.write(f)
out.release()

The arguments for VideoWriter are the Filename, Codec, Framerate, (width, height), and Color?

Final data analysis

There will be some variability between groups here, but here are the general guidelines for what to hand in:

Day 1: Brownian Motion & Diffusion

For a single video, provide the following:

  • An annotated image showing particles and their paths over the course of a video
  • A table denoting the parameters used to select particles, which should include:
    • The sequence of operations applied to the base video
    • The conditions used to select particles to track
  • A histogram showing the per-frame displacement of particles along one dimension
    • The x-axis of the histogram should be converted to units of distance ($\mu$m)
    • The histogram should be overlaid with a Gaussian fit to the displacement data
    • The diffusion coefficient calculated from the Gaussian fit should be included either visually or in the figure caption.
  • A paragraph or two interpreting the reasonability of your diffusion coefficient.
    • This can include things like discussing residual issues with processing data or with the video
    • Comparing the calculated & experimental diffusion coefficients should not be done with great rigor; there are many unknowns and systematic effects that would be difficult to account for.

Day 2: Variation of parameters or Analysis of new system

For the second day's experiment, you may have either worked systematically investigating a parameter for the Brownian motion system or worked to track another system entirely. As such, the expectations will differ.

Continuing Brownian Motion

If you continued with Brownian motion, you should provide the following:

  • A paragraph or two discussing your experiment, including:
    • The parameter you chose to vary
    • How you accomplished the variation
    • How you controlled other variables
    • What effect altering that parameter is expected to have.
  • A set of histograms (fitted) illustrating the change in diffusion coefficient as you varied your parameter
  • A plot of the diffusion coefficient versus the parameter of choice.
    • If there is a trend in the data that is straightforward to fit, include the fit function in the plot.
  • A written interpretation of your diffusion data.
    • If you could identify and quantify a trend, do so.
    • If there wasn't a clear trend, that's alright as well. Go back to your videos / data and try to identify any confounding factors that could produce a null result
      • If you found something (e.g. many more particles “sticking” to the surface for some videos) discuss how that affected your results
      • If you didn't find anything (and that's fine), mention some of the aspects of the video that you investigated (e.g., “I double-checked the particle density, video focus, and threshold settings and none substantially differed”.)

Alternate study

If you studied another system, you should provide the following:

  • A paragraph or two discussing your experiment, including:
    • The system you chose to study
    • What's interesting about the particles you're tracking
      • More specifically, why are you looking at the system at all? The answer doesn't have to be grand, it could be “We tracked a rubber ball to see how much energy was lost for each bounce.”
    • What behavior you would expect to see. This should be qualitative, unless you think you have a thorough enough understanding of all variables involved to make a quantitative prediction.
  • An annotated image showing the tracked particle paths
  • An appropriate plot of the variable you chose to investigate.
    • A plot of a quantity vs time is likely to be relevant for any system.
    • A histogram can be an appropriate tool if you have a large number of particles/interactions
  • A written interpretation of your data.
    • If you could identify and quantify a trend, do so.
    • If there wasn't a clear trend, that's alright as well. Go back to your videos / data and try to identify any confounding factors that could produce a null result
      • If you found something discuss how that affected your results
      • If you didn't find anything (and that's fine), mention some of the aspects of the video that you investigated (e.g., “I double-checked the camera tilt, video focus, and threshold settings and none substantially differed”.)

Day 3: Further Investigations

The third day's system has the same expectations as the second day. If you can identify a clear through-line to connect them, great!