def divide_gaussians(mean_precision_num, mean_precision_den):
    """
    mean_precision_num are parameters of gaussian in the numerator
    mean_precision_den are parameters of gaussian in the denominator
    output is a valid gaussian only if the variance of ouput is non-negative
    """
    precision_op = mean_precision_num[1] - mean_precision_den[1]
    try:
        assert precision_op >= 0.        #   making it > so that mean_op is not inf
    except __HOLE__:
        print 'inputs = %s, %s' % (mean_precision_num, mean_precision_den)
        print 'precision_op = %s' % (precision_op)
        raise AssertionError
    if precision_op == 0.:
        mean_op = 0.
    else:
        mean_op = (mean_precision_num[0] * mean_precision_num[1] \
                     - mean_precision_den[0] * mean_precision_den[1] ) / precision_op
    return np.array([mean_op, precision_op])
dataset/ETHPy150Open balajiln/mondrianforest/src/utils.py/divide_gaussians