yaw.config.BinningConfig#

class yaw.config.BinningConfig(zbins: NDArray[np.float64], method: str = 'linear')[source]#

Bases: BaseConfig

TODO

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

is_manual

Whether the redshift bins are set manually.

method

Method used to create redshift binning (defaults to 'manual' if zbins are provided), see binning for options.

zbin_num

Number of redshift bins.

zbins

Edges of redshift bins.

zmin

Lowest redshift bin edge.

zmax

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, method is set to "manual" and the bins edges are used. If zmin and zmax are 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 cosmology parameter 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 if zmin and zmax are 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 see binning.

  • cosmology (astropy.cosmology.FLRW, CustomCosmology, optional) – Cosmological model used for distance calculations. For a custom model, refer to yaw.core.cosmology.

Returns:

BinningConfig

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 to yaw.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 binning for 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 value NotSet.

Note

The cosmology parameter 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.