yaw.Configuration#
- class yaw.Configuration(scales: ScalesConfig, binning: BinningConfig, cosmology: FLRW | CustomCosmology | str, max_workers: int | None)[source]#
Bases:
YawConfigConfiguration for correlation function measurements.
This is the top-level configuration class for yet_another_wizz, defining correlation scales, redshift binning, and the cosmological model used for distance calculations.
Note
The preferred way to create a new configuration instance is using the
create()constructor.All configuration objects are immutable. To modify an existing configuration, create a new instance with updated values by using the
modify()method. The bin edges are recomputed when necessary.Methods
__init__(scales, binning, cosmology, max_workers)create(*, rmin, rmax[, unit, rweight, ...])Create a new instance with the given parameters.
format_yaml_doc(*[, indentation, padding])Format the parameter as YAML for documentation purposes.
from_dict(the_dict)Restore the class instance from a python dictionary.
from_file(path)Restore the class instance from a YAML file.
Get a mapping of paramter name to parameter meta-data.
modify(*[, rmin, rmax, unit, rweight, ...])Create a new configuration instance with updated parameter values.
to_dict()Serialise the class instances into a dictionary.
to_file(path)Serialise the class instances into a YAML file.
Attributes
Configuration of correlation scales.
Configuration of redshift bins used for sampling the redshift estimate.
Cosmological model to use for distance computations.
Limit the number of workers for parallel operations (all by default).
- binning: BinningConfig#
Configuration of redshift bins used for sampling the redshift estimate.
- cosmology: FLRW | CustomCosmology | str#
Cosmological model to use for distance computations.
- classmethod create(*, rmin: Iterable[float] | float, rmax: Iterable[float] | float, unit: Unit = Unit.kpc, rweight: float | None = None, resolution: int | None = None, zmin: float | None = None, zmax: float | None = None, num_bins: int = 30, method: BinMethod | str = BinMethod.linear, edges: Iterable[float] | None = None, closed: Closed | str = Closed.right, cosmology: TypeCosmology | str | None = 'Planck15', max_workers: int | None = None) Self[source]#
Create a new instance with the given parameters.
- Keyword Arguments:
rmin – Single or multiple lower scale limits in kpc (angular diameter distance).
rmax – Single or multiple upper scale limits in kpc (angular diameter distance).
unit – String describing the angular, physical, or comoving unit of correlation scales, see
Unitfor valid options (default: kpc).rweight – Optional power-law exponent \(\alpha\) used to weight pairs by their separation.
resolution – Optional number of radial logarithmic bin used to approximate the weighting by separation.
zmin – Lowest redshift bin edge to generate.
zmax – Highest redshift bin edge to generate.
num_bins – Number of redshift bins to generate.
method – Method used to generate the bin edges, see
BinMethodfor valid options.edges – Use these custom bin edges instead of generating them.
closed – Indicating which side of the bin edges is a closed interval, see
Closedfor valid options.cosmology – Optional cosmological model to use for distance computations.
max_workers – Limit the number of parallel workers for this operation (all by default, only multiprocessing).
- Returns:
New configuration instance.
Note
Although the function parameters are optional, either
zminandzmax(generate bin edges), oredges(custom bin edges) must be provided.
- classmethod format_yaml_doc(*, indentation: TextIndenter | None = None, padding: int = 24) str#
Format the parameter as YAML for documentation purposes.
Writes a mapping of parameter names to default values (if given, otherwise blank) followed by comments containing the help messages, whether parameter are required and possible choices. If the class contains configuration sub-classes, include them hierarchically as a mapping sub-section.
- Parameters:
indentation – Use this indenter to determine the appropriate line indentation.
padding – Padding in spaces between YAML text and comment.
- classmethod from_dict(the_dict: dict[str, Any]) Self[source]#
Restore the class instance from a python dictionary.
- Parameters:
the_dict – Dictionary containing all required data attributes to restore the instance, see also
to_dict().- Returns:
Restored class instance.
- classmethod from_file(path: Path | str) Self[source]#
Restore the class instance from a YAML file.
- Parameters:
path – Path (
strorpathlib.Path) to YAML file to restore from, see alsoto_file().- Returns:
Restored class instance.
- classmethod get_paramspec() dict[str, ConfigSection | Parameter]#
Get a mapping of paramter name to parameter meta-data.
- max_workers: int | None#
Limit the number of workers for parallel operations (all by default).
- modify(*, rmin: Iterable[float] | float | NotSet = NotSet, rmax: Iterable[float] | float | NotSet = NotSet, unit: Unit | NotSet = NotSet, rweight: float | None | NotSet = NotSet, resolution: int | None | NotSet = NotSet, zmin: float | NotSet = NotSet, zmax: float | NotSet = NotSet, num_bins: int | NotSet = NotSet, method: BinMethod | str | NotSet = NotSet, edges: Iterable[float] | None = NotSet, closed: Closed | str | NotSet = NotSet, cosmology: TypeCosmology | str | None | NotSet = NotSet, max_workers: int | None | NotSet = NotSet) Self[source]#
Create a new configuration instance with updated parameter values.
Parameter values are only updated if they are provided as inputs to this function and retained from the original instance otherwise.
- Keyword Arguments:
rmin – Single or multiple lower scale limits in kpc (angular diameter distance).
rmax – Single or multiple upper scale limits in kpc (angular diameter distance).
unit – String describing the angular, physical, or comoving unit of correlation scales, see
Unitfor valid options (default: kpc).rweight – Optional power-law exponent \(\alpha\) used to weight pairs by their separation.
resolution – Optional number of radial logarithmic bin used to approximate the weighting by separation.
zmin – Lowest redshift bin edge to generate.
zmax – Highest redshift bin edge to generate.
num_bins – Number of redshift bins to generate.
method – Method used to generate the bin edges, see
BinMethodfor valid options.edges – Use these custom bin edges instead of generating them.
closed – Indicating which side of the bin edges is a closed interval, see
Closedfor valid options.cosmology – Optional cosmological model to use for distance computations.
max_workers – Limit the number of parallel workers for this operation (all by default, only multiprocessing).
- Returns:
New instance with updated parameter values.
- scales: ScalesConfig#
Configuration of correlation scales.
- to_dict() dict[str, Any]#
Serialise the class instances into a dictionary.
- Returns:
A dictionary containnig the minimal set of data attributes to restore the instance with
from_dict().
- to_file(path: Path | str) None[source]#
Serialise the class instances into a YAML file.
- Parameters:
path – Path (
strorpathlib.Path) to YAML file to serialise into, see alsofrom_file().