Пример #1
0
def log_likelihood(z, x, P, H, R):
    """
    Returns log-likelihood of the measurement z given the Gaussian
    posterior (x, P) using measurement function H and measurement
    covariance error R
    """
    S = np.dot(H, np.dot(P, H.T)) + R
    return logpdf(z, np.dot(H, x), S)
Пример #2
0
 def runner(chunk):
     ##
     res = np.empty_like(chunk)
     wrapper = tqdm.tqdm if verbose else (lambda x, **kwarg: x)
     ##
     for i in wrapper(range(len(chunk))):
         drv = chain[i]
         drl = lprobs[i]
         ##
         if (drv - cmean) @ cicov @ (drv - cmean) < ss.chi2.ppf(1-alpha, df=chain.shape[-1]):
             res[i] = logpdf(drv, cmean, ccov) - drl
         else:
             res[i] = -np.inf
     return res