# Transmission of General Twist Cell # assume tilt angles are zeros, so dn is constant # input: twist, input & output polarizer angles, d(n(e)-n(0)) # Output: Transmission vs. wavelength from math import * from Numeric import array, matrixmultiply #from dislin import * class twist_cell: def __init__(self, twist, ip, op, dn): self.__twist=twist self.__ip=ip self.__op=op self.__dn=dn def x(self, wavelength): delta=pi*self.__dn/wavelength return sqrt(self.__twist**2+delta**2) def a(self, wavelength): dummy=cos(self.__twist)*cos(self.x(wavelength)) +self.__twist/self.x(wavelength)*sin(self.__twist)*sin(self.x(wavelength)) return dummy def b(self, wavelength): dummy=self.__twist/self.x(wavelength)*cos(self.__twist)*sin(self.x(wavelength)) return dummy def c(self, wavelength): dummy=sin(self.__twist)*cos(self.x(wavelength)) -self.__twist/self.x(wavelength)*cos(self.__twist)*sin(self.x(wavelength)) return dummy def d(self, wavelength): dummy=self.__twist/self.x(wavelength)*sin(self.__twist)*sin(self.x(wavelength)) return dummy def T(self, wavelength): mlc=array([ [self.a(wavelength)-self.b(wavelength)*1.j, -self.c(wavelength)-self.d(wavelength)*1.j] ,[self.c(wavelength)-self.d(wavelength)*1.j, self.a(wavelength)+self.b(wavelength)*1.j] ]) ip=array([cos(self.__ip), sin(self.__ip)]) # 1x2 matrix op=array([[cos(self.__op)], [sin(self.__op)]]) # 2x1 matrix dummy=matrixmultiply(ip,mlc) dummy=matrixmultiply(dummy,op) return (abs(dummy[0]))**2 def Transmission(self): t=range(400,700) for n in range(300): t[n]=self.T((400+(n/299.)*300)*(.000000001)) x=range(400,700) #metafl('cons') #disini() #complx() #pagera() #axspos(450, 1800) #axslen(2200, 1200) #graf(400., 700., 400., 50., 0., 1., 0., 0.1) #curve(x,t,300) #plot(x,t) #disfin ()