transform the beam into the local coordinate system of an optic, taking care to handle intersecting an optic at any angle and position. This is typically used by optics to get the q parameter (etc.) of the beam as it appears in the optic's preferred coordinate system It also records information about the shape of the beam which can be captured by setting a marker. Definition at line 340 of file general_optics.py. 00340 : 00341 """transform the beam into the local coordinate system of an optic, taking care to handle intersecting an optic at any angle and position. 00342 This is typically used by optics to get the q parameter (etc.) of the beam as it appears in the optic's preferred coordinate system 00343 It also records information about the shape of the beam which can be captured by setting a marker. 00344 """ 00345 ar=Numeric.array 00346 dot=Numeric.dot 00347 tr=Numeric.transpose 00348 00349 if hasattr(self,"local_x0"): 00350 raise "attempt to localize already localized beam at optic: "+optic.name 00351 self.incoming_direction=self.direction() 00352 cm=dot(optic.matrix_to_local, self.matrix_to_global) 00353 cm2=ar(cm[0:2,0:2]) 00354 a,b,c,d=tuple(cm2.flat) 00355 cm2inv=ar(((d,-b),(-c,a)))/(a*d-b*c) 00356 self.incoming_q=self.q.clone() 00357 self.q.transform(cm2) 00358 self.footprint_q=self.q.clone() #keep a copy of the localized q for markers 00359 self.local_x0=dot(optic.matrix_to_local, self.x0-optic.center) 00360 self.local_direction=ar(cm[:,2]) 00361 self.localize_tensor_transform=cm2inv 00362 self.local_polarization=dot(cm2, self.polarization) 00363 def globalize(self, optic):
|