'position_x':0.0,
                'position_y':0.0,})
            #lens = PlanoConvexLens(**lensdict)
            lens = BiConvexLens(**lensdict)
            ray_source = RectangularWindowPointSource(x=x,y=y)
            ray_gen = RayGenerator(source=ray_source,surface=lens.surfaces[0],num_rays=10)        

            
            #create a sensor
            sensor_length = 10
            sensor_x = -4.0
            sensor = FlatSensor(Point(sensor_x,-sensor_length/2.0),Point(sensor_x,sensor_length/2.0))
            
            bench = OpticalBench(min_x = -1000.0, max_x = 1000.0,
                                 min_y = -500.0, max_y = 500.0, 
                                 source = ray_source, lens = lens, 
                                 sensor = sensor, refractive_index = 1.0, 
                                 ray_generator = ray_gen)
            
            try:
                bench.compute_rays()
                sensor.analyze(ray_source)
                sensor_values[x_i][y_i] = sensor.readout_position
                incident_angles[x_i][y_i] = (180.0/math.pi)*math.atan2(y,x)
                incident_angles1[x_i][y_i] = (180.0/math.pi)*math.atan2(y, x-sensor_x)
                incident_angles2[x_i][y_i] = (180.0/math.pi)*math.atan2(y, x+8)
                incident_angles3[x_i][y_i] = (180.0/math.pi)*math.atan2(y, x+6)
                
            except Exception as e:
                print e.message
                sensor_values[x_i][y_i] = float("NaN")
Exemple #2
0
                                          y=work_center.y+work_size/3.0)

lensdict = thorlabs_bc_f_146
lensdict.update({
    'baffle_offset':-2.0,
    'baffle_id':8.0,
    'position_x':0.0,
    'position_y':0.0,})
#lens = PlanoConvexLens(**lensdict)
lens = BiConvexLens(**lensdict)

ray_gen = RayGenerator(source=ray_source,lens=lens,surface=lens.surfaces[0],num_rays=200)

bench = OpticalBench(min_x = -1000.0, max_x = 1000.0,
                     min_y = -500.0, max_y = 500.0, 
                     source = ray_source, lens = lens, 
                     sensor = sensor, refractive_index = 1.0, 
                     ray_generator = ray_gen)

bench.compute_rays()
sensor.analyze(ray_source)

#compute rough power requirements
if single_run:
    radius_led_sphere = Vector(ray_source.x-lens.position_x,ray_source.y-lens.position_y).norm
    area_led_sphere = 4*math.pi*(radius_led_sphere**2)
    area_lens = 2*math.pi*((lens.baffle_id/2)**2)
    print "Area Led Sphere: ",area_led_sphere,"mm2"
    print "Area Lens: ",area_lens,"mm2"
    print "Ratio : ",area_led_sphere/area_lens
    print "For 1uW Power, Led power order: ",(area_led_sphere/area_lens)*(1e-3),"mW"