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:
BaseConfigThe 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 attributesscales,binning, andbackend.To access e.g. the lower measurement scale limit, use
>>> Configuration.scales.rmin ...
which accesses the
ScalesConfig.rminattribute.A new instance should be constructed with the
create()method or as a modified variant with themodify()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
The cosmological model for distance calculations.
The configuration of the measurement scales.
The redshift binning configuration.
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
cosmologyparameter, all other parameters are passed to the constructors of the respectiveScalesConfig,BinningConfig, andBackendConfigclasses.Note
If custom bin edges are provided through the
zbinsparameter,zmin,zmax,zbin_num(optional), andmethod(optional) are ignored. Otherwise, at leastzmin,zmaxare required and a binning will be generated automatically.Otherwise, only
rminandrmaxare 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 seecosmology.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 binsmethod (
str, optional) – Method used to generate the redshift binning. For options seebinning.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:
- 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:
- 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 valueNotSet.
- 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.