Esempio n. 1
0
r = main.wg_radius[u'ОВССП']
w = (r, r)
lam = 1.55
n = 1.47

div_angle = 2 * lam/(math.pi * r**2)
fi_min = 0
fi_max = 12

def toRadians(fi):
    return fi*math.pi/180

def angular_xz(fi):
    d = 2*toRadians(fi)*r/div_angle
    cylinder = Gauss(*w, a=d, b=main.max_coupling_point)
    return coupling(planar.func, cylinder.func)

def angular_yz(fi):
    d = 2*toRadians(fi)*r/div_angle
    cylinder = Gauss(*w, a=0, b=main.max_coupling_point-d)
    return coupling(planar.func, cylinder.func)

x_range = np.arange(fi_min, fi_max, 0.2)
pylab.plot(x_range, [angular_xz(x) for x in x_range], 'k', label=u'Плоскость XZ')
pylab.plot(x_range, [angular_yz(x) for x in x_range], 'k--', label=u'Плоскость YZ')
pylab.legend()
pylab.grid()
main.arrow_axes((fi_min, fi_max), (0, 1), "$\phi,{}^\circ$", "C")

pylab.savefig(main.getOutImagePath(__file__))
import main
from wg_base.coupling import coupling
from gauss import Gauss
from planar import Planar

outputW = Planar(open('matrix/dump2d.csv'))
r = main.wg_radius[u'ОВССП']

def substrat(x):
    inputW = Gauss(r, r, 0, x)
    result = coupling(inputW.func, outputW.func)
    if result > substrat.maxVal:
        substrat.maxVal = result
        substrat.maxArg = x
    return result
substrat.maxVal = 0

xmin = -15
xmax = main.xmax
maxVal = 0

x_range = np.arange(xmin, xmax, 0.1)
pylab.plot(x_range, [substrat(x_arg) for x_arg in x_range])
pylab.plot([substrat.maxArg, substrat.maxArg], [0, 1], 'b--')
pylab.grid()
pylab.annotate("Cmax = {0:.3f}".format(substrat.maxVal), (xmax-5, 0.75))
pylab.annotate("Xmax = {0:.1f}".format(substrat.maxArg), (xmax-5, 0.68))
main.arrow_axes((xmin, xmax), (0, 1), "$\Delta y$", "C")

pylab.savefig(main.getOutImagePath(__file__))
Esempio n. 3
0
                   arrowprops=dict(arrowstyle="->", connectionstyle="arc,angleA=180,armA=50,rad=8"))

def intersect(r, x):
    cylinder = Gauss(r, r, x[0], x[1])
    return coupling(planar.func, cylinder.func)

def var_radius(r):
    result = intersect(r, fmin_powell(lambda x: -intersect(r, x), [0, -2]))
    if result > var_radius.maxVal:
        var_radius.maxVal = result
        var_radius.maxArg = r
    return result
var_radius.maxVal = 0

xmin = 1
xmax = 7

cutoff_radius = 2.405/(2*math.pi*0.14)

x_range = np.arange(xmin, xmax+1, 0.2)
pylab.plot(x_range, [var_radius(x) for x in x_range], 'k')
# pylab.plot([cutoff_radius, cutoff_radius], [0, 1], 'b--')
annotateWaveguide('Corning', (40, 40))
annotateWaveguide(u'ОВССП', (40, 60))
annotateWaveguide('PANDA', (40, 50))
pylab.grid()
pylab.annotate("Cmax = {0:.3f}".format(var_radius.maxVal), (3, 1))
pylab.annotate("Rmax = {0:.1f}".format(var_radius.maxArg), (3, 0.9))
main.arrow_axes((xmin, xmax), (0, 1.2), "$r$", "C")

pylab.savefig(main.getOutImagePath(__file__))