Exemplo n.º 1
0
def genmirrors2(ray, a):
    return [
            pol.straightline(ray[0], a),
            pol.straightline(ray[1], a),
            pol.straightline(ray[2], -a),
            pol.straightline(ray[3], -a)
            ]
Exemplo n.º 2
0
def genmirrors(geometry):
    a = geometry['angle']
    d = geometry['normal']
    l = geometry['length']
    return [
            pol.straightline([0, 0], a),
            # TODO: french model: mirror shift fixed @ 37.5mm
            # mirrors at central-beam position
            pol.straightline([d * np.cos(pi / 2 + a),
                d * np.sin(pi / 2 + a)], a),
            pol.straightline([l + d * np.sin(a),
                d * np.cos(a)], -a),
            pol.straightline([l, 0], -a)
            ]
Exemplo n.º 3
0
def update(val):
    omega = np.deg2rad(somega.val)
    geometry['angle'] = np.deg2rad(sangle.val)
    mirrors = genmirrors(geometry)
    for n, o in enumerate([-omega, omega, 0]):
        path = pol.straightline(geometry['focus'], o).mirrorpath(mirrors).T
        pathplots[n].set_data(path[0], path[1])
        if not o:
            mirrors2 = genmirrors2(path.T[1:5], geometry['angle'])
    for n, m in enumerate(mirrors2):
        M = np.array([m.goto(-geometry['msize'][n]),
            m.goto(geometry['msize'][n])])
        mirrorplots[n].set_data(M[:, 0], M[:, 1])
        fig.show()
    m1.set_xdata(np.rad2deg(geometry['angle']))
    m2.set_xdata(np.rad2deg(geometry['angle'] - omega))
    m3.set_xdata(np.rad2deg(geometry['angle'] + omega))
Exemplo n.º 4
0
        'energy': 60,
        }

# {{{ plot
# {{{ beam visualization
fig = plt.figure()
pic = fig.add_subplot(211)
fig.subplots_adjust(top=.95, left=.07, bottom=.15, right=.75)
pic.axis('equal')
pic.set_xlabel('x (mm)')
pic.set_ylabel('y (mm)')
pic.set_xlim(-110, 360)
mirrors = genmirrors(geometry)
pathplots, mirrorplots = [], []
for o in [-omega, omega, 0]:
    path = pol.straightline(geometry['focus'], o).mirrorpath(mirrors).T
    c = 'red' if o else 'darkgreen'
    pathplots.append(pic.plot(path[0], path[1], '-', color=c, lw=2)[0])
    if not o:
        mirrors2 = genmirrors2(path.T[1:5], geometry['angle'])
for i, m in enumerate(mirrors2):
    M = np.array([m.goto(-geometry['msize'][i]), m.goto(geometry['msize'][i])])
    mirrorplots.append(pic.plot(M[:, 0], M[:, 1], '-', color='black', lw=2)[0])
# }}}

# {{{ polarization and reflectivity
mirror = pol.mirror(mirrordef)
angles = np.arange(np.pi / 4, np.pi / 2, .01)
plotangle = np.rad2deg(np.pi / 2 - angles)
Rd = np.array([mirror.get_Rd(a) for a in angles])
pic2 = fig.add_subplot(212)