/pycorr

2-pt correlation function estimation

Primary LanguageJupyter NotebookBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

pycorr

pycorr is a wrapper for correlation function estimation, designed to handle different two-point counter engines (currently only Corrfunc). It currently supports:

  • theta (angular), s, s-mu, rp-pi binning schemes
  • analytical two-point counts with periodic boundary conditions
  • inverse bitwise weights (in any integer format) and (angular) upweighting
  • MPI parallelization (further requires mpi4py and pmesh)
  • jackknife estimate of the correlation function covariance matrix

A typical auto-correlation function estimation is as simple as:

import numpy as np
from pycorr import TwoPointCorrelationFunction

edges = (np.linspace(1, 101, 51), np.linspace(0, 50, 51))
# pass e.g. mpicomm = MPI.COMM_WORLD if input positions and weights are MPI-scattered
result = TwoPointCorrelationFunction('rppi', edges, data_positions1=data_positions1, data_weights1=data_weights1,
                                     randoms_positions1=randoms_positions1, randoms_weights1=randoms_weights1,
                                     engine='corrfunc', nthreads=4)
# separation array in result.sep
# correlation function in result.corr

Example notebooks presenting most use cases are provided in directory nb/.

Documentation

Documentation is hosted on Read the Docs, pycorr docs.

Requirements

Strict requirements are:

  • numpy
  • scipy

To use Corrfunc as two-point-counting engine (only engine linked so far):

To run with MPI:

  • mpi4py
  • pmesh

Installation

See pycorr docs.

License

pycorr is free software distributed under a BSD3 license. For details see the LICENSE.

Credits