model¶
import tensorwaves.model
Evaluateable physics models for amplitude analysis.
The model
module takes care of lambdifying mathematical expressions to
computational backends. Currently, mathematical expressions are implemented
as sympy
expressions only.
-
class
LambdifiedFunction
(model: tensorwaves.interfaces.Model, backend: Union[str, tuple, dict] = 'numpy')[source]¶ Bases:
tensorwaves.interfaces.Function
-
__call__
(dataset: Mapping[str, numpy.ndarray]) → numpy.ndarray[source]¶ Evaluate the function.
- Parameters
dataset – a
dict
with domain variable names as keys.- Returns
Result of the function evaluation. Type depends on the input type.
-
-
class
SympyModel
(expression: sympy.core.expr.Expr, parameters: Dict[sympy.core.symbol.Symbol, Union[float, complex]])[source]¶ Bases:
tensorwaves.interfaces.Model
Full definition of an arbitrary model based on
sympy
.Note that input for particle physics amplitude models are based on four momenta. However, for reasons of convenience, some models may define and use a distinct set of kinematic variables (e.g. in the helicity formalism: angles \(\theta\) and \(\phi\)). In this case, a
DataTransformer
instance (adapter) is needed to transform four momentum information into the custom set of kinematic variables.- Args: expressionA sympy expression that contains the complete
information of the model based on some inputs. The inputs are defined via the
free_symbols
attribute of thesympy.Expr
. parameters: Defines which inputs of the model are parameters. The keys represent the parameter set, while the values represent their default values. Consequently the variables of the model are defined as the intersection of the total input set with the parameter set.
-
property
argument_order
¶ Order of arguments of lambdified function signature.
-
property
parameters
¶ Get mapping of parameters to suggested initial values.
-
performance_optimize
(fix_inputs: Mapping[str, numpy.ndarray]) → tensorwaves.interfaces.Model[source]¶ Create a performance optimized model, based on fixed inputs.
-
property
variables
¶ Expected input variable names.