Ejemplo n.º 1
0
def loglike(x):

    start = time.time()

    # parameter values
    theta = x[0]
    phi = x[1]
    freq = 10 ** x[2]
    mc = 10 ** x[3]
    dist = 10 ** x[4]
    psi = x[5]
    inc = x[6]
    phase = x[7]

    pdist = x[8:]

    # generate list of waveforms for all puslars
    s = PALutils.createResidualsFast(
        psr, theta, phi, mc, dist, freq, phase, psi, inc, pdist=pdist, evolve=False, phase_approx=True
    )

    loglike = 0
    for ct, p in enumerate(psr):

        diff = p.res - s[ct]
        loglike += -0.5 * (logdetTerm[ct] + np.dot(diff, np.dot(p.invCov, diff)))

    if np.isnan(loglike):
        print "NaN log-likelihood. Not good..."
        return -np.inf
    else:
        return loglike
Ejemplo n.º 2
0
def loglike(x):

    start = time.time()

    # parameter values
    theta = x[0]
    phi = x[1]
    freq = 10**x[2]
    mc = 10**x[3]
    dist = 10**x[4]
    psi = x[5]
    inc = x[6]
    phase = x[7]

    pdist = x[8:]

    # generate list of waveforms for all puslars
    s = PALutils.createResidualsFast(psr, theta, phi, mc, dist, freq, phase, psi, inc,\
                                     pdist=pdist, evolve=False, phase_approx=True)
    
    loglike = 0
    for ct, p in enumerate(psr):

        diff = p.res - s[ct]
        loglike += -0.5 * (logdetTerm[ct] + np.dot(diff, np.dot(p.invCov, diff)))


    if np.isnan(loglike):
        print 'NaN log-likelihood. Not good...'
        return -np.inf
    else:
        return loglike