m1 = PECMirror(name="M1", centre=(0,-40,0), direction=(0,1,-1), diameter=30., thickness=5.) aligned = RectAperture(name="entry", centre = (0,5,15), direction = (0,1,0), length = 30., width = 30.) antialigned = RectAperture(name="reversed", centre = (0,-5,15), direction = (0,-1,0), length = 30., width = 30.) l1 = PlanoConvexLens(centre=(0,-40,30), direction=(0,0,1)) ratio = Total_Efficency(Target=m1.faces[0], Aperture=aligned.faces[0]) model = RayTraceModel(optics=[m1,aligned,antialigned], sources=[source,], results=[ratio]) model.configure_traits()
# curvature2 = -50, # dispersion = NondispersiveCurve(1.5), # dispersion_coating = NondispersiveCurve(1.25), # coating_thickness = 0.0 # ) model = RayTraceModel(optics=[l1,], sources=[source,]) #model.trace_detail_async() #import time #start = time.clock() #model.trace_all() #end = time.clock() #print "traced in", end - start #import timeit #t = timeit.Timer("model.update = True","from __main__ import model") #ret = t.timeit(10) #print "time:", ret model.trace_all() final_rays = source.TracedRays[-1] focus = find_ray_focus(final_rays) print("Effective focal length:", (focus[1]-l1.centre[1])) model.configure_traits(kind="live")