nbodykit.algorithms.pair_counters.mocksurvey

Classes

SurveyDataPairCount(mode, first, edges[, …]) Count (weighted) pairs of objects from a survey data catalog as a function of \(r\), \((r,\mu)\), \((r_p, \pi)\), or \(\theta\) using the Corrfunc package.
class nbodykit.algorithms.pair_counters.mocksurvey.SurveyDataPairCount(mode, first, edges, cosmo=None, second=None, Nmu=None, pimax=None, ra='RA', dec='DEC', redshift='Redshift', weight='Weight', show_progress=False, domain_factor=4, **config)[source]

Count (weighted) pairs of objects from a survey data catalog as a function of \(r\), \((r,\mu)\), \((r_p, \pi)\), or \(\theta\) using the Corrfunc package.

See the Notes below for the allowed coordinate dimensions.

The default weighting scheme uses the product of the weights for each object in a pair.

Results are computed when the class is inititalized. See the documenation of run() for the attributes storing the results.

Note

The algorithm expects the positions of particles from a survey catalog be the sky coordinates, right ascension and declination, and redshift. To compute pair counts in a simulation box using Cartesian coordinates, see SimulationBoxPairCount.

Warning

The right ascension and declination columns should be specified in degrees.

Parameters:
  • mode ('1d', '2d', 'projected', 'angular') – compute pair counts as a function of the specified coordinate basis; see the Notes section below for specifics
  • first (CatalogSource) – the first source of particles, providing the ‘Position’ column
  • edges (array_like) – the separation bin edges along the first coordinate dimension; depending on mode, the options are \(r\), \(r_p\), or \(\theta\). Expected units for distances are \(\mathrm{Mpc}/h\) and degrees for angles. Length of nbins+1
  • cosmo (Cosmology, optional) – the cosmology instance used to convert redshift into comoving distance; this is required for all cases except mode='angular'
  • second (CatalogSource, optional) – the second source of particles to cross-correlate
  • Nmu (int, optional) – the number of \(\mu\) bins, ranging from 0 to 1; requred if mode='2d'
  • pimax (float, optional) – The maximum separation along the line-of-sight when mode='projected'. Distances along the \(\pi\) direction are binned with unit depth. For instance, if pimax=40, then 40 bins will be created along the \(\pi\) direction.
  • ra (str, optional) – the name of the column in the source specifying the right ascension coordinates in units of degrees; default is ‘RA’
  • dec (str, optional) – the name of the column in the source specifying the declination coordinates; default is ‘DEC’
  • redshift (str, optional) – the name of the column in the source specifying the redshift coordinates; default is ‘Redshift’
  • weight (str, optional) – the name of the column in the source specifying the object weights
  • show_progress (bool, optional) – if True, perform the pair counting calculation in 10 iterations, logging the progress after each iteration; this is useful for understanding the scaling of the code
  • domain_factor (int, optional) – the integer value by which to oversubscribe the domain decomposition mesh before balancing loads; this number can affect the distribution of loads on the ranks – an optimal value will lead to balanced loads
  • **config (key/value pairs) – additional keywords to pass to the Corrfunc function

Notes

This class can compute pair counts using several different coordinate choices, based on the value of the input argument mode. The choices are:

  • mode='1d' : compute pairs as a function of the 3D separation \(r\)
  • mode='2d' : compute pairs as a function of the 3D separation \(r\) and the cosine of the angle to the line-of-sight, \(\mu\)
  • mode='projected' : compute pairs as a function of distance perpendicular and parallel to the line-of-sight, \(r_p\) and \(\pi\)
  • mode='angular' : compute pairs as a function of angle on the sky, \(\theta\)

Methods

load(output[, comm]) Load a result has been saved to disk with save().
run() Calculate the pair counts of a survey data catalog.
save(output) Save result as a JSON file with name output
classmethod load(output, comm=None)

Load a result has been saved to disk with save().

run()[source]

Calculate the pair counts of a survey data catalog. This adds the following attribute:

self.pairs.attrs[‘total_wnpairs’]: The total of wnpairs.

pairs

a BinnedStatistic object holding the pair count results. The coordinate grid will be (r,), (r,mu), (rp, pi), or (theta,) when mode is ‘1d’, ‘2d’, ‘projected’, ‘angular’, respectively.

The BinnedStatistic stores the following variables:

  • r, rp, or theta : the mean separation value in the bin
  • npairs: the number of pairs in the bin
  • wnpairs: the weighted npairs in the bin; each pair contributes the product of the individual weight values
Type:BinnedStatistic
save(output)

Save result as a JSON file with name output