Reimplemented from reflector. Definition at line 1179 of file general_optics.py. 01179 : 01180 dot=Numeric.dot 01181 tr=Numeric.transpose 01182 deg=math.pi/180.0 01183 01184 #need to find basis set for rotation which is perp. to beam and grating rulings (yhat) 01185 kx, ky, kz = v2 = self.beam.local_direction 01186 v3 = cross((1,0,0), v2) #this is rotation axis (!) in grating frame 01187 v3 /= vec_mag(v3) 01188 v1 = cross(v2, v3) #this is first basis vector for rotation 01189 v1 /= vec_mag(v1) 01190 coord=Numeric.array((v1,v2,v3)) #matrix to convert coordinates in grating system into diffraction rotation system 01191 cinv=tr(coord) #matrix to convert diffraction basis vectors to grating basis i.e. cinv.(0,0,1) is rotation axis in grating system 01192 01193 #print "**grating**" 01194 #print Numeric.array_str(coord, precision=4) 01195 01196 theta=math.atan2(kx, math.sqrt(ky*ky+kz*kz)) 01197 littrow, out=self.angles(theta, self.beam.get_lambda()) 01198 #print littrow/deg, theta/deg, out/deg, (out+theta)/deg 01199 01200 #remember, outgoing angle is _not_ outgoing direction... beam has changed from incoming to outgoing, too 01201 dtheta=out+theta 01202 s,c=-math.sin(dtheta), math.cos(dtheta) 01203 01204 #this funny matrix is a rotation by dtheta, followed by a reflection in z 01205 rot1=dot(Numeric.array(((1,0,0),(0,1,0),(0,0,-1))), dot(cinv, dot(Numeric.array(((c,s,0),(-s,c,0),(0,0,1))), coord ))) 01206 #print Numeric.array_str(rot1, precision=4) 01207 self.beam.transform(self.globalize_transform(rot1)) 01208 def degree_angles(self, theta, lam):
|