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

IDL routines to calculate the pair correlation function g(r)

2D data --

Bug fix May 26, 2021 -- some rare combinations of (rmin,rmax,deltra) caused a crash; fixed now. Also, new option /noplot to calculate g(r) but not display results as you go along.


The default is to assume the data is in the form (x,y, --- ,t) where the first two columns are positions, the next few columns are arbitrary (and could be missing), and the last column is a timestamp. If you have tracked data: There are other options as well. The default is to calculate g(r) for 0 < r < 10, with a spacing of every 0.01. (See here for brief explanation.) To override this, you can use the following keywords:

3D data --

It's used exactly the same as the 2D program. The coding is quite different, though, for boring technical reasons, thus you have to use a different program. One warning that's only for ericgr3d: again due to boring technical reasons, you shouldn't set rmax to be more than half of the spatial extent of your data in X and Y. ericgr2d doesn't have this problem.

This program plots an update of g(r) at each step, which you can prevent with the /noplot keyword.

  1. What is the pair correlation function?
  2. How to calculate g(r)
  3. IDL routines to calculate g(r) (you are here)
  4. Extra g(r) routines -- unsupported

Contact us