Teaching


Research exercise

In this exercise, you will compute the two-point correlation function of dark matter in a cosmological simulation. The two-point correlation function can be measured for any set of points in space and it is defined as the excess number of pairs of points separated by a distance r, relative to what it would be if the points were randomly distributed. The definition is:

xi(r) = DD(r)/RR(r) -1

where DD(r) is the number of pairs of data points separated by a distance r (actually in a bin of r) and RR(r) is the number of pairs of random points separated by a distance r (in the same bin). The correlation function is thus defined to be zero for a set of random points.


Steps

  • Download this ascii data file containing (x,y,z) positions for dark matter particles in a simulation: DM.dat. The coordinates run from 0 to the size of the simulation box, which is 420 Mpc/h (where h is the Hubble constant in units of 100 km/s/Mpc). The picture above shows the points in this simulation.

  • Write a code to calculate DD(r) from r=0.1 Mpc/h to 20 Mpc/h in 20 bins that are equally spaced in log(r). This means that the inner edge of the first bin will be at log(r)=-1 and the outer edge of the last bin will be at log(r)=1.3.

  • Create a random distribution of points that fill the same volume of space as the DM data. Then run your code to calculate RR(r), and then xi(r).

  • Make a plot of log(xi) (y-axis) vs. log(r) (x-axis) of the dark matter correlation function. You should have 20 points, one for each logarithmic bin.

  • Optional/Advanced: Try to make your code run in less than 10 seconds!


    Help and reading

    If you need help with learning how to program and make plots, here is some help with the languages that I use: Programming help. However, you may decide to use other languages, like Python for example.

    To get a sense of how the correlation function is used in research, here are two journal papers. Weinberg et al.(2004) is a theoretical paper that measures the correlation function of dark matter and galaxies in a simulation and Zehavi et al.(2011) is an observational paper that measures the correlation function of galaxies in the Sloan Digital Sky Survey. These are very technical papers, so don't get discouraged if you don't understand most of them - it's perfectly normal!