cls = <class 'autofit.mapper.prior.abstract.Prior'>
prior_dict = {'centre': [0.0, 0.0], 'effective_radius': 0.6, 'elliptical_comps': [0.0, 0.0], 'intensity': 0.1, ...}
@classmethod
def from_dict(cls, prior_dict: dict) -> Union["Prior", DeferredArgument]:
"""
Returns a prior from a JSON representation.
Parameters
----------
prior_dict : dict
A dictionary representation of a prior including a type (e.g. Uniform) and all constructor arguments.
Returns
-------
An instance of a child of this class.
"""
if prior_dict["type"] == "Constant":
return prior_dict["value"]
if prior_dict["type"] == "Deferred":
return DeferredArgument()
from .prior import UniformPrior
from .prior import LogUniformPrior
from .prior import GaussianPrior
prior_type_dict = {
"Uniform": UniformPrior,
"LogUniform": LogUniformPrior,
"Gaussian": GaussianPrior,
}
# noinspection PyProtectedMember
> return prior_type_dict[prior_dict["type"]](
**{
key: value
for key, value in prior_dict.items()
if key not in ("type", "width_modifier", "gaussian_limits")
}
)
E KeyError: 'autogalaxy.profiles.light_profiles.light_profiles.EllSersic'
The following simple unit test:
Gives the following exception: