f2 is a clean, well documented function to compute spatial statistics with.  f2 is capable of handling computations on 1-D,2-D,3-D datasets with periodic, nonperiodic, and mixed boundary conditions.