def log_likelihood(theta, d, covd): p_zeta,p_Thetaeq,p_gamma,p_alpha=theta WI,WV=mocklc.comp_weight(nside,p_zeta,inc,p_Thetaeq,Thetav,Phiv) Wp=WV[:,:]*WI[:,:] #KS=p_alpha*gpkernel.Matern32(sep,p_gamma) KS=p_alpha*gpkernel.RBF(sep,p_gamma) Cov = covd + Wp@[email protected] sign,logdet=np.linalg.slogdet(Cov) Pi_d=scipy.linalg.solve(Cov,d,assume_a="pos") prop = -0.5*logdet-0.5*d@Pi_d #-0.5*np.shape(cov)[0]*np.log(2.0*np.pi) return prop
def log_likelihood(theta, d, covd): p_zeta, p_Thetaeq, p_gamma, p_alpha, p_tau, p_Pspin = theta wspin = 2 * np.pi / p_Pspin Phiv = np.mod(wspin * obst, 2 * np.pi) WI, WV = mocklc.comp_weight(nside, p_zeta, inc, p_Thetaeq, Thetav, Phiv) Wp = WV[:, :] * WI[:, :] #KS=p_alpha*gpkernel.Matern32(sep,p_gamma) KS = gpkernel.RBF(sep, p_gamma) KT = gpkernel.Matern32(obst, tau=p_tau) WSWT = (Wp @ KS @ Wp.T) Kw = p_alpha * KT * (WSWT) ###### Cov = covd + Kw try: sign, logdet = np.linalg.slogdet(Cov) Pi_d = scipy.linalg.solve(Cov, d, assume_a="pos") prop = -0.5 * logdet - 0.5 * d @ Pi_d #-0.5*np.shape(cov)[0]*np.log(2.0*np.pi) return prop except: return -np.inf
#inc=0.0 Thetaeq = np.pi / 2 zeta = 23.4 / 180.0 * np.pi #zeta=60.0/180.0*np.pi Pspin = 23.9344699 / 24.0 #Pspin: a sidereal day wspin = 2 * np.pi / Pspin Porb = 365.242190402 #Porb=30.0 worb = 2 * np.pi / Porb N = 1024 expt = Porb #observation duration 10d obst = np.linspace(Porb / 4, expt + Porb / 4, N) Thetav = worb * obst Phiv = np.mod(wspin * obst, 2 * np.pi) WI, WV = mocklc.comp_weight(nside, zeta, inc, Thetaeq, Thetav, Phiv) W = WV[:, :] * WI[:, :] npix = hp.nside2npix(nside) #Ainit = np.dot(np.diag(1/np.sum(Ainit[:,:],axis=1)),Ainit) #Xinit = np.dot(np.diag(1/np.sum(Xinit[:,:],axis=1)),Xinit) lcall = np.dot(np.dot(W, Ainit), Xinit) noiselevel = 0.0001 lcall = lcall + noiselevel * np.mean(lcall) * np.random.normal(0.0, 1.0) ################################################## lcall = np.dot(np.diag(1 / np.sum(lcall[:, :], axis=1)), lcall) nside = 16 npix = hp.nside2npix(nside)