Particle tracking using IDL -- John C. Crocker and Eric R. Weeks
Home | Download software | Tutorial | Extra software

getdx.pro


Updated 6-13-05 to fix a bug which occasionally showed up.
Updated 7-6-05 to fix a windows/ms-dos bug.

This program calculates displacement vectors from a track array. The output of the program is an array in one-to-one correspondence with the track array, with data [dx, dy, dr]. dr is the length of the displacement vector, in other words, sqrt(dx*dx + dy*dy). This is for a fixed dt, specified when getdx is called:

IDL> t = track(pta,1,dim=2)
IDL> dx = getdx(t,10,dim=2)

The DIM=2 keyword is optional for both of these functions, actually. The command above would give you an array dx that has a displacement vector for each particle, at each time, for a time difference of 10 time stamps. By changing the number 10, you can get different delay times.

Of course, at the end of the tracked data, you don't know where particles will be 10 time steps in the future. In fact, sometimes you aren't able to track particles the duration of the experiment, so really, the correct statement is that within 10 time steps of the end of each individual trajectory, you can't calculate a displacement vector. The program thus returns -1 in the dr column for particles where nothing can be computed. Since dr is the length of the displacement vector, it must by definition be positive, and so -1 is a useful error condition.

I like to use the output of getdx in combination with avgbin. For example:

IDL> w = where(dx(2,*) gt 0)
IDL> av=avgbin(t(0,w),dx(1,w))
IDL> plot,av(0,*),av(1,*)

This plots the average dy as a function of x, which for example might be a velocity profile. Of course, you'd probably want to multiply av(1,*) by a calibration factor, to make the time unit be seconds rather than time steps.


This program was written by Eric.


Contact us