Пример #1
0
 def test_wigner3j_smalll(self):
     correctanswer = np.fromfile(os.path.dirname(os.path.realpath(__file__)) + '/testset_smalll_128',dtype='float64').reshape(1000,7)
     #np.testing.assert_approx_equal(correctanswer[:,-1], np.array([wp.wigner3j(item[0],item[1],item[2],item[3],item[4],item[5]) for item in correctanswer]))
     pas = True
     for item in correctanswer:
         if abs((item[6] - wp.wigner3j(item[0],item[1],item[2],item[3],item[4],item[5]))/item[6]) > 1e-10:
             print item[:6].astype('int32'), item[6], wp.wigner3j(item[0],item[1],item[2],item[3],item[4],item[5])
             pas = False
     self.assertTrue(pas)
Пример #2
0
 def test_wigner3j_smalll(self):
     correctanswer = np.fromfile(os.path.dirname(os.path.realpath(__file__)) + '/testset_smalll_128',dtype='float64').reshape(1000,7)
     #np.testing.assert_approx_equal(correctanswer[:,-1], np.array([wp.wigner3j(item[0],item[1],item[2],item[3],item[4],item[5]) for item in correctanswer]))
     pas = True
     for item in correctanswer:
         if abs((item[6] - wp.wigner3j(item[0],item[1],item[2],item[3],item[4],item[5]))/item[6]) > 1e-10:
             print(item[:6].astype('int32'), item[6], wp.wigner3j(item[0],item[1],item[2],item[3],item[4],item[5]))
             pas = False
     self.assertTrue(pas)
def get_Bulm(Blm, freq=137, d=np.array([3.0, 6.0, 0.0])):
    k = 2 * pi * freq / 299.792458
    lmax = 4
    Bulm = {}
    for l in range(lmax + 1):
        for mm in range(-l, l + 1):
            Bulm[(l, mm)] = 0
            for l1 in range(lmax + 1):
                for mm1 in range(-l1, l1 + 1):
                    for l2 in range(abs(l - l1), l + l1 + 1):
                        mm2 = -(mm + mm1)
                        if abs(mm2) <= l2:
                            Bulm[(l, mm)] += 4 * pi * (1j**l2) * sphj(
                                l2, k * la.norm(d)) * np.conj(
                                    spheh(
                                        l2, mm2,
                                        ctos(d)[1],
                                        ctos(d)[2])) * Blm[(l1, mm1)] * m.sqrt(
                                            (2 * l + 1) * (2 * l1 + 1) *
                                            (2 * l2 + 1) /
                                            (4 * pi)) * wigner3j(
                                                l, l1, l2, 0, 0, 0) * wigner3j(
                                                    l, l1, l2, mm, mm1, mm2)
    return Bulm
Пример #4
0
def WignerFac(l1,l3,m1,m3):
    fac1 = wp.wigner3j(l1,l3,0, 0,0,0)
    fac2 = wp.wigner3j(l1,l3,0 ,m1,-m3,0)
    return fac1*fac2
Пример #5
0
 def test_bug3(self):
     self.assertAlmostEqual(wp.wigner3j(751, 856, 1200, 464, -828, 364),
                            -9.41731061215e-58, 62)
Пример #6
0
 def test_bug2(self):
     self.assertAlmostEqual(wp.wigner3j(529, 992, 1243, 196, -901, 705),
                            1.97986e-18, 23)
Пример #7
0
import wignerpy._wignerpy as wp

""" The argument goes that we're interested in what couples to 
l_sky = m_sky = 0, the constant mode of the sky """

l_beam = np.arange(0,3)
l_fringe = np.arange(0,3)

for l_b in l_beam:
    for l_f in l_fringe:
        for m_b in np.arange(-l_b,l_b+1):
            for m_f in np.arange(-l_f,l_f+1):
                print l_b, 0, l_f
                print m_b, 0, m_f
                fac1 = wp.wigner3j(l_b, 0, l_f,0,0,0)
                fac2 = wp.wigner3j(l_b, 0, l_f,m_b, 0, m_f)
                print fac1, fac2, fac1*fac2
                print

    
    
    
    
    
    
    
    
    
    
    
Пример #8
0
 def test_bug3(self):
     self.assertAlmostEqual(wp.wigner3j(751, 856, 1200, 464, -828, 364), -9.41731061215e-58, 62)
Пример #9
0
 def test_bug2(self):
     self.assertAlmostEqual(wp.wigner3j(529, 992, 1243, 196, -901, 705), 1.97986e-18, 23)
def get_Bulm(Blm,freq=137,d=np.array([3.0,6.0,0.0])):
	k = 2*pi*freq/299.792458
	lmax = 4
	Bulm={}
	for l in range(lmax+1):
		for mm in range(-l,l+1):
			Bulm[(l,mm)]=0
			for l1 in range(lmax+1):
				for mm1 in range(-l1,l1+1):
					for l2 in range(abs(l-l1),l+l1+1):
						mm2=-(mm+mm1)
						if abs(mm2)<=l2:
							Bulm[(l,mm)] += 4*pi*(1j**l2)*sphj(l2,k*la.norm(d))*np.conj(spheh(l2,mm2,ctos(d)[1],ctos(d)[2]))*Blm[(l1,mm1)]*m.sqrt((2*l+1)*(2*l1+1)*(2*l2+1)/(4*pi))*wigner3j(l,l1,l2,0,0,0)*wigner3j(l,l1,l2,mm,mm1,mm2)
	return Bulm