From 8e83525da57a088a7ca9cfcce38fd54457d40b69 Mon Sep 17 00:00:00 2001 From: Sandro Dias Pinto Vitenti Date: Wed, 20 Sep 2023 20:42:53 -0300 Subject: [PATCH 1/4] * New attribure for Updatables: parameter_prefix. * Added the necessary calls to make the current Updatable implementation to pass sacc_tracer as the default parameter_prefix. --- .../statistic/cluster_number_counts.py | 16 ++-- .../statistic/source/number_counts.py | 88 ++++++++++--------- .../gauss_family/statistic/source/source.py | 9 ++ .../statistic/source/weak_lensing.py | 70 +++++++-------- .../gauss_family/statistic/statistic.py | 4 +- .../gauss_family/statistic/supernova.py | 2 +- firecrown/updatable.py | 20 +++-- .../statistic/source/test_source.py | 4 +- 8 files changed, 113 insertions(+), 100 deletions(-) diff --git a/firecrown/likelihood/gauss_family/statistic/cluster_number_counts.py b/firecrown/likelihood/gauss_family/statistic/cluster_number_counts.py index 0f3246cbc..a7d41b3fc 100644 --- a/firecrown/likelihood/gauss_family/statistic/cluster_number_counts.py +++ b/firecrown/likelihood/gauss_family/statistic/cluster_number_counts.py @@ -46,8 +46,8 @@ def __init__( :param systematics: A list of the statistics-level systematics to apply to the statistic. The default of `None` implies no systematics. """ - super().__init__() - self.sacc_tracer = survey_tracer + super().__init__(parameter_prefix=survey_tracer) + self.survey_tracer = survey_tracer self.systematics = systematics or [] self.data_vector: Optional[DataVector] = None self.theory_vector: Optional[TheoryVector] = None @@ -84,13 +84,13 @@ def _read_data_type(self, sacc_data, data_type): cluster_survey_tracers = tracers_combinations[:, 0] - if self.sacc_tracer not in cluster_survey_tracers: + if self.survey_tracer not in cluster_survey_tracers: raise ValueError( - f"The SACC tracer {self.sacc_tracer} is not " + f"The SACC tracer {self.survey_tracer} is not " f"present in the SACC file." ) - survey_selection = cluster_survey_tracers == self.sacc_tracer + survey_selection = cluster_survey_tracers == self.survey_tracer z_tracers = np.unique(tracers_combinations[survey_selection, 1]) logM_tracers = np.unique(tracers_combinations[survey_selection, 2]) @@ -133,15 +133,15 @@ def read(self, sacc_data: sacc.Sacc): """ try: - survey_tracer: SurveyTracer = sacc_data.get_tracer(self.sacc_tracer) + survey_tracer: SurveyTracer = sacc_data.get_tracer(self.survey_tracer) except KeyError as exc: raise ValueError( f"The SACC file does not contain the SurveyTracer " - f"{self.sacc_tracer}." + f"{self.survey_tracer}." ) from exc if not isinstance(survey_tracer, SurveyTracer): raise ValueError( - f"The SACC tracer {self.sacc_tracer} is not a SurveyTracer." + f"The SACC tracer {self.survey_tracer} is not a SurveyTracer." ) self.cluster_abundance.sky_area = survey_tracer.sky_area diff --git a/firecrown/likelihood/gauss_family/statistic/source/number_counts.py b/firecrown/likelihood/gauss_family/statistic/source/number_counts.py index 4c1fa69c4..1649ac700 100644 --- a/firecrown/likelihood/gauss_family/statistic/source/number_counts.py +++ b/firecrown/likelihood/gauss_family/statistic/source/number_counts.py @@ -58,25 +58,20 @@ class LinearBiasSystematic(NumberCountsSystematic): This systematic adds a linear bias model which varies with redshift and the growth function. - - Parameters - ---------- - alphaz : str - The name of redshift dependence parameter of the linear bias. - alphag : str - The name of the growth dependence parameter of the linear bias. - z_piv : str - The name of the pivot redshift parameter for the linear bias. - """ def __init__(self, sacc_tracer: str): - super().__init__() + """Initialize the LinearBiasSystematic. + + :param sacc_tracer: the name of the tracer in the SACC file. This is used + as a prefix for its parameters. + + """ + super().__init__(parameter_prefix=sacc_tracer) self.alphaz = parameters.create() self.alphag = parameters.create() self.z_piv = parameters.create() - self.sacc_tracer = sacc_tracer def apply( self, tools: ModelingTools, tracer_arg: NumberCountsArgs @@ -113,19 +108,20 @@ class PTNonLinearBiasSystematic(NumberCountsSystematic): """Non-linear bias systematic. This systematic adds a linear bias model which varies with redshift and - - Parameters - ---------- - b_2: float - b_s: float + the growth function. """ def __init__(self, sacc_tracer: str): - super().__init__() + """Initialize the PTNonLinearBiasSystematic. + + :param sacc_tracer: the name of the tracer in the SACC file. This is used + as a prefix for its parameters. + + """ + super().__init__(parameter_prefix=sacc_tracer) self.b_2 = parameters.create() self.b_s = parameters.create() - self.sacc_tracer = sacc_tracer def apply( self, tools: ModelingTools, tracer_arg: NumberCountsArgs @@ -147,22 +143,15 @@ class MagnificationBiasSystematic(NumberCountsSystematic): This systematic adds a magnification bias model for galaxy number contrast following Joachimi & Bridle (2010), arXiv:0911.2454. - - Parameters - ---------- - r_lim : float - The name of the limiting magnitude in r band filter. - sig_c, eta, z_c, z_m : float - The name of the fitting parameters in Joachimi & Bridle (2010) equation - (C.1). - - Methods - ------- - apply : apply the systematic to a source """ def __init__(self, sacc_tracer: str): - super().__init__() + """Initialize the MagnificationBiasSystematic. + + :param sacc_tracer: the name of the tracer in the SACC file. This is used + as a prefix for its parameters. + """ + super().__init__(parameter_prefix=sacc_tracer) self.r_lim = parameters.create() self.sig_c = parameters.create() @@ -170,8 +159,6 @@ def __init__(self, sacc_tracer: str): self.z_c = parameters.create() self.z_m = parameters.create() - self.sacc_tracer = sacc_tracer - def apply( self, tools: ModelingTools, tracer_arg: NumberCountsArgs ) -> NumberCountsArgs: @@ -207,16 +194,19 @@ def apply( class ConstantMagnificationBiasSystematic(NumberCountsSystematic): """Simple constant magnification bias systematic. - Methods - ------- - apply : apply the systematic to a source + This systematic adds a constant magnification bias model for galaxy number + contrast. """ def __init__(self, sacc_tracer: str): - super().__init__() + """Initialize the ConstantMagnificationBiasSystematic. + + :param sacc_tracer: the name of the tracer in the SACC file. This is used + as a prefix for its parameters. + """ + super().__init__(parameter_prefix=sacc_tracer) self.mag_bias = parameters.create() - self.sacc_tracer = sacc_tracer def apply( self, tools: ModelingTools, tracer_arg: NumberCountsArgs @@ -234,10 +224,14 @@ class PhotoZShift(NumberCountsSystematic): """ def __init__(self, sacc_tracer: str): - super().__init__() + """Create a PhotoZShift object, using the specified tracer name. + + :param sacc_tracer: the name of the tracer in the SACC file. This is used + as a prefix for its parameters. + """ + super().__init__(parameter_prefix=sacc_tracer) self.delta_z = parameters.create() - self.sacc_tracer = sacc_tracer def apply(self, tools: ModelingTools, tracer_arg: NumberCountsArgs): """Apply a shift to the photo-z distribution of a source.""" @@ -268,7 +262,17 @@ def __init__( scale: float = 1.0, systematics: Optional[List[NumberCountsSystematic]] = None, ): - super().__init__() + """Initialize the NumberCounts object. + + :param sacc_tracer: the name of the tracer in the SACC file. This is used + as a prefix for its parameters. + :param has_rsd: whether to include RSD in the tracer. + :param derived_scale: whether to include a derived parameter for the scale + of the tracer. + :param scale: the initial scale of the tracer. + :param systematics: a list of systematics to apply to the tracer. + """ + super().__init__(sacc_tracer) self.sacc_tracer = sacc_tracer self.has_rsd = has_rsd diff --git a/firecrown/likelihood/gauss_family/statistic/source/source.py b/firecrown/likelihood/gauss_family/statistic/source/source.py index 1225a0cb2..10fc81b66 100644 --- a/firecrown/likelihood/gauss_family/statistic/source/source.py +++ b/firecrown/likelihood/gauss_family/statistic/source/source.py @@ -40,6 +40,15 @@ class Source(Updatable): cosmo_hash: Optional[int] tracers: Sequence[Tracer] + def __init__(self, sacc_tracer: str) -> None: + """Create a Source object that uses the named tracer. + + :param sacc_tracer: the name of the tracer in the SACC file. This is used + as a prefix for its parameters. + """ + super().__init__(parameter_prefix=sacc_tracer) + self.sacc_tracer = sacc_tracer + @final def read(self, sacc_data: sacc.Sacc): """Read the data for this source from the SACC file.""" diff --git a/firecrown/likelihood/gauss_family/statistic/source/weak_lensing.py b/firecrown/likelihood/gauss_family/statistic/source/weak_lensing.py index bbe0f09c0..6e3fe6491 100644 --- a/firecrown/likelihood/gauss_family/statistic/source/weak_lensing.py +++ b/firecrown/likelihood/gauss_family/statistic/source/weak_lensing.py @@ -56,19 +56,17 @@ class MultiplicativeShearBias(WeakLensingSystematic): """Multiplicative shear bias systematic. This systematic adjusts the `scale_` of a source by `(1 + m)`. - """ def __init__(self, sacc_tracer: str) -> None: """Create a MultiplicativeShearBias object that uses the named tracer. - Parameters - ---------- - sacc_tracer : The name of the multiplicative bias parameter. + + :param sacc_tracer: the name of the tracer in the SACC file. This is used + as a prefix for its parameters. """ - super().__init__() + super().__init__(parameter_prefix=sacc_tracer) self.mult_bias = parameters.create() - self.sacc_tracer = sacc_tracer def apply( self, tools: ModelingTools, tracer_arg: WeakLensingArgs @@ -93,36 +91,23 @@ class LinearAlignmentSystematic(WeakLensingSystematic): This systematic adds a linear intrinsic alignment model systematic which varies with redshift and the growth function. - - Methods - ------- - apply : apply the systematic to a source """ def __init__(self, sacc_tracer: Optional[str] = None, alphag=1.0): """Create a LinearAlignmentSystematic object, using the specified tracer name. - Instance data are: - - alphaz : The redshift dependence parameter of the intrinsic alignment - signal. - - alphag : The growth dependence parameter of the intrinsic alignment - signal. + :param sacc_tracer: the name of the tracer in the SACC file. This is used + as a prefix for its parameters. - z_piv : The pivot redshift parameter for the intrinsic alignment - parameter. """ - super().__init__() + super().__init__(parameter_prefix=sacc_tracer) self.ia_bias = parameters.create() self.alphaz = parameters.create() self.alphag = parameters.create(alphag) self.z_piv = parameters.create() - self.sacc_tracer = sacc_tracer - def apply( self, tools: ModelingTools, tracer_arg: WeakLensingArgs ) -> WeakLensingArgs: @@ -148,26 +133,20 @@ class TattAlignmentSystematic(WeakLensingSystematic): """TATT alignment systematic. This systematic adds a TATT (nonlinear) intrinsic alignment model systematic. - - Parameters - ---------- - ia_a_1: float - ia_a_2: float - ia_a_d: float - - Methods - ------- - apply : apply the systematic to a source """ def __init__(self, sacc_tracer: Optional[str] = None): - super().__init__() + """Create a TattAlignmentSystematic object, using the specified + tracer name. + + :param sacc_tracer: the name of the tracer in the SACC file. This is used + as a prefix for its parameters. + """ + super().__init__(parameter_prefix=sacc_tracer) self.ia_a_1 = parameters.create() self.ia_a_2 = parameters.create() self.ia_a_d = parameters.create() - self.sacc_tracer = sacc_tracer - def apply( self, tools: ModelingTools, tracer_arg: WeakLensingArgs ) -> WeakLensingArgs: @@ -201,10 +180,14 @@ class PhotoZShift(WeakLensingSystematic): """ def __init__(self, sacc_tracer: str): - super().__init__() + """Create a PhotoZShift object, using the specified tracer name. + + :param sacc_tracer: the name of the tracer in the SACC file. This is used + as a prefix for its parameters. + """ + super().__init__(parameter_prefix=sacc_tracer) self.delta_z = parameters.create() - self.sacc_tracer = sacc_tracer def apply(self, tools: ModelingTools, tracer_arg: WeakLensingArgs): """Apply a shift to the photo-z distribution of a source.""" @@ -233,8 +216,17 @@ def __init__( scale: float = 1.0, systematics: Optional[List[WeakLensingSystematic]] = None, ): - """Initialize the WeakLensing object.""" - super().__init__() + """Initialize the WeakLensing object. + + :param sacc_tracer: the name of the tracer in the SACC file. This is used + as a prefix for its parameters. + :param scale: the scale of the source. This is used to scale the shear + power spectrum. + :param systematics: a list of WeakLensingSystematic objects to apply to + this source. + + """ + super().__init__(sacc_tracer) self.sacc_tracer = sacc_tracer self.scale = scale diff --git a/firecrown/likelihood/gauss_family/statistic/statistic.py b/firecrown/likelihood/gauss_family/statistic/statistic.py index 111be335b..92b20c844 100644 --- a/firecrown/likelihood/gauss_family/statistic/statistic.py +++ b/firecrown/likelihood/gauss_family/statistic/statistic.py @@ -116,8 +116,8 @@ class Statistic(Updatable): Statistics represent things like two-point functions and mass functions. """ - def __init__(self): - super().__init__() + def __init__(self, parameter_prefix: Optional[str] = None): + super().__init__(parameter_prefix=parameter_prefix) self.sacc_indices: Optional[npt.NDArray[np.int64]] self.ready = False diff --git a/firecrown/likelihood/gauss_family/statistic/supernova.py b/firecrown/likelihood/gauss_family/statistic/supernova.py index 9fcf06744..b6c894f7c 100644 --- a/firecrown/likelihood/gauss_family/statistic/supernova.py +++ b/firecrown/likelihood/gauss_family/statistic/supernova.py @@ -22,7 +22,7 @@ class Supernova(Statistic): def __init__(self, sacc_tracer) -> None: """Initialize this statistic.""" - super().__init__() + super().__init__(parameter_prefix=sacc_tracer) self.sacc_tracer = sacc_tracer self.data_vector: Optional[DataVector] = None diff --git a/firecrown/updatable.py b/firecrown/updatable.py index e117cb1be..42e46a138 100644 --- a/firecrown/updatable.py +++ b/firecrown/updatable.py @@ -57,14 +57,22 @@ class Updatable(ABC): """ - def __init__(self) -> None: - """Updatable initialization.""" + def __init__(self, parameter_prefix: Optional[str] = None) -> None: + """Updatable initialization. + + :param prefix: prefix for all parameters in this Updatable + + Parameters created by firecrown.parameters.create will have a prefix + that is given by the prefix argument to the Updatable constructor. This + prefix is used to create the full name of the parameter. If `parameter_prefix` + is None, then the parameter will have no prefix. + """ self._updated: bool = False self._returned_derived: bool = False self._sampler_parameters: Dict[str, SamplerParameter] = {} self._internal_parameters: Dict[str, InternalParameter] = {} - self.sacc_tracer: Optional[str] = None self._updatables: List[GeneralUpdatable] = [] + self.parameter_prefix: Optional[str] = parameter_prefix def __setattr__(self, key: str, value: Any) -> None: """Set the attribute named :python:`key` to the supplied :python:`value`. @@ -145,10 +153,10 @@ def update(self, params: ParamsMap) -> None: for parameter in self._sampler_parameters: try: - value = params.get_from_prefix_param(self.sacc_tracer, parameter) + value = params.get_from_prefix_param(self.parameter_prefix, parameter) except KeyError as exc: raise MissingSamplerParameterError( - parameter_get_full_name(self.sacc_tracer, parameter) + parameter_get_full_name(self.parameter_prefix, parameter) ) from exc setattr(self, parameter, value) @@ -224,7 +232,7 @@ def required_parameters(self) -> RequiredParameters: # pragma: no cover sampler_parameters = RequiredParameters( [ - parameter_get_full_name(self.sacc_tracer, parameter) + parameter_get_full_name(self.parameter_prefix, parameter) for parameter in self._sampler_parameters ] ) diff --git a/tests/likelihood/gauss_family/statistic/source/test_source.py b/tests/likelihood/gauss_family/statistic/source/test_source.py index 1d156fcd8..4f4284d3e 100644 --- a/tests/likelihood/gauss_family/statistic/source/test_source.py +++ b/tests/likelihood/gauss_family/statistic/source/test_source.py @@ -49,7 +49,7 @@ def test_tracer_construction_with_name(empty_pyccl_tracer): def test_linear_bias_systematic(): a = nc.LinearBiasSystematic("xxx") assert isinstance(a, nc.LinearBiasSystematic) - assert a.sacc_tracer == "xxx" + assert a.parameter_prefix == "xxx" assert a.alphag is None assert a.alphaz is None assert a.z_piv is None @@ -63,7 +63,7 @@ def test_linear_bias_systematic(): a.reset() assert not a.is_updated() - assert a.sacc_tracer == "xxx" + assert a.parameter_prefix == "xxx" assert a.alphag is None assert a.alphaz is None assert a.z_piv is None From c6772cf033a8afbfea88b482d412d455684606cd Mon Sep 17 00:00:00 2001 From: Sandro Dias Pinto Vitenti Date: Wed, 20 Sep 2023 20:55:38 -0300 Subject: [PATCH 2/4] Updated tests to parameter_prefix instead of sacc_tracer. --- firecrown/likelihood/likelihood.py | 4 ++-- tests/connector/cobaya/test_model_likelihood.py | 4 ++-- tests/likelihood/lkdir/lk_sampler_parameter.py | 2 +- tests/likelihood/lkdir/lkmodule.py | 5 ++--- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/firecrown/likelihood/likelihood.py b/firecrown/likelihood/likelihood.py index 0945174f3..7b466f77c 100644 --- a/firecrown/likelihood/likelihood.py +++ b/firecrown/likelihood/likelihood.py @@ -36,9 +36,9 @@ class Likelihood(Updatable): these methods, and provide other abstract methods for their subclasses to implement. """ - def __init__(self) -> None: + def __init__(self, parameter_prefix: Optional[str] = None) -> None: """Default initialization for a base Likelihood object.""" - super().__init__() + super().__init__(parameter_prefix=parameter_prefix) self.predicted_data_vector: Optional[npt.NDArray[np.double]] = None self.measured_data_vector: Optional[npt.NDArray[np.double]] = None diff --git a/tests/connector/cobaya/test_model_likelihood.py b/tests/connector/cobaya/test_model_likelihood.py index 7c50a928a..c6446544d 100644 --- a/tests/connector/cobaya/test_model_likelihood.py +++ b/tests/connector/cobaya/test_model_likelihood.py @@ -214,7 +214,7 @@ def test_sampler_parameter_likelihood_missing(fiducial_params): "lk_connector": { "external": LikelihoodConnector, "firecrownIni": "tests/likelihood/lkdir/lk_sampler_parameter.py", - "build_parameters": NamedParameters({"sacc_tracer": "my_prefix"}), + "build_parameters": NamedParameters({"parameter_prefix": "my_prefix"}), } }, "theory": { @@ -235,7 +235,7 @@ def test_sampler_parameter_likelihood(fiducial_params): "lk_connector": { "external": LikelihoodConnector, "firecrownIni": "tests/likelihood/lkdir/lk_sampler_parameter.py", - "build_parameters": NamedParameters({"sacc_tracer": "my_prefix"}), + "build_parameters": NamedParameters({"parameter_prefix": "my_prefix"}), } }, "theory": { diff --git a/tests/likelihood/lkdir/lk_sampler_parameter.py b/tests/likelihood/lkdir/lk_sampler_parameter.py index 5bc943c9b..32a3772b9 100644 --- a/tests/likelihood/lkdir/lk_sampler_parameter.py +++ b/tests/likelihood/lkdir/lk_sampler_parameter.py @@ -1,6 +1,6 @@ """ Provides a trivial likelihood factory function for testing purposes. -The likelihood created requires a string parameter named "sacc_tracer" +The likelihood created requires a string parameter named "parameter_prefix" and has a sampler parameter named "sampler_param0". """ from firecrown.likelihood.likelihood import NamedParameters diff --git a/tests/likelihood/lkdir/lkmodule.py b/tests/likelihood/lkdir/lkmodule.py index d18a46f34..76d46a195 100644 --- a/tests/likelihood/lkdir/lkmodule.py +++ b/tests/likelihood/lkdir/lkmodule.py @@ -54,10 +54,9 @@ class SamplerParameterLikelihood(Likelihood): def __init__(self, params: NamedParameters): """Initialize the SamplerParameterLikelihood by reading the specificed - sacc_tracer value and creates a sampler parameter called "sampler_param0". + parameter_prefix value and creates a sampler parameter called "sampler_param0". """ - super().__init__() - self.sacc_tracer = params.get_string("sacc_tracer") + super().__init__(parameter_prefix=params.get_string("parameter_prefix")) self.sampler_param0 = parameters.create() def read(self, sacc_data: sacc.Sacc) -> None: From b1d666e263f9622456e5e8978f223755dfc3b7d9 Mon Sep 17 00:00:00 2001 From: Sandro Dias Pinto Vitenti Date: Wed, 20 Sep 2023 21:07:13 -0300 Subject: [PATCH 3/4] Test documenting Updatable attributes. --- .../statistic/source/number_counts.py | 36 +++++++++++++++++++ .../statistic/source/weak_lensing.py | 26 ++++++++++++++ firecrown/models/cluster_mass_rich_proxy.py | 12 ++++++- 3 files changed, 73 insertions(+), 1 deletion(-) diff --git a/firecrown/likelihood/gauss_family/statistic/source/number_counts.py b/firecrown/likelihood/gauss_family/statistic/source/number_counts.py index 1649ac700..41ada58be 100644 --- a/firecrown/likelihood/gauss_family/statistic/source/number_counts.py +++ b/firecrown/likelihood/gauss_family/statistic/source/number_counts.py @@ -58,6 +58,14 @@ class LinearBiasSystematic(NumberCountsSystematic): This systematic adds a linear bias model which varies with redshift and the growth function. + + The following parameters are special Updatable parameters, which means that + they can be updated by the sampler, sacc_tracer is going to be used as a + prefix for the parameters: + :ivar alphaz: the redshift exponent of the bias. + :ivar alphag: the growth function exponent of the bias. + :ivar z_piv: the pivot redshift of the bias. + """ def __init__(self, sacc_tracer: str): @@ -109,6 +117,12 @@ class PTNonLinearBiasSystematic(NumberCountsSystematic): This systematic adds a linear bias model which varies with redshift and the growth function. + + The following parameters are special Updatable parameters, which means that + they can be updated by the sampler, sacc_tracer is going to be used as a + prefix for the parameters: + :ivar b_2: the quadratic bias. + :ivar b_s: the stochastic bias. """ def __init__(self, sacc_tracer: str): @@ -143,6 +157,16 @@ class MagnificationBiasSystematic(NumberCountsSystematic): This systematic adds a magnification bias model for galaxy number contrast following Joachimi & Bridle (2010), arXiv:0911.2454. + + The following parameters are special Updatable parameters, which means that + they can be updated by the sampler, sacc_tracer is going to be used as a + prefix for the parameters: + :ivar r_lim: the limiting magnitude. + :ivar sig_c: the intrinsic dispersion of the source redshift distribution. + :ivar eta: the slope of the luminosity function. + :ivar z_c: the characteristic redshift of the source distribution. + :ivar z_m: the slope of the source redshift distribution. + """ def __init__(self, sacc_tracer: str): @@ -196,6 +220,12 @@ class ConstantMagnificationBiasSystematic(NumberCountsSystematic): This systematic adds a constant magnification bias model for galaxy number contrast. + + The following parameters are special Updatable parameters, which means that + they can be updated by the sampler, sacc_tracer is going to be used as a + prefix for the parameters: + :ivar mag_bias: the magnification bias. + """ def __init__(self, sacc_tracer: str): @@ -221,6 +251,12 @@ class PhotoZShift(NumberCountsSystematic): """A photo-z shift bias. This systematic shifts the photo-z distribution by some ammount `delta_z`. + + The following parameters are special Updatable parameters, which means that + they can be updated by the sampler, sacc_tracer is going to be used as a + prefix for the parameters: + :ivar delta_z: the photo-z shift. + """ def __init__(self, sacc_tracer: str): diff --git a/firecrown/likelihood/gauss_family/statistic/source/weak_lensing.py b/firecrown/likelihood/gauss_family/statistic/source/weak_lensing.py index 6e3fe6491..8e70e8922 100644 --- a/firecrown/likelihood/gauss_family/statistic/source/weak_lensing.py +++ b/firecrown/likelihood/gauss_family/statistic/source/weak_lensing.py @@ -56,6 +56,11 @@ class MultiplicativeShearBias(WeakLensingSystematic): """Multiplicative shear bias systematic. This systematic adjusts the `scale_` of a source by `(1 + m)`. + + The following parameters are special Updatable parameters, which means that + they can be updated by the sampler, sacc_tracer is going to be used as a + prefix for the parameters: + :ivar mult_bias: the multiplicative shear bias parameter. """ def __init__(self, sacc_tracer: str) -> None: @@ -91,6 +96,14 @@ class LinearAlignmentSystematic(WeakLensingSystematic): This systematic adds a linear intrinsic alignment model systematic which varies with redshift and the growth function. + + The following parameters are special Updatable parameters, which means that + they can be updated by the sampler, sacc_tracer is going to be used as a + prefix for the parameters: + :ivar ia_bias: the intrinsic alignment bias parameter. + :ivar alphaz: the redshift dependence of the intrinsic alignment bias. + :ivar alphag: the growth function dependence of the intrinsic alignment bias. + :ivar z_piv: the pivot redshift for the intrinsic alignment bias. """ def __init__(self, sacc_tracer: Optional[str] = None, alphag=1.0): @@ -133,6 +146,14 @@ class TattAlignmentSystematic(WeakLensingSystematic): """TATT alignment systematic. This systematic adds a TATT (nonlinear) intrinsic alignment model systematic. + + The following parameters are special Updatable parameters, which means that + they can be updated by the sampler, sacc_tracer is going to be used as a + prefix for the parameters: + :ivar ia_a_1: the amplitude of the linear alignment model. + :ivar ia_a_2: the amplitude of the quadratic alignment model. + :ivar ia_a_d: the amplitude of the density-dependent alignment model. + """ def __init__(self, sacc_tracer: Optional[str] = None): @@ -177,6 +198,11 @@ class PhotoZShift(WeakLensingSystematic): """A photo-z shift bias. This systematic shifts the photo-z distribution by some amount `delta_z`. + + The following parameters are special Updatable parameters, which means that + they can be updated by the sampler, sacc_tracer is going to be used as a + prefix for the parameters: + :ivar delta_z: the photo-z shift. """ def __init__(self, sacc_tracer: str): diff --git a/firecrown/models/cluster_mass_rich_proxy.py b/firecrown/models/cluster_mass_rich_proxy.py index fee42b428..2138472e9 100644 --- a/firecrown/models/cluster_mass_rich_proxy.py +++ b/firecrown/models/cluster_mass_rich_proxy.py @@ -16,7 +16,17 @@ class ClusterMassRich(ClusterMass): - """Cluster Mass Richness proxy.""" + """Cluster Mass Richness proxy. + + The following parameters are special Updatable parameters, which means that + they can be updated by the sampler. + :ivar mu_p0: mu parameter 0 + :ivar mu_p1: mu parameter 1 + :ivar mu_p2: mu parameter 2 + :ivar sigma_p0: sigma parameter 0 + :ivar sigma_p1: sigma parameter 1 + :ivar sigma_p2: sigma parameter 2 + """ def __init__( self, pivot_mass, pivot_redshift, logMl: float = 13.0, logMu: float = 16.0 From c8d6fc062b7aa431fa5bc08599e691fd09ed9e3b Mon Sep 17 00:00:00 2001 From: Sandro Dias Pinto Vitenti Date: Wed, 20 Sep 2023 22:23:49 -0300 Subject: [PATCH 4/4] Adding missing empty line in docs. --- .../gauss_family/statistic/source/number_counts.py | 9 +++++---- .../gauss_family/statistic/source/weak_lensing.py | 5 ++++- firecrown/models/cluster_mass_rich_proxy.py | 3 ++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/firecrown/likelihood/gauss_family/statistic/source/number_counts.py b/firecrown/likelihood/gauss_family/statistic/source/number_counts.py index 41ada58be..6bd010301 100644 --- a/firecrown/likelihood/gauss_family/statistic/source/number_counts.py +++ b/firecrown/likelihood/gauss_family/statistic/source/number_counts.py @@ -62,10 +62,10 @@ class LinearBiasSystematic(NumberCountsSystematic): The following parameters are special Updatable parameters, which means that they can be updated by the sampler, sacc_tracer is going to be used as a prefix for the parameters: + :ivar alphaz: the redshift exponent of the bias. :ivar alphag: the growth function exponent of the bias. :ivar z_piv: the pivot redshift of the bias. - """ def __init__(self, sacc_tracer: str): @@ -121,6 +121,7 @@ class PTNonLinearBiasSystematic(NumberCountsSystematic): The following parameters are special Updatable parameters, which means that they can be updated by the sampler, sacc_tracer is going to be used as a prefix for the parameters: + :ivar b_2: the quadratic bias. :ivar b_s: the stochastic bias. """ @@ -161,12 +162,12 @@ class MagnificationBiasSystematic(NumberCountsSystematic): The following parameters are special Updatable parameters, which means that they can be updated by the sampler, sacc_tracer is going to be used as a prefix for the parameters: + :ivar r_lim: the limiting magnitude. :ivar sig_c: the intrinsic dispersion of the source redshift distribution. :ivar eta: the slope of the luminosity function. :ivar z_c: the characteristic redshift of the source distribution. :ivar z_m: the slope of the source redshift distribution. - """ def __init__(self, sacc_tracer: str): @@ -224,8 +225,8 @@ class ConstantMagnificationBiasSystematic(NumberCountsSystematic): The following parameters are special Updatable parameters, which means that they can be updated by the sampler, sacc_tracer is going to be used as a prefix for the parameters: - :ivar mag_bias: the magnification bias. + :ivar mag_bias: the magnification bias. """ def __init__(self, sacc_tracer: str): @@ -255,8 +256,8 @@ class PhotoZShift(NumberCountsSystematic): The following parameters are special Updatable parameters, which means that they can be updated by the sampler, sacc_tracer is going to be used as a prefix for the parameters: - :ivar delta_z: the photo-z shift. + :ivar delta_z: the photo-z shift. """ def __init__(self, sacc_tracer: str): diff --git a/firecrown/likelihood/gauss_family/statistic/source/weak_lensing.py b/firecrown/likelihood/gauss_family/statistic/source/weak_lensing.py index 8e70e8922..305bbc7ad 100644 --- a/firecrown/likelihood/gauss_family/statistic/source/weak_lensing.py +++ b/firecrown/likelihood/gauss_family/statistic/source/weak_lensing.py @@ -60,6 +60,7 @@ class MultiplicativeShearBias(WeakLensingSystematic): The following parameters are special Updatable parameters, which means that they can be updated by the sampler, sacc_tracer is going to be used as a prefix for the parameters: + :ivar mult_bias: the multiplicative shear bias parameter. """ @@ -100,6 +101,7 @@ class LinearAlignmentSystematic(WeakLensingSystematic): The following parameters are special Updatable parameters, which means that they can be updated by the sampler, sacc_tracer is going to be used as a prefix for the parameters: + :ivar ia_bias: the intrinsic alignment bias parameter. :ivar alphaz: the redshift dependence of the intrinsic alignment bias. :ivar alphag: the growth function dependence of the intrinsic alignment bias. @@ -150,10 +152,10 @@ class TattAlignmentSystematic(WeakLensingSystematic): The following parameters are special Updatable parameters, which means that they can be updated by the sampler, sacc_tracer is going to be used as a prefix for the parameters: + :ivar ia_a_1: the amplitude of the linear alignment model. :ivar ia_a_2: the amplitude of the quadratic alignment model. :ivar ia_a_d: the amplitude of the density-dependent alignment model. - """ def __init__(self, sacc_tracer: Optional[str] = None): @@ -202,6 +204,7 @@ class PhotoZShift(WeakLensingSystematic): The following parameters are special Updatable parameters, which means that they can be updated by the sampler, sacc_tracer is going to be used as a prefix for the parameters: + :ivar delta_z: the photo-z shift. """ diff --git a/firecrown/models/cluster_mass_rich_proxy.py b/firecrown/models/cluster_mass_rich_proxy.py index 2138472e9..2b499b2cf 100644 --- a/firecrown/models/cluster_mass_rich_proxy.py +++ b/firecrown/models/cluster_mass_rich_proxy.py @@ -19,7 +19,8 @@ class ClusterMassRich(ClusterMass): """Cluster Mass Richness proxy. The following parameters are special Updatable parameters, which means that - they can be updated by the sampler. + they can be updated by the sampler: + :ivar mu_p0: mu parameter 0 :ivar mu_p1: mu parameter 1 :ivar mu_p2: mu parameter 2