yaw.config.ScalesConfig#
- class yaw.config.ScalesConfig(rmin: Iterable[float] | float, rmax: Iterable[float] | float, *, unit: Unit = Unit.kpc, rweight: float | None = None, resolution: int | None = None)[source]#
Bases:
BaseConfig,ImmutableConfiguration 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__(rmin, rmax, *[, unit, rweight, ...])create(*, rmin, rmax[, unit, rweight, ...])Create a new instance with the given parameters.
from_dict(the_dict)Restore the class instance from a python dictionary.
from_file(path)Restore the class instance from a YAML file.
Generate a listing of parameters that may be used by external tool to auto-generate an interface to this configuration class.
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 multiple upper scale limits in given unit of scales.
Single or multiple lower scale limits in given unit of scales.
String describing the angular, physical, or comoving unit of correlation scales (default: kpc).
Correlation scales in angular or physical units.
Optional power-law exponent \(\alpha\) used to weight pairs by their separation.
Optional 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 from_dict(the_dict: dict[str, Any]) TypeBaseConfig#
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() ParamSpec[source]#
Generate a listing of parameters that may be used by external tool to auto-generate an interface to this configuration class.
- Returns:
A
ParamSpecinstance, that is a key-value mapping from parameter name to the parameter meta data for this configuration class.
- 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#
Optional number of radial logarithmic bin used to approximate the weighting by separation.
- property rmax: float | list[float]#
Single or multiple upper scale limits in given unit of scales.
- property rmin: float | list[float]#
Single or multiple lower scale limits in given unit of scales.
- rweight: float | None#
Optional power-law exponent \(\alpha\) used to weight pairs by their separation.
- scales: Scales#
Correlation scales in angular or physical units.
- to_dict() dict[str, Any][source]#
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#
String describing the angular, physical, or comoving unit of correlation scales (default: kpc).