예제 #1
0
elem.addMaterial("air", air)

elem.addSurface("object", objectsurf, (None, None))
elem.addSurface("m1", m1surf, (None, None))
elem.addSurface("m2", m2surf, (None, None))
elem.addSurface("m3", m3surf, (None, None))
elem.addSurface("image1", image1, (None, None))
elem.addSurface("oapara", oapara, (None, None))
elem.addSurface("image2", image2, (None, None))
elem.addSurface("image3", image3, (None, None))

s.addElement("TMA", elem)

print(s.rootcoordinatesystem.pprint())

rstobj = raster.MeridionalFan()
(px, py) = rstobj.getGrid(11)

rpup = 10
o = np.vstack((rpup*px, rpup*py, -5.*np.ones_like(px)))
k = np.zeros_like(o)
k[2,:] = 1.0 #2.*math.pi/wavelength
ey = np.zeros_like(o)
ey[1,:] =  1.
E0 = np.cross(k, ey, axisa=0, axisb=0).T

sysseq = [("TMA", 
           [
                ("object", {}), 
                ("m1", {"is_mirror":True}), 
                ("m2", {"is_stop":True, "is_mirror":True}), 
예제 #2
0
#                                            fieldType= field.ObjectHeight,
#                                            rasterType= raster.RectGrid,
#                                            nray=nray, wavelength=wavelength, stopPosition=5)
#initialBundle = aimy.getInitialRayBundle(s, fieldXY=np.array([0, 0]), wavelength=wavelength)
#nray = len(initialBundle.o[0, :])

(x0, k0, E0) = collimated_bundle(nrays, -5., 0., 1., raster.RectGrid())
t0 = time.clock()
initialraybundle = RayBundle(x0=x0, k0=k0, Efield0=E0)
raypath = s.seqtrace(initialraybundle, seq)
logging.info("benchmark : " + str(time.clock() - t0) + "s for tracing " + str(nrays) + " rays through " + str(len(s.elements["stdelem"].surfaces) - 1) + " surfaces.")
logging.info("             That is " + str(int(round(nrays * (len(s.elements["stdelem"].surfaces) - 1) / (time.clock() - t0)))) + "ray-surface-operations per second")

# plot

(x0_draw, k0_draw, E0_draw)= collimated_bundle(nrays_draw, -5., 0., 1., raster.MeridionalFan())
initialraybundle_draw = RayBundle(x0=x0_draw, k0=k0_draw, Efield0=E0_draw)
raypath_draw = s.seqtrace(initialraybundle_draw, seq)


fig = plt.figure(1)
ax = fig.add_subplot(111)
ax.axis('equal')
if StrictVersion(matplotlib.__version__) < StrictVersion('2.0.0'):
    ax.set_axis_bgcolor('white')
else:
    ax.set_facecolor('white')


phi = 0.#math.pi/4
pn = np.array([math.cos(phi), 0, math.sin(phi)]) # canonical_ex