nbodykit.algorithms.pair_counters.domain

Functions

decompose_box_data(first, second, attrs, ...)

Perform a domain decomposition on simulation box data, returning the domain-demposed position and weight arrays for each object in the correlating pair.

decompose_survey_data(first, second, attrs, ...)

Perform a domain decomposition on survey data, returning the domain-demposed position and weight arrays for each object in the correlating pair.

get_cartesian(comm, pos[, cosmo])

Utility function to convert sky coordinates to Cartesian coordinates and return the implied box size from the position bounds.

log_decomposition(comm, logger, N1, N2, ...)

Log the distribution of particles to correlate across ranks that resulted after doing the domain decomposition.

nbodykit.algorithms.pair_counters.domain.decompose_box_data(first, second, attrs, logger, smoothing)[source]

Perform a domain decomposition on simulation box data, returning the domain-demposed position and weight arrays for each object in the correlating pair.

No load balancing is required since the particles in are assumed to be in a box.

The implementation follows:

  1. Decompose the first source such that the objects are spatially tight on a given rank.

  2. Decompose the second source, ensuring a given rank holds all particles within the desired maximum separation.

Parameters
  • first (CatalogSource) – the first source we are correlating

  • second (CatalogSource) – the second source we are correlating

  • attrs (dict) – dict of parameters from the pair counting algorithm

  • logger – the current active logger

  • smoothing – the maximum Cartesian separation implied by the user’s binning

Returns

(pos1, w1), (pos2, w2) – the (decomposed) set of positions and weights to correlate

Return type

array_like

nbodykit.algorithms.pair_counters.domain.decompose_survey_data(first, second, attrs, logger, smoothing, domain_factor=2, angular=False, return_cartesian=False)[source]

Perform a domain decomposition on survey data, returning the domain-demposed position and weight arrays for each object in the correlating pair.

The domain decomposition is based on the Cartesian coordinates of the input data (assumed to be in sky coordinates).

Load balancing is required since the distribution in Cartesian space will likely not be uniform.

The implementation follows:

  1. Decompose the first source and balance the particle load, such that the first source is evenly distributed across all ranks and the objects are spatially tight on a given rank.

  2. Decompose the second source, ensuring a given rank holds all particles within the desired maximum separation.

Parameters
  • first (CatalogSource) – the first source we are correlating

  • second (CatalogSource) – the second source we are correlating

  • attrs (dict) – dict of parameters from the pair counting algorithm

  • logger – the current active logger

  • smoothing – the maximum Cartesian separation implied by the user’s binning

  • domain_factor (int, optional) – the factor by which we over-sample the mesh with cells in a given direction; higher values can lead to better performance

  • angular (bool, optional) – if True, the Cartesian positions used in the domain decomposition are on the unit sphere

  • return_cartesian (bool, optional) – whether to return the pos as (ra, dec, z), or the Cartesian (x, y, z)

Returns

(pos1, w1), (pos2, w2) – the (decomposed) set of positions and weights to correlate

Return type

array_like

nbodykit.algorithms.pair_counters.domain.get_cartesian(comm, pos, cosmo=None)[source]

Utility function to 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.

nbodykit.algorithms.pair_counters.domain.log_decomposition(comm, logger, N1, N2, pos1, pos2)[source]

Log the distribution of particles to correlate across ranks that resulted after doing the domain decomposition.

Parameters
  • comm – the MPI communicator

  • logger – the current logger being used

  • N1 (int) – the total number of objects in the first source being correlated

  • N2 (int) – the total number of objects in the second source being correlated

  • pos1 (array_like) – the domain-decomposed data of the first source

  • pos2 (array_like) – the domain-decomposed data of the second source