forked from belliavesha/CompSlab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.py
32 lines (29 loc) · 1.38 KB
/
check.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# # angular symmetry: CHECK [v]
def CheckAngularSymmetry(r,x1,x2,mu1,mu2):
eps=1e-10
one = r(x1,x2,mu1,mu2)
two = r(x1,x2,mu2,mu1)
three = r(x1,x2,-mu1,-mu2)
four = r(x1,x2,-mu2,-mu1)
v=True
a,b,c = two[0][0]/one[0][0]-1,three[0][0]/one[0][0]-1,four[0][0]/two[0][0]-1 # 0 0 0
if abs(a)>eps or abs(b)>eps or abs(c)>eps : v=False
a,b,c = two[1][0]/one[0][1]-1,three[1][0]/one[1][0]-1,four[0][1]/two[0][1]-1 # 0 0 0
if abs(a)>eps or abs(b)>eps or abs(c)>eps : v=False
a,b,c = two[0][1]/one[1][0]-1,three[0][1]/one[0][1]-1,four[1][0]/two[1][0]-1 # 0 0 0
if abs(a)>eps or abs(b)>eps or abs(c)>eps : v=False
a,b,c = two[1][1]/one[1][1]-1,three[1][1]/one[1][1]-1,four[1][1]/two[1][1]-1 # 0 0 0
if abs(a)>eps or abs(b)>eps or abs(c)>eps : v=False
return v
# # frequency symmetry: CHECK [v]
def CheckFrequencySymmetry(r,x1,x2,mu1,mu2,Theta):
from numpy import exp
eps =1e-10
one = r(x1,x2,mu1,mu2)
two = r(x2,x1,mu1,mu2)
v=True
v=v and abs( x1**3 / x2**3 * exp((x2-x1)/Theta)*two[0][0]/one[0][0]-1)<eps # 1e-15
v=v and abs( x1**3 / x2**3 * exp((x2-x1)/Theta)*two[1][0]/one[1][0]-1)<eps # 1e-12
v=v and abs( x1**3 / x2**3 * exp((x2-x1)/Theta)*two[0][1]/one[0][1]-1)<eps # 1e-12
v=v and abs( x1**3 / x2**3 * exp((x2-x1)/Theta)*two[1][1]/one[1][1]-1)<eps # 1e-14
return v