We have used trackpy with HDF5 xyt hyperstack movies and with avi movies. Here are our ipython notebooks.
This notebook
- opens a color avi movie in greyscale,
- calculates median darkcount and bright background images,
- backgrounds the movie with both darkcount and bright background images, but recovers if there is not enough memory available,
- locates bright or dark spots in the movie with trackpy,
- links these into trajectories with trackpy,
- filters out trajectories of few frames using trackpy.filter_stubs,
- saves the results,
- creates a series of tif images (or a movie) of the particle trajectories.
(original file name: 2016-02-11_tracking_movie_2016-01-26-01_60x1.0_Hematite_swimmers.ipynb)
This notebook
- Opens either avis or a series of color tif stacks as a movie for two movies: an experiment and a control,
- separates the movie by color into red and green particles (which may have different brightness),
- Locates bright spots in each color with trackpy,
- links these into trajectories with trackpy,
- filters out trajectories of few frames using trackpy.filter_stubs,
- saves the results,
- calculates the imsd and emsd plots for each particle color and each movie,
- calculates gamma (in the style of Diego Krapf)
- calculates the four vanhove plots,
- creates a movie of the particle trajectories (for the experiment and the control).
This notebook
- opens an HDF5 xyt hyperstack file,
- converts it (slowly) into a file that can be used with trackpy,
- background divides the movie but recovers if there is not enough memory available,
- locates dark spots in the movie,
- links these into trajectories,
- filters out trajectories of few frames using filter_stubs,
- filters out trajectories of particles that move a distance below some threshold (currently 4 microns), and
- saves the results (below an 'error' lines that prevents accidentally saving the results if you run the whole notebook.
Note that displacement_um will overestimate the maximum extents of the particle trajectory because it obtains the extreme x and y independently, not as an (x,y) pair from the same frame.
(original file name: 2015-09-15 movie150902,17 particles in droplet _ save trajectories, minimal human intervention, improved_2016-02-10.ipynb)
This notebook explores the standard deviation in the ensemble mean square displacement. It's a deep dive into how iMSD becomes eMSD, and I calculate the standard deviation of the iMSD, which can serve as an uncertainty for the eMSD. my_emsd() is based on emsd() from https://github.com/soft-matter/trackpy/blob/master/trackpy/motion.py
Defines functions for calculating the ensemble mean square displacement with standard deviation.
This notebook shows some examples of how to work with a color avi file in python. If you run into errors opening an avi file using pims, make sure to run the setup script, available at https://github.com/vivarose/setup_script.
(original file name: 2015-02-20 & 06-25 & 07-01 Background subtracting color -- red swimmers and blue tracers.ipynb)
An implementation of rotational drift subtraction. Particles that are tracked are assumed to have correlated three-dimensional motion; this removes that average motion.
(original file name: 2016-08-04_Rotational_drift_subtract_entire_movie.ipynb)
This is out of date.
Using ipyparallel is recommended in the trackpy walkthrough for speeding up particle tracking. Here I have implemented it. This notebook
- opens a color avi movie in greyscale,
- imports ipyparallel for parallel processing, (You will need to start the appropriate number of engines either in the clusters tab or from the command line.)
- locates dark spots in the movie with trackpy and parallel processing,
- filters out trajectories of few frames using trackpy.filter_stubs.
(original file name: 2016-02-11_track_mov_2016-01-26_02_60x1.0_Hem_swim_w_violet_100%--2016-02-26,ipyparallel.ipynb)