pybird.correlator module
- class pybird.correlator.Correlator(config_dict=None, load_engines=True)[source]
Bases:
object
A class for computing cosmological correlation functions.
The Correlator class provides functionality to compute various cosmological correlation functions, including power spectra and correlation functions for biased tracers and matter. It implements Effective Field Theory (EFT) of Large Scale Structure calculations with various options for bias models, IR resummation, AP effect, and other corrections.
- projection
Engine for projections and coordinate transformations.
- Type:
- Private Methods:
__read_cosmo(): Read and validate cosmological parameters. __is_cosmo_conflict(): Check for conflicts in cosmological parameters. __is_bias_conflict(): Check for conflicts in bias parameters. __set_eft_parameters_list(): Set lists of required EFT parameters. __read_config(): Read and validate configuration parameters. __is_config_conflict(): Check for conflicts in configuration parameters.
- info(description=True)[source]
Display information about available configuration and cosmology parameters.
- Parameters:
description (bool, optional) – Whether to include parameter descriptions and defaults, by default True
Notes
This method prints two catalogs: - Configuration commands: parameters for .set(config_dict) - Cosmology commands: parameters for .compute(cosmo_dict)
- set(config_dict, load_engines=True)[source]
Set configuration parameters and initialize engines.
- Parameters:
Notes
This method: 1. Reads and validates the provided configuration 2. Sets default values for optional parameters 3. Checks for configuration conflicts 4. Loads PyBird computational engines if requested
- compute(cosmo_dict=None, cosmo_module=None, cosmo_engine=None, do_core=True, do_survey_specific=True)[source]
Compute cosmological correlations based on provided parameters.
- Parameters:
cosmo_dict (dict, optional) – Dictionary of cosmological parameters for PyBird inputs
cosmo_module (str, optional) – Name of Boltzmann solver to call internally (e.g., ‘classy’, ‘camb’)
cosmo_engine (object, optional) – External Boltzmann solver engine object
do_core (bool, optional) – Whether to perform core EFT calculations, by default True
do_survey_specific (bool, optional) – Whether to apply survey-specific effects, by default True
Notes
You must provide either: - cosmo_dict with PyBird parameters, or - cosmo_dict with cosmological parameters + cosmo_module, or - cosmo_module + cosmo_engine for external Boltzmann solver
The method handles cosmological parameter processing, validates inputs, and performs the main EFT calculations for power spectra or correlation functions.
- get(bias=None, what='full')[source]
Get the computed power spectrum or correlation function.
- Parameters:
- Returns:
Computed power spectrum (if output=’Pk’) or correlation function (if output=’Cf’) Shape depends on configuration (multipoles, redshift bins, etc.)
- Return type:
ndarray
- getmarg(bias, marg_gauss_eft_parameters_list)[source]
Get marginalized EFT parameters.
- Parameters:
Notes
This method implements analytical marginalization over nuisance EFT parameters assuming Gaussian priors. Common parameters to marginalize include stochastic terms like ‘ce0’, ‘ce1’, ‘ce2’ and higher-order bias terms.
- load_engines(load_engines=True)[source]
Load and initialize computational engines.
- Parameters:
load_engines (bool, optional) – Whether to actually load the engines, by default True
Notes
This method initializes all the computational engines needed for PyBird: - Common: shared parameters and utilities - NonLinear: one-loop calculations - Resum: IR resummation - Projection: multipole projections and survey effects - Matching: UV/IR matching (if needed) - Emulator: neural network emulator (if enabled)
- class pybird.correlator.BiasCorrelator(config_dict=None, load_engines=False)[source]
Bases:
Correlator
A class for loading pre-computed correlations.
BiasCorrelator extends the Correlator class to work with pre-computed correlation functions. It initializes with load_engines=False by default since computational engines are typically not needed for pre-computed results.
- Inherits all attributes from Correlator.
- Inherits all methods from Correlator.
- class pybird.correlator.Option(config_name, config_type, config_list=None, description='', default=None, verbose=False)[source]
Bases:
object
A class for handling configuration options with validation.
The Option class represents a single configuration parameter with its allowed types, values, description, and default value. It provides methods for validating user-provided values.
- default
Default value for the option.
- Type:
any
- value
Current value of the option.
- Type:
any