Exemple #1
0
 def weight(self,args,data_phif0,data_phi,data_f,mc_phif0,mc_phi,mc_f):
     array_args = args.reshape(4,-1) 
     f0m,f0w,const,theta = np.split(array_args,4,axis=0)
     f0m = np.squeeze(f0m,axis=0)
     f0w = np.squeeze(f0w,axis=0)
     theta = np.squeeze(theta,axis=0)
     const = np.append(np.squeeze(const,axis=0),np.ones(const.shape)).reshape(2,-1)
     d_phif0 = self.MOD(f0m,f0w,const,theta,data_phif0,data_phi,data_f)
     m_phif0 = self.MOD(f0m,f0w,const,theta,mc_phif0,mc_phi,mc_f)
     d_tmp = np.sum(dplex.dabs(d_phif0),axis=1)
     m_tmp = np.average(np.sum(dplex.dabs(m_phif0),axis=1))
     return d_tmp/m_tmp
Exemple #2
0
 def mods(self,args,wt,data_phif0,data_phi,data_f,mc_phif0,mc_phi,mc_f):
     args = np.array(args)
     array_args = args.reshape(4,-1) 
     f0m,f0w,const,theta = np.split(array_args,4,axis=0)
     f0m = np.squeeze(f0m,axis=0)
     f0w = np.squeeze(f0w,axis=0)
     theta = np.squeeze(theta,axis=0)
     const = np.append(np.squeeze(const,axis=0),np.ones(const.shape)).reshape(2,-1)
     d_phif0 = self.MOD(f0m,f0w,const,theta,data_phif0,data_phi,data_f)
     m_phif0 = self.MOD(f0m,f0w,const,theta,mc_phif0,mc_phi,mc_f)
     d_tmp = np.sum(dplex.dabs(d_phif0),axis=1)
     m_tmp = np.average(np.sum(dplex.dabs(m_phif0),axis=1))
     wt_sum = np.sum(wt)
     return -np.sum(wt*(np.log(d_tmp) - np.log(m_tmp))) / np.log(wt_sum)
Exemple #3
0
def alladd(*mods):
    l = (mods[0].shape)[1]
    sum = onp.zeros(l*2*2).reshape(2,l,2)
    for num in mods:
        sum += num
#     print(sum.shape)
    return np.sum(dplex.dabs(sum),axis=1)
Exemple #4
0
def likelyhood(phim,phiw,f0m,f0w,f2m,f2w,const1,const2,rho,theta,_data_phif0,_data_phif2,_mc_phif0,_mc_phif2,_data_phi,_data_f,_mc_phi,_mc_f):
    d_phif0 = MOD(phim,phiw,f0m,f0w,const1,theta,rho,_data_phif0,_data_phi,_data_f)
    d_phif2 = MOD(phim,phiw,f2m,f2w,const2,theta,rho,_data_phif2,_data_phi,_data_f)
    m_phif0 = MOD(phim,phiw,f0m,f0w,const1,theta,rho,_mc_phif0,_mc_phi,_mc_f)
    m_phif2 = MOD(phim,phiw,f2m,f2w,const2,theta,rho,_mc_phif2,_mc_phi,_mc_f)
    d_tmp = np.sum(dplex.dabs(d_phif0+d_phif2),axis=1)
    print(d_tmp.shape)
    d_tmp = -np.sum(np.log(d_tmp))
    print(d_tmp)
    return 0
Exemple #5
0
    def test_pw(self, phim, phiw, f0m, f0w, const, rho, theta, phif0, phi, f0):
        print(self.id + ': test_pw is called')
        ph = np.moveaxis(self.phase_f0(theta, rho), 1, 0)
        bw = self.BW_f0(phim, phiw, f0m, f0w, phi, f0)
        _phif0 = dplex.dtomine(np.einsum('ijk,il->ljk', phif0, const))
        _phif0 = dplex.deinsum('ijk,i->ijk', _phif0, ph)
        _phif0 = dplex.deinsum('ijk,ij->jk', _phif0, bw)
        _phif0 = np.real(np.sum(dplex.dabs(_phif0), axis=1))

        return -np.sum(np.log(_phif0))
Exemple #6
0
 def part11(self,args,wt,data_phif0,data_phi,data_f,mc_phif0,mc_phi,mc_f):
     args = np.array(args)
     array_args = args.reshape(4,-1) 
     f0m,f0w,const,theta = np.split(array_args,4,axis=0)
     f0m = np.squeeze(f0m,axis=0)
     f0w = np.squeeze(f0w,axis=0)
     theta = np.squeeze(theta,axis=0)
     const = np.append(np.squeeze(const,axis=0),np.ones(const.shape)).reshape(2,-1)
     d_phif0 = self.MOD(f0m,f0w,const,theta,data_phif0,data_phi,data_f)
     d_tmp = np.sum(dplex.dabs(d_phif0),axis=1)
     return np.log(d_tmp)