yaw.config.ScalesConfig#
- class yaw.config.ScalesConfig(scales: Scales, rweight: float | None, resolution: int | None)[source]#
Bases:
YawConfigConfiguration for correlation function measurement scales.
Correlations are measured by counting all pairs between a minimum and maximum physical scale given in kpc. The code can be configured with either a single scale range or multiple (overlapping) scale ranges.
Additionally, pair counts can be weighted by the separation distance using a power law \(w(r) \propto r^\alpha\). For performance reasons, the pair counts are not weighted indivudially but in fine logarithmic bins of angular separation, i.e. \(w(r) \sim w(r_i)\), where \(r_i\) is the logarithmic center of the \(i\)-th bin.
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.Methods
__init__(scales, rweight, resolution)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
Number of correlation scales.
Single or sequence of upper scale limits in given 'unit'.
Single or sequence of lower scale limits in given 'unit'.
kpc).
Correlation scales in angular or physical units.
Power-law exponent used to weight pairs by their separation.
Number of radial logarithmic bin used to approximate the weighting by separation.
- classmethod create(*, rmin: Iterable[float] | float, rmax: Iterable[float] | float, unit: Unit = Unit.kpc, rweight: float | None = None, resolution: int | None = None) ScalesConfig[source]#
Create a new instance with the given parameters.
- Keyword Arguments:
rmin – Single or multiple lower scale limits in given unit of scales.
rmax – Single or multiple upper scale limits in given unit of scales.
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.
- Returns:
New configuration instance.
- 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)[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) TypeYamlSerialisable#
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.
- 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) ScalesConfig[source]#
Create a new configuration instance with updated parameter values.
Parameter values are only updated if they are provided as inputs to this function, otherwise they are retained from the original instance.
- Keyword Arguments:
rmin – Single or multiple lower scale limits in given unit of scales.
rmax – Single or multiple upper scale limits in given unit of scales.
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.
- Returns:
New instance with updated parameter values.
- property num_scales: int#
Number of correlation scales.
- resolution: int | None#
Number of radial logarithmic bin used to approximate the weighting by separation.
- property rmax: float | list[float]#
Single or sequence of upper scale limits in given ‘unit’.
- property rmin: float | list[float]#
Single or sequence of lower scale limits in given ‘unit’.
- rweight: float | None#
Power-law exponent used to weight pairs by their separation.
- scales: Scales#
Correlation scales in angular or physical units.
- 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#
Serialise the class instances into a YAML file.
- Parameters:
path – Path (
strorpathlib.Path) to YAML file to serialise into, see alsofrom_file().
- property unit: str#
kpc).
- Type:
The unit of the lower and upper scale limits (default