NNCorrelation: Projected clustering two-point correlations

The NNCorrelation class computes the paircounts between various point catalogs. Given a random catalog, it computes the two-point clustering correlation function.

Example

import numpy as np
import orpheus

data = orpheus.ScalarTracerCatalog(
    pos1=xdat, pos2=ydat, tracer=np.ones_like(xdat))
rand = orpheus.ScalarTracerCatalog(
    pos1=xrand, pos2=yrand, tracer=np.ones_like(xrand))
nn = orpheus.NNCorrelation(
    n_cfs=4, min_sep=1., max_sep=128., binsize=0.1, nthreads=nthreads)
nn.process(cat=data, cat_random=rand)  # Compute xi via Landy-Szalay estimator
class orpheus.NNCorrelation(min_sep, max_sep, shuffle_pix=1, **kwargs)[source]

Bases: BinnedNPCF

Compute pair counts and (optionally) the projected angular clustering two-point correlation function.

Parameters
  • min_sep (float) – The smallest distance of each vertex for which the NPCF is computed.

  • max_sep (float) – The largest distance of each vertex for which the NPCF is computed.

  • shuffle_pix (int, optional) – Choice of how to define centers of the cells in the spatial hash structure. Defaults to 1, i.e. random positioning.

  • **kwargs – Passed to BinnedNPCF.

npair

The number of unweighted pairs.

Type

numpy.ndarray

npair_cell

The number cell-pairs.

Type

numpy.ndarray

xi

The scalar two-point correlation function.

Type

numpy.ndarray

Notes

  • Inherits all other parameters and attributes from BinnedNPCF.

  • Additional child-specific parameters can be passed via kwargs.

  • Binning: - Either nbinsr or binsize must be provided to fix the binning scheme. - If both are provided, the parent class rules determine which takes precedence.

  • Pixel hashing / grid setup: - shuffle_pix=1 is the default (random cell centers). - This differs from shear-based correlation functions where another default may be used.

  • Estimator: The scalar correlation function xi is formed from the pair counts via the Landy-Szalay estimator

    \[\xi(r) = \frac{DD(r) - 2\,DR(r) + RR(r)}{RR(r)}.\]
saveinst(path_save, fname)[source]
__process_patches(cat, dotomo=True, do_dc=True, adjust_tree=False, save_patchres=False, save_filebase='', keep_patchres=False)
process(cat, cat_random=None, dotomo=True, do_dc=True, adjust_tree=False, save_patchres=False, save_filebase='', keep_patchres=False)[source]

Compute NN pair counts for a catalog, and optionally the clustering 2PCF xi.

If cat_random is provided, xi is computed using the Landy–Szalay estimator. Otherwise only pair counts are computed.

Parameters
  • cat (orpheus.ScalarTracerCatalog) – The (clustered) catalog for which the pair counts are computed

  • cat_random (orpheus.ScalarTracerCatalog, optional) – A random catalog. If this is set, the clustering correlation function xi is computed.

  • dotomo (bool) – Flag that decides whether the tomographic information in the catalog should be used. Defaults to True.

  • do_dc (bool) – Flag that decides whether to double-count the pair counts. This will be required when looking at data-random pairs. within a tomographic catalog. Defaults to True. In case xi is computed, this argument is internally set to True.

  • adjust_tree (bool) – Overrides the original setup of the tree-approximations in the instance based on the nbar of the catalog. Not implemented yet; has no effect. Defaults to False.

  • save_patchres (bool or str) – If the catalog has been decomposed in patches, flag whether to save the NN measurements on the individual patches. Note that the path needs to exist, otherwise a ValueError is raised. For a flat-sky catalog this parameter has no effect. Defaults to False.

  • save_filebase (str) – Base of the filenames in which the patches are saved. The full filename will be <save_patchres>/<save_filebase>_patchxx.npz. Only has an effect if the catalog consists of multiple patches and save_patchres is not False.

  • keep_patchres (bool) – If the catalog consists of multiple patches, returns all measurements on the patches. Defaults to False.

__compute_xi(cat_data, cat_rand, dotomo=True, adjust_tree=False, save_patchres=False, keep_patchres=False, estimator='LS')
computeNap2(radii, tofile=False)[source]

Computes second-order aperture statistics given the projected angular clustering correlation function. Uses the Crittenden 2002 filter.

_checkcats(cats, spins)
_initprojections(child)
_print_npcfprojections_avail(child)
_projectnpcf(child, projection)

Projects npcf to a new basis.

_updatetree(new_resos, include_shifts=True)
autoset_tree(cat, dpix_grid=2.0, nside_grid=2048)