@@ -61,6 +61,18 @@ def unit_value_for(self, physical_value: float) -> float:
6161 return self .message .cdf (physical_value )
6262
6363 def with_message (self , message ):
64+ """Return a copy of this prior with a different message (distribution).
65+
66+ Parameters
67+ ----------
68+ message
69+ The new message object defining the prior's distribution.
70+
71+ Returns
72+ -------
73+ Prior
74+ A copy of this prior using the new message.
75+ """
6476 new = copy (self )
6577 new .message = message
6678 return new
@@ -88,6 +100,23 @@ def factor(self):
88100
89101 @staticmethod
90102 def for_class_and_attribute_name (cls , attribute_name ):
103+ """Create a prior from the configuration for a given class and attribute.
104+
105+ Looks up the prior type and parameters in the prior config files
106+ for the specified class and attribute name.
107+
108+ Parameters
109+ ----------
110+ cls
111+ The model class whose config is looked up.
112+ attribute_name
113+ The name of the attribute on that class.
114+
115+ Returns
116+ -------
117+ Prior
118+ A prior instance constructed from the config entry.
119+ """
91120 prior_dict = conf .instance .prior_config .for_class_and_suffix_path (
92121 cls , [attribute_name ]
93122 )
@@ -129,10 +158,31 @@ def instance_for_arguments(
129158 arguments ,
130159 ignore_assertions = False ,
131160 ):
161+ """Look up this prior's value in an arguments dictionary.
162+
163+ Parameters
164+ ----------
165+ arguments
166+ A dictionary mapping Prior objects to physical values.
167+ ignore_assertions
168+ Unused for priors (present for interface compatibility).
169+ """
132170 _ = ignore_assertions
133171 return arguments [self ]
134172
135173 def project (self , samples , weights ):
174+ """Project this prior given samples and log weights from a search.
175+
176+ Returns a copy of this prior whose message has been updated to
177+ reflect the posterior information from the samples.
178+
179+ Parameters
180+ ----------
181+ samples
182+ Array of sample values for this parameter.
183+ weights
184+ Log weights for each sample.
185+ """
136186 result = copy (self )
137187 result .message = self .message .project (
138188 samples = samples ,
@@ -170,6 +220,11 @@ def __str__(self):
170220 @property
171221 @abstractmethod
172222 def parameter_string (self ) -> str :
223+ """A human-readable string summarizing this prior's parameters.
224+
225+ Subclasses must implement this to return a description such as
226+ ``"mean = 0.0, sigma = 1.0"`` or ``"lower_limit = 0.0, upper_limit = 1.0"``.
227+ """
173228 pass
174229
175230 def __float__ (self ):
@@ -254,7 +309,22 @@ def name_of_class(cls) -> str:
254309
255310 @property
256311 def limits (self ) -> Tuple [float , float ]:
312+ """The (lower, upper) bounds of this prior.
313+
314+ Returns (-inf, inf) by default. Subclasses with finite bounds
315+ (e.g. UniformPrior) override this.
316+ """
257317 return (float ("-inf" ), float ("inf" ))
258318
259319 def gaussian_prior_model_for_arguments (self , arguments ):
320+ """Look up this prior in an arguments dict and return the mapped value.
321+
322+ Used during prior replacement workflows where each prior is mapped
323+ to a new prior or fixed value via an arguments dictionary.
324+
325+ Parameters
326+ ----------
327+ arguments
328+ A dictionary mapping Prior objects to their replacement values.
329+ """
260330 return arguments [self ]
0 commit comments