savetxt(Path0+'Trace3DSigma_I_1600LC.dat',Sigma1600LC)
savetxt(Path0+'Trace3DSigma_I_1600NG.dat',Sigma1600NG)

savetxt(Path0+'Trace3DSigma_I_3120.dat',Sigma3120);
savetxt(Path0+'Trace3DSigma_I_3120NG.dat',Sigma3120NG);

savetxt(Path0+'Trace3DSigma_I_4450.dat',Sigma4450);
savetxt(Path0+'Trace3DSigma_I_4450NG.dat',Sigma4450NG);


savetxt(Path0+'Trace3DSigmaBend90.dat',SigmaBend90);


if True: 
	figure(1,figsize=(8,8));
	E0 = ellipse(Sigma0000)
	E1 = ellipse(Sigma0000LC)
	M = E0.MismatchFactor(E1,Type=1)

	subplot(2,2,1)
	E0.PlotXX1()
	E1.PlotXX1()
	text(0,0,'M=%0.4f' % M[1],va='center',ha='center',color='r',size=16)
	legend((r'1.000 mA','0.001 mA'),loc=2)

	subplot(2,2,2)
	E0.PlotYY1()
	E1.PlotYY1()
	text(0,0,'M=%0.4f' % M[1],va='center',ha='center',color='r',size=16)

	subplot(2,2,3)
Example #2
0
p_achse = np.array([-pi,0,np.NaN,-pi/2,pi/2])

# Kasten
x_k = np.array([a,-a,-a,a,a]) 
y_k = np.array([b,b,-b,-b,b] )
r_k = np.sqrt(x_k**2 + y_k**2) 
p_k = np.arctan2(y_k,x_k) 

# Asymptote
r_asym = np.array([r_0,r_0,NaN,r_0,r_0] )
x_asym = np.array([a,-a,NaN,a,-a])
y_asym = np.array([b,-b,NaN,-b,b])
p_asym = np.arctan2(y_asym,x_asym) 

# Ellipse
[phi,r] = ellipse(n_points,a,b) 
plt.figure()
plt.polar(p_achse,r_achse,'r')

plt.polar(p_k,r_k,'r')
plt.polar(phi,r) 

plt.title(['Ellipse: ','a=',str(a),' b=',str(b)]) 
#print('-depsc2','k_ellipse.eps')
#print('-dpng','k_ellipse.png')


# Hyperbel
[phi,r] = hyperbel(n_points,a,b,r_0) 
plt.figure ()
plt.polar(p_achse,r_achse,'r')
Example #3
0
## Tzu-Yang (Josh) Yueh
from ellipse import *
from ellipse_main import *
import sys

## A4_P3 simulate_many function
#################################
print('Function: {}'.format(simulate_many.__name__))
print('-' * 30)
print('Docstring:')
print(simulate_many.__doc__)
#################################
print('-' * 30)
print('Testing the overlap area of two identical circle (r=1)')
print('Input:')
e1 = ellipse(f1=point(0, 0), f2=point(0, 0), a=1)
e2 = ellipse(f1=point(0, 0), f2=point(0, 0), a=1)
print('    e1:  F1{}  F2{}  A:{}'.format(e1.f1, e1.f2, e1.a))
print('    e2:  F1{}  F2{}  A:{}'.format(e2.f1, e2.f2, e2.a))
print('Output:')
print('    Overlap area: {}'.format(simulate_many(1000000, e1, e2)))
print('Check (calling area method):')
print('    e1 area: {}'.format(e1.area()))
#################################
print('-' * 30)
print('Testing the overlap area of two separate ellipses')
print('input:')
e1 = ellipse(f1=point(0, 0), f2=point(1, 1), a=1)
e2 = ellipse(f1=point(15, 15), f2=point(16, 16), a=1.5)
print('    e1:  F1{}  F2{}  A:{}'.format(e1.f1, e1.f2, e1.a))
print('    e2:  F1{}  F2{}  A:{}'.format(e2.f1, e2.f2, e2.a))
Example #4
0
savetxt(Path0 + 'Trace3DSigma_I_1600.dat', Sigma1600)
savetxt(Path0 + 'Trace3DSigma_I_1600LC.dat', Sigma1600LC)
savetxt(Path0 + 'Trace3DSigma_I_1600NG.dat', Sigma1600NG)

savetxt(Path0 + 'Trace3DSigma_I_3120.dat', Sigma3120)
savetxt(Path0 + 'Trace3DSigma_I_3120NG.dat', Sigma3120NG)

savetxt(Path0 + 'Trace3DSigma_I_4450.dat', Sigma4450)
savetxt(Path0 + 'Trace3DSigma_I_4450NG.dat', Sigma4450NG)

savetxt(Path0 + 'Trace3DSigmaBend90.dat', SigmaBend90)

if True:
    figure(1, figsize=(8, 8))
    E0 = ellipse(Sigma0000)
    E1 = ellipse(Sigma0000LC)
    M = E0.MismatchFactor(E1, Type=1)

    subplot(2, 2, 1)
    E0.PlotXX1()
    E1.PlotXX1()
    text(0, 0, 'M=%0.4f' % M[1], va='center', ha='center', color='r', size=16)
    legend((r'1.000 mA', '0.001 mA'), loc=2)

    subplot(2, 2, 2)
    E0.PlotYY1()
    E1.PlotYY1()
    text(0, 0, 'M=%0.4f' % M[1], va='center', ha='center', color='r', size=16)

    subplot(2, 2, 3)