Two-Point Clustering Statistics (twopt)#

Measure two-point clustering statistics from catalogues.

Local plane-parallel estimators#

compute_powspec(catalogue_data, catalogue_rand)

Compute power spectrum from survey-like data and random catalogues in the local plane-parallel approximation.

compute_corrfunc(catalogue_data, catalogue_rand)

Compute correlation function from survey-like data and random catalogues in the local plane-parallel approximation.

Global plane-parallel estimators#

compute_powspec_in_gpp_box(catalogue_data[, ...])

Compute power spectrum from a simulation-box catalogue in the global plane-parallel approximation.

compute_corrfunc_in_gpp_box(catalogue_data)

Compute correlation function from a simulation-box catalogue in the global plane-parallel approximation.

Window function estimator#

compute_corrfunc_window(catalogue_rand[, ...])

Compute correlation function window from a random catalogue.

triumvirate.twopt.compute_powspec(catalogue_data, catalogue_rand, los_data=None, los_rand=None, degree=None, binning=None, sampling_params=None, paramset=None, save=False, logger=None)[source]#

Compute power spectrum from survey-like data and random catalogues in the local plane-parallel approximation.

Parameters
  • catalogue_data (ParticleCatalogue) – Data-source catalogue.

  • catalogue_rand (ParticleCatalogue) – Random-source catalogue.

  • los_data ((N, 3) array of float, optional) – Specified lines of sight for the data-source catalogue. If None (default), this is automatically computed using compute_los().

  • los_rand ((N, 3) array of float, optional) – Specified lines of sight for the random-source catalogue. If None (default), this is automatically computed using compute_los().

  • degree (int, optional) – Multipole degree. If not None (default), this will override paramset['degrees']['ELL'].

  • binning (Binning, optional) – Binning for the measurements. If None (default), this is constructed from paramset.

  • sampling_params (dict, optional) – Dictionary containing a subset of the following entries for sampling parameters—

    • ‘alignment’: {‘centre’, ‘pad’};

    • ‘boxsize’: sequence of [float, float, float];

    • ‘ngrid’: sequence of [int, int, int];

    • ‘assignment’: {‘ngp’, ‘cic’, ‘tsc’, ‘pcs’};

    • ‘interlace’: bool;

    and exactly one of the following only when ‘alignment’ is ‘pad’—

    • ‘boxpad’: float;

    • ‘gridpad’: float.

    If not None (default), this will override the corresponding entries in paramset.

  • paramset (ParameterSet, optional) – Full parameter set (default is None). This is used in lieu of degree, binning or sampling_params.

  • save ({‘.txt’, ‘.npz’, False}, optional) – If not False (default), save the measurements as a ‘.txt’ file or in ‘.npz’ format. The save path is determined from paramset (if unset, a default file path in the current working directory is used).

  • logger (logging.Logger, optional) – Logger (default is None).

Returns

results – Measurement results as a dictionary with the following entries—

  • ‘kbin’: central wavenumber for each bin;

  • ’keff’: effective wavenumber for each bin;

  • ’nmodes’: number of wavevector modes in each bin;

  • ’pk_raw’: power spectrum raw measurements including any specified normalisation and shot noise;

  • ’pk_shot’: power spectrum shot noise.

The effective wavenumber is here defined as the average wavenumber in each bin.

Return type

dict of {str: numpy.ndarray}

Raises

ValueError – When paramset is None but degree, binning or sampling_params is also None.

Examples

Specify line-of-sight vectors explicitly.

>>> results = compute_powspec(
...     catalogue_data, catalogue_rand,
...     los_data=np.ones((1e3, 3)), los_rand=np.ones((1e4, 3)),
...     paramset=None
... )

Specify multipole degree 2 and provide customised Binning object binning. Whether paramset provided or not, relevant parameters are overriden by the supplied keyword arguments.

>>> results = compute_powspec(
...     catalogue_data, catalogue_rand,
...     degree=2,
...     binning=binning,
...     sampling_params={
...         'boxsize': [1000., 1500., 1000.],
...         'ngrid': [256, 256, 256],
...         # 'alignment' at default initial value in `ParameterSet`
...         # 'assignment' at default initial value in `ParameterSet`
...     }
... )
triumvirate.twopt.compute_corrfunc(catalogue_data, catalogue_rand, los_data=None, los_rand=None, degree=None, binning=None, sampling_params=None, paramset=None, save=False, logger=None)[source]#

Compute correlation function from survey-like data and random catalogues in the local plane-parallel approximation.

Parameters
  • catalogue_data (ParticleCatalogue) – Data-source catalogue.

  • catalogue_rand (ParticleCatalogue) – Random-source catalogue.

  • los_data ((N, 3) array of float, optional) – Specified lines of sight for the data-source catalogue. If None (default), this is automatically computed using compute_los().

  • los_rand ((N, 3) array of float, optional) – Specified lines of sight for the random-source catalogue. If None (default), this is automatically computed using compute_los().

  • degree (int, optional) – Multipole degree. If not None (default), this will override paramset['degrees']['ELL'].

  • binning (Binning, optional) – Binning for the measurements. If None (default), this is constructed from paramset.

  • sampling_params (dict, optional) – Dictionary containing a subset of the following entries for sampling parameters—

    • ‘alignment’: {‘centre’, ‘pad’};

    • ‘boxsize’: sequence of [float, float, float];

    • ‘ngrid’: sequence of [int, int, int];

    • ‘assignment’: {‘ngp’, ‘cic’, ‘tsc’, ‘pcs’};

    • ‘interlace’: bool;

    and exactly one of the following only when ‘alignment’ is ‘pad’—

    • ‘boxpad’: float;

    • ‘gridpad’: float.

    If not None (default), this will override the corresponding entries in paramset.

  • paramset (ParameterSet, optional) – Full parameter set (default is None). This is used in lieu of degree, binning or sampling_params.

  • save ({‘.txt’, ‘.npz’, False}, optional) – If not False (default), save the measurements as a ‘.txt’ file or in ‘.npz’ format. The save path is determined from paramset (if unset, a default file path in the current working directory is used).

  • logger (logging.Logger, optional) – Logger (default is None).

Returns

results – Measurement results as a dictionary with the following entries—

  • ‘rbin’: central separation for each bin;

  • ’reff’: effective separation for each bin;

  • ’npairs’: number of separation pairs in each bin;

  • ’xi’: two-point correlation function measurements.

The effective separation is here defined as the average separation in each bin.

Return type

dict of {str: numpy.ndarray}

Raises

ValueError – When paramset is None but degree, binning or sampling_params is also None.

Examples

See analogous examples in compute_powspec().

triumvirate.twopt.compute_powspec_in_gpp_box(catalogue_data, degree=None, binning=None, sampling_params=None, paramset=None, save=False, logger=None)[source]#

Compute power spectrum from a simulation-box catalogue in the global plane-parallel approximation.

Parameters
  • catalogue_data (ParticleCatalogue) – Data-source catalogue.

  • degree (int, optional) – Multipole degree. If not None (default), this will override paramset['degrees']['ELL'].

  • binning (Binning, optional) – Binning for the measurements. If None (default), this is constructed from paramset.

  • sampling_params (dict, optional) – Dictionary containing a subset of the following entries for sampling parameters—

    • ‘alignment’: {‘centre’, ‘pad’};

    • ‘boxsize’: sequence of [float, float, float];

    • ‘ngrid’: sequence of [int, int, int];

    • ‘assignment’: {‘ngp’, ‘cic’, ‘tsc’, ‘pcs’};

    • ‘interlace’: bool;

    and exactly one of the following only when ‘alignment’ is ‘pad’—

    • ‘boxpad’: float;

    • ‘gridpad’: float.

    If not None (default), this will override the corresponding entries in paramset.

  • paramset (ParameterSet, optional) – Full parameter set (default is None). This is used in lieu of degree, binning or sampling_params.

  • save ({‘.txt’, ‘.npz’, False}, optional) – If not False (default), save the measurements as a ‘.txt’ file or in ‘.npz’ format. The save path is determined from paramset (if unset, a default file path in the current working directory is used).

  • logger (logging.Logger, optional) – Logger (default is None).

Returns

results – Measurement results as a dictionary with the following entries—

  • ‘kbin’: central wavenumber for each bin;

  • ’keff’: effective wavenumber for each bin;

  • ’nmodes’: number of wavevector modes in each bin;

  • ’pk_raw’: power spectrum raw measurements including any specified normalisation and shot noise;

  • ’pk_shot’: power spectrum shot noise.

The effective wavenumber is here defined as the average wavenumber in each bin.

Return type

dict of {str: numpy.ndarray}

Raises

ValueError – When paramset is None but degree, binning or sampling_params is also None.

Examples

See analogous examples in compute_powspec() (though without the line-of-sight arguments).

triumvirate.twopt.compute_corrfunc_in_gpp_box(catalogue_data, degree=None, binning=None, sampling_params=None, paramset=None, save=False, logger=None)[source]#

Compute correlation function from a simulation-box catalogue in the global plane-parallel approximation.

Parameters
  • catalogue_data (ParticleCatalogue) – Data-source catalogue.

  • degree (int, optional) – Multipole degree. If not None (default), this will override paramset['degrees']['ELL'].

  • binning (Binning, optional) – Binning for the measurements. If None (default), this is constructed from paramset.

  • sampling_params (dict, optional) – Dictionary containing a subset of the following entries for sampling parameters—

    • ‘alignment’: {‘centre’, ‘pad’};

    • ‘boxsize’: sequence of [float, float, float];

    • ‘ngrid’: sequence of [int, int, int];

    • ‘assignment’: {‘ngp’, ‘cic’, ‘tsc’, ‘pcs’};

    • ‘interlace’: bool;

    and exactly one of the following only when ‘alignment’ is ‘pad’—

    • ‘boxpad’: float;

    • ‘gridpad’: float.

    If not None (default), this will override the corresponding entries in paramset.

  • paramset (ParameterSet, optional) – Full parameter set (default is None). This is used in lieu of degree, binning or sampling_params.

  • save ({‘.txt’, ‘.npz’, False}, optional) – If not False (default), save the measurements as a ‘.txt’ file or in ‘.npz’ format. The save path is determined from paramset (if unset, a default file path in the current working directory is used).

  • logger (logging.Logger, optional) – Logger (default is None).

Returns

results – Measurement results as a dictionary with the following entries—

  • ‘rbin’: central separation for each bin;

  • ’reff’: effective separation for each bin;

  • ’npairs’: number of separation pairs in each bin;

  • ’xi’: two-point correlation function measurements.

The effective separation is here defined as the average separation in each bin.

Return type

dict of {str: numpy.ndarray}

Raises

ValueError – When paramset is None but degree, binning or sampling_params is also None.

Examples

See analogous examples in compute_powspec() (though without the line-of-sight arguments).

triumvirate.twopt.compute_corrfunc_window(catalogue_rand, los_rand=None, degree=None, binning=None, sampling_params=None, paramset=None, save=False, logger=None)[source]#

Compute correlation function window from a random catalogue.

Parameters
  • catalogue_rand (ParticleCatalogue) – Random-source catalogue.

  • los_rand ((N, 3) array of float, optional) – Specified lines of sight for the random-source catalogue. If None (default), this is automatically computed using compute_los().

  • degree (int, optional) – Multipole degree. If not None (default), this will override paramset['degrees']['ELL'].

  • binning (Binning, optional) – Binning for the measurements. If None (default), this is constructed from paramset.

  • sampling_params (dict, optional) – Dictionary containing a subset of the following entries for sampling parameters—

    • ‘alignment’: {‘centre’, ‘pad’};

    • ‘boxsize’: sequence of [float, float, float];

    • ‘ngrid’: sequence of [int, int, int];

    • ‘assignment’: {‘ngp’, ‘cic’, ‘tsc’, ‘pcs’};

    • ‘interlace’: bool;

    and exactly one of the following only when ‘alignment’ is ‘pad’—

    • ‘boxpad’: float;

    • ‘gridpad’: float.

    If not None (default), this will override the corresponding entries in paramset.

  • paramset (ParameterSet, optional) – Full parameter set (default is None). This is used in lieu of degree, binning or sampling_params.

  • save ({‘.txt’, ‘.npz’, False}, optional) – If not False (default), save the measurements as a ‘.txt’ file or in ‘.npz’ format. The save path is determined from paramset (if unset, a default file path in the current working directory is used).

  • logger (logging.Logger, optional) – Logger (default is None).

Returns

results – Measurement results as a dictionary with the following entries—

  • ‘rbin’: central separation for each bin;

  • ’reff’: effective separation for each bin;

  • ’npairs’: number of separation pairs in each bin;

  • ’xi’: two-point correlation function window measurements.

The effective separation is here defined as the average separation in each bin.

Return type

dict of {str: numpy.ndarray}

Raises

ValueError – When paramset is None but degree, binning or sampling_params is also None.

Examples

See analogous examples in compute_powspec().