nbodykit.algorithms.survey_paircount

Functions

get_cartesian(comm, pos[, cosmo]) Convert sky coordinates to Cartesian coordinates and return the implied box size from the position bounds.

Classes

AngularPairCount(first, edges[, second, ra, …]) Count (weighted) angular pairs of objects from a survey data catalog using the Corrfunc package.
SurveyDataPairCount(mode, first, redges, cosmo) Count (weighted) pairs of objects from a survey data catalog using the Corrfunc package.
SurveyPairCountBase(first, second[, …]) An abstract base class for pair count algorithms from surveys.
class nbodykit.algorithms.survey_paircount.AngularPairCount(first, edges, second=None, ra='RA', dec='DEC', weight='Weight', show_progress=True, **config)[source]

Count (weighted) angular pairs of objects from a survey data catalog using the Corrfunc package.

This uses the:func:Corrfunc.mocks.DDtheta_mocks.DDtheta_mocks function to count pairs.

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

Note

The algorithm expects the positions of particles from the survey catalog be the right ascension and declination angular coordinates.

Warning

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

Parameters:
  • first (CatalogSource) – the first source of particles, providing the ‘Position’ column
  • edges (array_like) – the angular separation bin edges (in degrees); length of nbins+1
  • second (CatalogSource, optional) – the second source of particles to cross-correlate
  • 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’
  • 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
  • **config (key/value pairs) – additional keywords to pass to the Corrfunc function

Methods

load(output[, comm]) Load a result has been saved to disk with save().
run() Calculate the angular pair counts of a survey data catalog as a function of separation angle on the sky.
save(output) Save result as a JSON file with name output
run()[source]

Calculate the angular pair counts of a survey data catalog as a function of separation angle on the sky. This adds the following attribute:

result

BinnedStatistic – a BinnedStatistic object holding the pair count results. The coordinate grid is theta, the angular separation bins. It stores the following variables:

  • theta: the mean separation value in the bin
  • npairs: the number of pairs in the bin
  • weightavg: the average weight value in the bin; each pair contributes the product of the individual weight values
class nbodykit.algorithms.survey_paircount.SurveyDataPairCount(mode, first, redges, cosmo, second=None, Nmu=5, ra='RA', dec='DEC', redshift='Redshift', weight='Weight', show_progress=True, **config)[source]

Count (weighted) pairs of objects from a survey data catalog using the Corrfunc package.

This uses the:func:Corrfunc.mocks.DDsmu_mocks.DDsmu_mocks function to count pairs.

Results are computed when the object 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 the Cartesian coordinate vectors, see SimulationBoxPairCount.

Warning

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

Parameters:
  • mode ({'1d', '2d'}) – compute paircounts as a function of r and mu or just r
  • first (CatalogSource) – the first source of particles, providing the ‘Position’ column
  • redges (array_like) – the radius bin edges; length of nbins+1
  • cosmo (Cosmology) – the cosmology instance used to convert redshift into comoving distance
  • second (CatalogSource, optional) – the second source of particles to cross-correlate
  • Nmu (int, optional) – the number of mu bins, ranging from 0 to 1
  • 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
  • **config (key/value pairs) – additional keywords to pass to the Corrfunc function

Methods

load(output[, comm]) Load a result has been saved to disk with save().
run() Calculate the 3D pair-counts of a survey data catalog as a function of separation r or separation and angle to line-of-sight (r, mu).
save(output) Save result as a JSON file with name output
run()[source]

Calculate the 3D pair-counts of a survey data catalog as a function of separation r or separation and angle to line-of-sight (r, mu). This adds the following attribute:

result

BinnedStatistic – a BinnedStatistic object holding the pair count results. The coordinate grid is either r or r and mu. It stores the following variables:

  • r: the mean separation value in the bin
  • npairs: the number of pairs in the bin
  • weightavg: the average weight value in the bin; each pair contributes the product of the individual weight values
class nbodykit.algorithms.survey_paircount.SurveyPairCountBase(first, second, show_progress=True)[source]

An abstract base class for pair count algorithms from surveys. The input data is assumed to be of the form (ra, dec, redshift) for these algorithms.

Methods

load(output[, comm]) Load a result has been saved to disk with save().
save(output) Save result as a JSON file with name output
nbodykit.algorithms.survey_paircount.get_cartesian(comm, pos, cosmo=None)[source]

Convert sky coordinates to Cartesian coordinates and return the implied box size from the position bounds.

If cosmo is not provided, return coordinates on the unit sphere.