def computeLikelihood(self, ctx): """ call the native code to compute log likelihood :param ctx: an instance of a ChainContext :returns: the log likelihood :raises InvalidLikelihoodException: in case the log likelihood from the wmapWrapper is smaller than 0.0001 """ cl_tt =ctx.get(CL_TT_KEY) cl_te =ctx.get(CL_TE_KEY) cl_ee =ctx.get(CL_EE_KEY) cl_bb =ctx.get(CL_BB_KEY) loglike = -wmapWrapperManager.computewmaplikelihood(cl_tt,cl_te,cl_ee,cl_bb) if(abs(loglike)<0.0001): raise InvalidLikelihoodException() return loglike
# Copyright (C) 2015 ETH Zurich, Institute for Astronomy ''' Created on Apr 8, 2015 author: jakeret ''' from __future__ import print_function, division, absolute_import, unicode_literals import numpy as np from wmap5Wrapper import wmapWrapperManager data = np.loadtxt("lensedcls.dat") lenght= min(data.shape[0], 1199) cl_tt = data[:lenght, 1] cl_te = data[:lenght, 4] cl_ee = data[:lenght, 2] cl_bb = data[:lenght, 3] wmapWrapperManager.setup() likelihood = wmapWrapperManager.computewmaplikelihood(cl_tt,cl_te,cl_ee,cl_bb) print(likelihood)