pyhs3.distributions.GenericDist¶
- class pyhs3.distributions.GenericDist(*, name, expression)[source]¶
Generic distribution implementation.
Evaluates custom mathematical expressions using SymPy parsing and PyTensor computation graphs.
- Parameters:
- Supported Functions:
Basic arithmetic: +, -, , /, *
Trigonometric: sin, cos, tan
Exponential/Logarithmic: exp, log
Other: sqrt, abs
Examples
Create a quadratic distribution:
>>> dist = GenericDist(name="quadratic", expression="x**2 + 2*x + 1")
Create a custom exponential with oscillation:
>>> dist = GenericDist(name="exp_cos", expression="exp(-x**2/2) * cos(y)")
Create a complex mathematical function:
>>> dist = GenericDist(name="complex", expression="sin(x) + log(abs(y) + 1)")
Methods
__init__(*, name, expression)Initialize a GenericDist.
expression(distributionsandparameters)Evaluate the generic distribution using expression parsing.
from_dict(config)Create a GenericDist from a dictionary configuration.