autofit.LogUniformPrior#
- class autofit.LogUniformPrior(lower_limit: float = 1e-06, upper_limit: float = 1.0, id_: int | None = None)[source]#
Bases:
PriorA prior with a log base 10 uniform distribution, defined between a lower limit and upper limit.
The conversion of an input unit value,
u, to a physical value,p, via the prior is as follows:\[\]For example for
prior = LogUniformPrior(lower_limit=10.0, upper_limit=1000.0), an inputprior.value_for(unit=0.5)is equal to 100.0.[Rich describe how this is done via message]
- Parameters:
lower_limit – The lower limit of the log10 uniform distribution defining the prior.
upper_limit – The upper limit of the log10 uniform distribution defining the prior.
Examples
prior = af.LogUniformPrior(lower_limit=0.0, upper_limit=2.0)
physical_value = prior.value_for(unit=0.2)
Methods
Return a dictionary representation of this GaussianPrior instance, including mean and sigma.
for_class_and_attribute_nameCreate a prior from the configuration for a given class and attribute.
from_dictReturns a prior from a JSON representation.
gaussian_prior_model_for_argumentsLook up this prior in an arguments dict and return the mapped value.
hasDoes this instance have an attribute which is of type cls?
instance_for_argumentsLook up this prior's value in an arguments dictionary.
Returns the log prior of a physical value, so the log likelihood of a model evaluation can be converted to a posterior as log_prior + log_likelihood.
make_indexesname_of_classA string name for the class, with the prior suffix removed.
newReturns a copy of this prior with a new id assigned making it distinct
next_idprojectProject this prior given samples and log weights from a search.
randomA random value sampled from this prior
replacing_for_pathCreate a new model replacing the value for a given path with a new value
tree_flattentree_unflattenCreate a prior from a flattened PyTree
unit_value_forCompute the unit value between 0 and 1 for the physical value.
Returns a physical value from an input unit value according to the limits of the log10 uniform prior.
Create a new log 10 uniform prior centred between two limits with sigma distance between this limits.
with_messageReturn a copy of this prior with a different message (distribution).
Attributes
component_numberfactorA callable PDF used as a factor in factor graphs
identifierlabelThe (lower, upper) bounds of this prior.
namendimHow many dimensions does this variable have?
A human-readable string summarizing this prior's parameters.
- classmethod with_limits(lower_limit: float, upper_limit: float) LogUniformPrior[source]#
Create a new log 10 uniform prior centred between two limits with sigma distance between this limits.
Note that these limits are not strict so exceptions will not be raised for values outside of the limits.
This function is typically used in prior passing, where the result of a model-fit are used to create new Gaussian priors centred on the previously estimated median PDF model.
- Parameters:
lower_limit – The lower limit of the new LogUniform prior.
upper_limit – The upper limit of the new LogUniform Prior.
- Return type:
A new LogUniform.
- log_prior_from_value(value, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautofit/envs/latest/lib/python3.11/site-packages/numpy/__init__.py'>) float[source]#
Returns the log prior of a physical value, so the log likelihood of a model evaluation can be converted to a posterior as log_prior + log_likelihood.
This is used by certain non-linear searches (e.g. Emcee) in the log likelihood function evaluation.
- Parameters:
value (float) – The physical value of this prior’s corresponding parameter in a NonLinearSearch sample.
- value_for(unit: float) float[source]#
Returns a physical value from an input unit value according to the limits of the log10 uniform prior.
- Parameters:
unit – A unit value between 0 and 1.
- Returns:
The unit value mapped to a physical value according to the prior.
- Return type:
value
Examples
prior = af.LogUniformPrior(lower_limit=0.0, upper_limit=2.0)
physical_value = prior.value_for(unit=0.2)
- dict() dict[source]#
Return a dictionary representation of this GaussianPrior instance, including mean and sigma.
- Return type:
Dictionary containing prior parameters.