Taweret.utils namespace

Submodules

Taweret.utils.utils.mixture_function(method: str, x: ndarray, mixture_params: ndarray, prior=None) ndarray[source]

predict the weights from the mixture funtion at the give input parameter values x

Parameters
  • method (str) -- name of the linear mixing function method

  • x (np.1darray) -- input parameter values

  • mixture_params (np.1darray) -- parametrs that decide the shape of mixture function

  • prior ((optional) bilby prior object) -- Used only in step mixing to deal with negative values of the input.

Taweret.utils.utils.normal_likelihood_elementwise(model: object, x_exp: ndarray, y_exp: ndarray, y_err: ndarray, model_param=array([], dtype=float64)) ndarray[source]

predict the normal liklihood for each experimental data point

modelobject

model object with a predict method

x_expnp.1darray

input parameter values for experimental data

y_expnp.1darray

mean of the experimental data

y_errnp.1darray

standard deviation of the experimental data

Taweret.utils.utils.normal_log_likelihood_elementwise(model: object, x_exp: ndarray, y_exp: ndarray, y_err: ndarray, model_param=array([], dtype=float64)) ndarray[source]

predict the log normal log liklihood for each experimental data point

modelobject

model object with a predict method

x_expnp.1darray

input parameter values for experimental data

y_expnp.1darray

mean of the experimental data

y_errnp.1darray

standard deviation of the experimental data

Taweret.utils.utils.normed_mvn_loglike(y, cov)[source]

Evaluate the multivariate-normal log-likelihood for difference vector y and covariance matrix cov:

log_p = -1/2*[(y^T).(C^-1).y + log(det(C))] + const.

This likelihood IS NORMALIZED. The normalization const = -n/2*log(2*pi), where n is the dimensionality.

Arguments y and cov MUST be np.arrays with dtype == float64 and shapes (n) and (n, n), respectively. These requirements are NOT CHECKED.

The calculation follows algorithm 2.1 in Rasmussen and Williams (Gaussian Processes for Machine Learning).

Taweret.utils.utils.switchcos(g1, g2, g3, x)[source]

Switchcos function in Alexandras Samba module link https://github.com/asemposki/SAMBA/blob/0479b4deff46f3cb77b82bb30abd5693de8980f3/samba/mixing.py#L1205

g1float

switching value from left constant to first cosine

g2float

switching value from second cosine to right constant

g3float

switching value from first cosine to second cosine

xfloat

the input parameter value to calculate the weight