Skip to content

Instantly share code, notes, and snippets.

@josejimenezluna
Created January 5, 2017 16:24
Show Gist options
  • Save josejimenezluna/a83d39ccd2cba35bd4cb6b24c0a527f0 to your computer and use it in GitHub Desktop.
Save josejimenezluna/a83d39ccd2cba35bd4cb6b24c0a527f0 to your computer and use it in GitHub Desktop.
def pairCor(distances, bins = 50):
distances = distances.flatten()
c, breaks = np.histogram(distances, bins = bins)
dr = breaks[1] - breaks[0]
N = len(distances)
V = 4 * np.pi* breaks**2 * dr
rho = N/(np.max(V))
c = c/N
c = c/V[:bins]
c = c/rho
return(c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment