def rotate_axis(self, axis_theta): self.rotate_in_local_frame( general_optics.eulermat(-self.brewster_angle, 0, 0)) self.rotate_in_local_frame(general_optics.eulermat(0, 0, axis_theta)) self.rotate_in_local_frame( general_optics.eulermat(self.brewster_angle, 0, 0)) return self
def rotate_axis( self, axis_theta ): #must undo screwy angles for this object before rotating self.rotate_in_local_frame( general_optics.eulermat(-self.brewster_angle, 0, 0)) self.rotate_in_local_frame(general_optics.eulermat(0, 0, axis_theta)) self.rotate_in_local_frame( general_optics.eulermat(self.brewster_angle, 0, 0)) return self
def init(self, theta1, clen, lambda0, center, angle, extras): my=ir_compressor input_height=18*inch output_height=12*inch center_height=(input_height+output_height)/2.0 basebeam=beam((0,input_height,-1.0), qtens(lambda0, w=0.005, r=Infinity)) optics={} optics[my.INPUT]=m1=reflector("input mirror", center=(0, input_height, 0), width=8*inch, angle=-45) optics[my.G1]=g1=grating("g1", angle=theta1+90, center=(52*inch,center_height, 0), pitch=1740e3, order=1, width=16*inch, thickness=2.0*inch) mybeam=basebeam.clone() m1.transport_to_here(mybeam) m1.transform(mybeam) g1.transport_to_here(mybeam) g1.transform(mybeam) mybeam.free_drift(clen) #this is where grating 2 should be optics[my.G2]=g2=grating("g2", angle=theta1-90, center=mybeam.x0+(0,0,1e-8), pitch=1740e3, order=1, width=16*inch, thickness=2.0*inch) optics[my.VR1]=reflector("retro", center=(40*inch, center_height, g2.center[2]), angle=90.0, width=8*inch, thickness=1.0*inch) out=optics[my.OUTPUT]=reflector("output mirror", center=(8*inch, output_height, 0.0), width=8.0*inch, thickness=1.0*inch) focus=optics[my.FOCUS]=lens("output focus", center=out.center+(35*inch, 0, 7*inch), angle=90-math.atan(0.2)/deg, f=2.0, width=8.0*inch, height=8.0*inch, thickness=1.0*inch).tilt_off_axis(0) out.set_direction(g1.center-(0, center_height-output_height, 0), focus) comp_order=(my.INPUT, my.G1, my.G2, my.VR1, my.G2, my.G1, my.OUTPUT, my.FOCUS) composite_optic.init(self, "ir compressor", optics, comp_order, None, center=center, angle=0, extras=extras ) #prepare to handle to downslope in the beam through the compressor while we are still #not rotated to the funny beam axis m1label=self.mark_label(my.INPUT) g1label=self.mark_label(my.G1) m2label=self.mark_label(my.OUTPUT) ir_trace=trace_path(self, basebeam.clone()) path_len=(ir_trace[(m2label,0)].total_drift-ir_trace[(m1label,0)].total_drift) slope=(output_height-input_height)/path_len #distance from entrance to first g1 hit g1_first_distance=(ir_trace[(g1label,0)].total_drift-ir_trace[(m1label,0)].total_drift) #distance from entrance to second g1 hit g1_second_distance=(ir_trace[(g1label,1)].total_drift-ir_trace[(m1label,0)].total_drift) #now, rotate us to the real beam direction self.update_coordinates(self.center, self.center, general_optics.eulermat(angle, 0, 0)) #and set up the aiming points self.g1target1=g1.center+(0, (input_height-center_height)+g1_first_distance*slope, 0) self.g1target2=g1.center+(0, (input_height-center_height)+g1_second_distance*slope, 0) out.set_direction(self.g1target2, focus)
def outer_polygon(self): savew, savet = self.width, self.thickness self.width = 4 * inch self.thickness = 6 * inch myrot = general_optics.eulermat(-self.brewster_angle, self.eta, 0) self.rotate_in_local_frame(myrot) try: p = self.polygon() finally: self.width = savew self.thickness = savet self.rotate_in_local_frame(Numeric.transpose(myrot)) return p
def outer_polygon(self): savew, savet = self.width, self.thickness self.width=4*inch self.thickness=6*inch myrot=general_optics.eulermat(-self.brewster_angle,self.eta,0) self.rotate_in_local_frame(myrot) try: p=self.polygon() finally: self.width=savew self.thickness=savet self.rotate_in_local_frame(Numeric.transpose(myrot)) return p
def init(self, theta1, clen, lambda0, center, angle, extras): my = ir_compressor input_height = 18 * inch output_height = 12 * inch center_height = (input_height + output_height) / 2.0 basebeam = beam((0, input_height, -1.0), qtens(lambda0, w=0.005, r=Infinity)) optics = {} optics[my.INPUT] = m1 = reflector("input mirror", center=(0, input_height, 0), width=8 * inch, angle=-45) optics[my.G1] = g1 = grating("g1", angle=theta1 + 90, center=(52 * inch, center_height, 0), pitch=1740e3, order=1, width=16 * inch, thickness=2.0 * inch) mybeam = basebeam.clone() m1.transport_to_here(mybeam) m1.transform(mybeam) g1.transport_to_here(mybeam) g1.transform(mybeam) mybeam.free_drift(clen) # this is where grating 2 should be optics[my.G2] = g2 = grating("g2", angle=theta1 - 90, center=mybeam.x0 + (0, 0, 1e-8), pitch=1740e3, order=1, width=16 * inch, thickness=2.0 * inch) optics[my.VR1] = reflector("retro", center=(40 * inch, center_height, g2.center[2]), angle=90.0, width=8 * inch, thickness=1.0 * inch) out = optics[my.OUTPUT] = reflector("output mirror", center=(8 * inch, output_height, 0.0), width=8.0 * inch, thickness=1.0 * inch) focus = optics[my.FOCUS] = lens("output focus", center=out.center + (35 * inch, 0, 7 * inch), angle=90 - math.atan(0.2) / deg, f=2.0, width=8.0 * inch, height=8.0 * inch, thickness=1.0 * inch).tilt_off_axis(0) out.set_direction(g1.center - (0, center_height - output_height, 0), focus) comp_order = (my.INPUT, my.G1, my.G2, my.VR1, my.G2, my.G1, my.OUTPUT, my.FOCUS) composite_optic.init(self, "ir compressor", optics, comp_order, None, center=center, angle=0, extras=extras) # prepare to handle to downslope in the beam through the compressor while we are still # not rotated to the funny beam axis m1label = self.mark_label(my.INPUT) g1label = self.mark_label(my.G1) m2label = self.mark_label(my.OUTPUT) ir_trace = trace_path(self, basebeam.clone()) path_len = (ir_trace[(m2label, 0)].total_drift - ir_trace[(m1label, 0)].total_drift) slope = (output_height - input_height) / path_len # distance from entrance to first g1 hit g1_first_distance = (ir_trace[(g1label, 0)].total_drift - ir_trace[(m1label, 0)].total_drift) # distance from entrance to second g1 hit g1_second_distance = (ir_trace[(g1label, 1)].total_drift - ir_trace[(m1label, 0)].total_drift) # now, rotate us to the real beam direction self.update_coordinates(self.center, self.center, general_optics.eulermat(angle, 0, 0)) # and set up the aiming points self.g1target1 = g1.center + (0, (input_height - center_height) + g1_first_distance * slope, 0) self.g1target2 = g1.center + (0, (input_height - center_height) + g1_second_distance * slope, 0) out.set_direction(self.g1target2, focus)
def place_between(self, from_obj, to_obj, distance): reflector.place_between(self, from_obj, to_obj, distance) self.rotate_in_local_frame( general_optics.eulermat(self.brewster_angle, 0, 0)) return self
def rotate_axis(self, axis_theta): #must undo screwy angles for this object before rotating self.rotate_in_local_frame(general_optics.eulermat(-self.brewster_angle,0,0)) self.rotate_in_local_frame(general_optics.eulermat(0,0,axis_theta)) self.rotate_in_local_frame(general_optics.eulermat(self.brewster_angle,0,0)) return self
def place_between(self, from_obj, to_obj, distance): reflector.place_between(self, from_obj, to_obj, distance) self.rotate_in_local_frame(general_optics.eulermat(self.brewster_angle,0,0)) return self