yaw.config.BinningConfig#
- class yaw.config.BinningConfig(zbins: NDArray[np.float64], method: str = 'linear')[source]#
Bases:
BaseConfigTODO
Methods
__init__(zbins[, method])create(*[, zbins, zmin, zmax, zbin_num, ...])Create a new redshift binning configuration.
from_dict(the_dict[, cosmology])Create a class instance from a dictionary representation of the minimally required data.
modify([zbins, zmin, zmax, zbin_num, ...])Create a copy of the current configuration with updated parameter values.
to_dict()Serialise the class instance to a dictionary containing a minimal set of required data.
Attributes
Whether the redshift bins are set manually.
Method used to create redshift binning (defaults to 'manual' if zbins are provided), see
binningfor options.Number of redshift bins.
Edges of redshift bins.
Lowest redshift bin edge.
Highest redshift bin edge.
- classmethod create(*, zbins: NDArray[np.float64] | None = None, zmin: float | None = None, zmax: float | None = None, zbin_num: int = 30, method: str = 'linear', cosmology: TypeCosmology | str | None = None) BinningConfig[source]#
Create a new redshift binning configuration.
If redshift bins (
zbins) are provided,methodis set to"manual"and the bins edges are used. Ifzminandzmaxare provided, instead generates a specified number of bins between this lower and upper redshift limit. The spacing of the bins depends the generation method, the default is a linear spacing.Note
The
cosmologyparameter is only used when generating binnings that require cosmological distance computations.- Parameters:
zbins (
NDArray[np.float64]) – Monotonically increasing redshift bin edges, including the upper edge (ignored ifzminandzmaxare provided).zmin (
float) – Minimum redshift, lowest redshift edge.zmax (
float) – Maximum redshift, highest redshift edge.zbin_num (
int, optional) – Number of redshift bins to generate.method (
str, optional) – Method used to create redshift binning, for a list of valid options and their description seebinning.cosmology (
astropy.cosmology.FLRW,CustomCosmology, optional) – Cosmological model used for distance calculations. For a custom model, refer toyaw.core.cosmology.
- Returns:
- classmethod from_dict(the_dict: dict[str, Any], cosmology: FLRW | CustomCosmology | None = None) BinningConfig[source]#
Create a class instance from a dictionary representation of the minimally required data.
- Parameters:
the_dict (
dict) – Dictionary containing the data.cosmology (
astropy.cosmology.FLRW,CustomCosmology, optional) – Cosmological model used for distance calculations. For a custom model, refer toyaw.core.cosmology.
- property is_manual: bool#
Whether the redshift bins are set manually.
- method: str = 'linear'#
Method used to create redshift binning (defaults to ‘manual’ if zbins are provided), see
binningfor options.
- modify(zbins: NDArray[np.float64] | None = NotSet, zmin: float | None = NotSet, zmax: float | None = NotSet, zbin_num: int = NotSet, method: str = NotSet, cosmology: TypeCosmology | str | None = None) BinningConfig[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.Note
The
cosmologyparameter is only used when generating binnings that require cosmological distance computations.
- to_dict() dict[str, Any][source]#
Serialise the class instance to a dictionary containing a minimal set of required data.
- Returns:
dict
- zbin_num: int = 30#
Number of redshift bins.
- zbins: NDArray[np.float64]#
Edges of redshift bins.
- zmax: float#
Highest redshift bin edge.
- zmin: float#
Lowest redshift bin edge.