uravu.utils

A few additional utility functions to improve the usability of uravu.

uravu.utils.bayes_factor(model_1, model_2)[source]

Use the Bayes factor to compare two models. Using Table from Kass and Raftery to compare.

Parameters:
  • model_1 (uncertainties.core.Variable or float) – ln evidence for model 1.
  • model_2 (uncertainties.core.Variable or float) – ln evidence for model 2.
Returns:

2ln(B), where B is the Bayes Factor between the two models.

Return type:

uncertainties.core.Variable or float

uravu.utils.correlation_matrix(relationship)[source]

Evaluate the Pearsons correlation coefficient matrix for the variables in a given relationship.

Parameters:relationship (uravu.relationship.Relationship) – The relationship to determine the correlation matrix for.
Returns:The correlation matrix for the relationships variables.
Return type:array_like
uravu.utils.latex(distribution)[source]

Get some LaTeX math-type code that describes the mean and confidence intervals of the distribution.

Parameters:distribution (uravu.distribution.Distribution) – The distribution to return LaTeX for.
Returns:A LaTeX formatted string for the mean and confidence intervals of the distribution.
Return type:(str)
uravu.utils.straight_line(abscissa, gradient, intercept)[source]

A one dimensional straight line function.

Parameters:
  • abscissa (array_like) – The abscissa data.
  • gradient (float) – The slope of the line.
  • intercept (float) – The y-intercept of the line.
Returns:

The resulting ordinate.

Return type:

array_like