yaw.config.Configuration#

class yaw.config.Configuration(scales: ~yaw.config.scales.ScalesConfig, binning: ~yaw.config.binning.BinningConfig, backend: ~yaw.config.backend.BackendConfig = <factory>, cosmology: ~astropy.cosmology.flrw.base.FLRW | ~yaw.core.cosmology.CustomCosmology | str | None = 'Planck15')[source]#

Bases: BaseConfig

The central configration for correlation measurements.

Bundles the configuration of measurement scales, redshift binning, and backend parameters in a single, hierarchical configuration class. Additionally holds the cosmological model used for distance calculations.

Note

The structure and meaning of the parameters is described in more detail in the specialised configuration objects ScalesConfig, BinningConfig, BackendConfig, which are stored as class attributes scales, binning, and backend.

To access e.g. the lower measurement scale limit, use

>>> Configuration.scales.rmin
...

which accesses the ScalesConfig.rmin attribute.

A new instance should be constructed with the create() method or as a modified variant with the modify() method.

Parameters:
  • scales (ScalesConfig) – The configuration of the measurement scales.

  • binning (BinningConfig) – The redshift binning configuration.

  • backend (BackendConfig) – The backend-specific configuration.

  • cosmology (astropy.cosmology.FLRW, CustomCosmology, str, None, optional) – The cosmological model for distance calculations.

Methods

__init__(scales, binning[, backend, cosmology])

create(*[, cosmology, rweight, rbin_num, ...])

Create a new configuration object.

from_dict(the_dict, **kwargs)

Create a class instance from a dictionary representation of the minimally required data.

from_yaml(path)

Create a new instance by loading the configuration from a YAML file.

modify(*[, cosmology, rmin, rmax, rweight, ...])

Create a copy of the current configuration with updated parameter values.

plot_scales(catalog[, log, legend])

Plot the configured correlation scales at different redshifts in comparison to the size of patches in a data catalogue.

to_dict()

Serialise the class instance to a dictionary containing a minimal set of required data.

to_yaml(path)

Store the configuration as YAML file.

Attributes

cosmology

The cosmological model for distance calculations.

scales

The configuration of the measurement scales.

binning

The redshift binning configuration.

backend

The backend-specific configuration.

backend: BackendConfig#

The backend-specific configuration.

binning: BinningConfig#

The redshift binning configuration.

cosmology: FLRW | CustomCosmology | str | None = 'Planck15'#

The cosmological model for distance calculations.

classmethod create(*, cosmology: TypeCosmology | str | None = 'Planck15', rmin: ArrayLike, rmax: ArrayLike, rweight: float | None = None, rbin_num: int = 50, zmin: ArrayLike = None, zmax: ArrayLike = None, zbin_num: int | None = 30, method: str = 'linear', zbins: NDArray[np.float64] | None = None, thread_num: int | None = None, crosspatch: bool = True, rbin_slop: float = 0.01) Configuration[source]#

Create a new configuration object.

Except for the cosmology parameter, all other parameters are passed to the constructors of the respective ScalesConfig, BinningConfig, and BackendConfig classes.

Note

If custom bin edges are provided through the zbins parameter, zmin, zmax, zbin_num (optional), and method (optional) are ignored. Otherwise, at least zmin, zmax are required and a binning will be generated automatically.

Otherwise, only rmin and rmax are required arguments, e.g.:

>>> yaw.Configuration.create(rmin=100, rmax=1000, zmin=0.1, zmax=1.0)
Keyword Arguments:
  • cosmology (astropy.cosmology.FLRW, CustomCosmology, str, None, optional) – Named astropy cosmology used to compute distances. For options see cosmology.

  • rmin (ArrayLike) – (List of) lower scale limit in kpc (pyhsical).

  • rmax (ArrayLike) – (List of) upper scale limit in kpc (pyhsical).

  • rweight (float, optional) – Weight galaxy pairs by their separation to power ‘rweight’.

  • rbin_num (int, optional) – Number of bins in log r used (i.e. resolution) to compute distance weights.

  • zmin (float) – Lower redshift limit.

  • zmax (float) – Upper redshift limit.

  • zbin_num (int, optional) – Number of redshift bins

  • method (str, optional) – Method used to generate the redshift binning. For options see binning.

  • zbins (NDArray, optional) – Manually define redshift bin edges.

  • thread_num (int, optional) – Default number of threads to use.

  • crosspatch (bool, optional) – whether to count pairs across patch boundaries (scipy backend only)

  • rbin_slop (float, optional) – TreeCorr ‘rbin_slop’ parameter

Returns:

Configuration

classmethod from_dict(the_dict: dict[str, Any], **kwargs) Configuration[source]#

Create a class instance from a dictionary representation of the minimally required data.

Parameters:
  • the_dict (dict) – Dictionary containing the data.

  • **kwargs – Additional data needed to construct the class instance.

classmethod from_yaml(path: TypePathStr) Configuration[source]#

Create a new instance by loading the configuration from a YAML file.

Parameters:

path (pathlib.Path, str) – Path to the YAML file containing the configuration.

Returns:

Configuration

modify(*, cosmology: TypeCosmology | str | None = NotSet, rmin: ArrayLike | None = NotSet, rmax: ArrayLike | None = NotSet, rweight: float | None = NotSet, rbin_num: int | None = NotSet, zmin: float | None = NotSet, zmax: float | None = NotSet, zbin_num: int | None = NotSet, method: str | None = NotSet, zbins: NDArray[np.float64] | None = NotSet, thread_num: int | None = NotSet, crosspatch: bool | None = NotSet, rbin_slop: float | None = NotSet) Configuration[source]#

Create a copy of the current configuration with updated parameter values.

The method arguments are identical to create(). Values that should not be modified are by default represented by the special value NotSet.

plot_scales(catalog: BaseCatalog, log: bool = True, legend: bool = True) Figure[source]#

Plot the configured correlation scales at different redshifts in comparison to the size of patches in a data catalogue.

Deprecated since version 2.5.3: No longer maintained.

scales: ScalesConfig#

The configuration of the measurement scales.

to_dict() dict[str, Any][source]#

Serialise the class instance to a dictionary containing a minimal set of required data.

Returns:

dict

to_yaml(path: TypePathStr) None[source]#

Store the configuration as YAML file.

Parameters:

path (pathlib.Path, str) – Path to which the YAML file is written.