def doubleslit(b=0.1,a=0.4,lambda_1=632,z=0.5): """ Return a Young's doubleslit(Frauhofer Diffraction) Input: -------------------------------- b: slit of width in mm a: slit separation of in mm lambda_1: wavelength in nm z: slit-to-screen distance in m. """ lambda_1 = float(lambda_1) theta = __np__.linspace(-0.04,0.04,1000) theta1 = __np__.ones(100) [theta,theta1] = __np__.meshgrid(theta,theta1) beta = __np__.pi*(b/1000)/(lambda_1/(10**9))*__sin__(theta) alpha = __np__.pi*(a/1000)/(lambda_1/(10**9))*__sin__(theta) y = 4*(__sin__(beta)**2/(beta**2)*__cos__(alpha)**2) fig = __plt__.figure(1,figsize=(12,8), dpi=80) __plt__.imshow(-y) __plt__.set_cmap('Greys') __plt__.show() theta = __np__.linspace(-0.04,0.04,1000) beta = __np__.pi*(b/1000)/(lambda_1/(10**9))*__sin__(theta) alpha = __np__.pi*(a/1000)/(lambda_1/(10**9))*__sin__(theta) y = 4*(__sin__(beta)**2/(beta**2)*__cos__(alpha)**2) y1 = 4*__sin__(beta)**2/(beta**2) fig = __plt__.figure(2,figsize=(12, 8), dpi=80) __plt__.plot(theta*z*1000,y) __plt__.plot(theta*z*1000,y1,"g--") __plt__.show()
def doubleslit(b=0.1, a=0.4, lambda_1=632, z=0.5): """ Return a Young's doubleslit(Frauhofer Diffraction) Input: -------------------------------- b: slit of width in mm a: slit separation of in mm lambda_1: wavelength in nm z: slit-to-screen distance in m. """ lambda_1 = float(lambda_1) theta = __np__.linspace(-0.04, 0.04, 1000) theta1 = __np__.ones(100) [theta, theta1] = __np__.meshgrid(theta, theta1) beta = __np__.pi * (b / 1000) / (lambda_1 / (10**9)) * __sin__(theta) alpha = __np__.pi * (a / 1000) / (lambda_1 / (10**9)) * __sin__(theta) y = 4 * (__sin__(beta)**2 / (beta**2) * __cos__(alpha)**2) fig = __plt__.figure(1, figsize=(12, 8), dpi=80) __plt__.imshow(-y) __plt__.set_cmap('Greys') __plt__.show() theta = __np__.linspace(-0.04, 0.04, 1000) beta = __np__.pi * (b / 1000) / (lambda_1 / (10**9)) * __sin__(theta) alpha = __np__.pi * (a / 1000) / (lambda_1 / (10**9)) * __sin__(theta) y = 4 * (__sin__(beta)**2 / (beta**2) * __cos__(alpha)**2) y1 = 4 * __sin__(beta)**2 / (beta**2) fig = __plt__.figure(2, figsize=(12, 8), dpi=80) __plt__.plot(theta * z * 1000, y) __plt__.plot(theta * z * 1000, y1, "g--") __plt__.show()
def __seidelpolar__(coefficient,r,u): W = coefficient h = 1 Ap = W[0][0] * h**2 At = W[1][0] * h*r*__cos__(u-W[1][1]*__np__.pi/180) Ad = W[2][0] * r**2 Aa = W[3][0] * h**2*r**2*__cos__(u-W[3][1]*__np__.pi/180) Ac = W[4][0] * h*r*__cos__(u-W[4][1]*__np__.pi/180) As = W[5][0] * r**4 W = Ap+At+Ad+Aa+Ac+As return W
def __seidelpolar__(coefficient, r, u): W = coefficient h = 1 Ap = W[0][0] * h**2 At = W[1][0] * h * r * __cos__(u - W[1][1] * __np__.pi / 180) Ad = W[2][0] * r**2 Aa = W[3][0] * h**2 * r**2 * __cos__(u - W[3][1] * __np__.pi / 180) Ac = W[4][0] * h * r * __cos__(u - W[4][1] * __np__.pi / 180) As = W[5][0] * r**4 W = Ap + At + Ad + Aa + Ac + As return W
def __zernikepolar__(coefficient,a,r,u): """ ------------------------------------------------ __zernikepolar__(coefficient,r,u): Return combined aberration Orthonormal Rectangle Aperture Polynomials Caculation in polar coordinates coefficient: Orthonormal Rectangle Aperture Polynomials Coefficient from input r: rho in polar coordinates u: theta in polar coordinates ------------------------------------------------ """ mu = __sqrt__(9-36*a**2+103*a**4-134*a**6+67*a**6+67*a**8) v = __sqrt__(49-196*a**2+330*a**4-268*a**6+134*a**8) tau = 1/(128*v*a**4*(1-a**2)**2) eta = 9-45*a**2+139*a**4-237*a**6+210*a**8-67*a**10 R = [0]+coefficient R1 = R[1] * 1 R2 = R[2] * __sqrt__(3)/a*r*__cos__(u) R3 = R[3] * __sqrt__(3/(1-a**2))*r*__sin__(u) R4 = R[4] * __sqrt__(5)/2/__sqrt__(1-2*a**2+2*a**4)*(3*r**2-1) R5 = R[5] * 3/2/a/__sqrt__(1-a**2)*r**2*__sin__(2*u) R6 = R[6] * __sqrt__(5)/2/a**2/(1-a**2)/__sqrt__(1-2*a**2+2*a**4)*\ (3*(1-2*a**2+2*a**4)*r**2*__cos__(2*u)+3*(1-2*a**2)*r**2-\ 2*a**2*(1-a**2)*(1-2*a**2)) R7 = R[7] * __sqrt__(21)/2/__sqrt__(27-81*a**2+116*a**4-62*a**6)*\ (15*r**2-9+4*a**2)*r*__sin__(u) R8 = R[8] * __sqrt__(21)/2/a/__sqrt__(35-70*a**2+62*a**4)*\ (15*r**2-5-4*a**2)*r*__cos__(u) R9 = R[9] * (__sqrt__(5)*__sqrt__((27-54*a**2+62*a**4)/(1-a**2))/\ (8*a**2*(27-81*a**2+116*a**4-62*a**6)))*((27-54*a**2+62*a**4)*\ r*__sin__(3*u)-3*(4*a**2*(3-13*a**2+10*a**4)-(9-18*a**2-26*a**4))\ *r*__sin__(u)) r1 = 35-70*a**2+62*a**4 R10 = R[10] * (__sqrt__(5)/(8*a**3*(1-a**2)*__sqrt__(r1)))*((r1)*r**3*__cos__(3*u)-\ 3*(4*a**2*(7-17*a**2+10*a**4)-(r1)*r**2)*r*__cos__(u)) R11 = R[11] * 1/8/mu*(315*r**4+30*(1-2*a**2)*r**2*__cos__(2*u)-240*r**2+27+16*a*2-16*a**4) R12 = R[12] * (3*mu/(8*a**2*v*eta))*(315*(1-2*a**2)*(1-2*a**2+2*a**4)*r**4+\ 5*(7*mu**2*r**2-21+72*a**2-225*a**4+306*a**6-152*a**8)*r**2*__cos__(2*u)-\ 15*(1-2*a**2)*(7+4*a**2-71*a**4+134*a**6-67*a**8)*r**2+\ a**2*(1-a**2)*(1-2*a**2)*(70-233*a**2+233*a**4)) R13 = R[13] * __sqrt__(21)/(4*a*__sqrt__(1-3*a**2+4*a**4-2*a**6))*(5*r**2-3)*r**2*__sin__(2*u) R14 = R[14] * 6*tau*(5*v**2*r**4*__cos__(4*u)-20*(1-2*a**2)*(6*a**2*(7-16*a**2+18*a**4-9*a**6)-\ 49*(1-2*a**2+2*a**4)*r**2)*r**2*__cos__(u)+8*a**4*(1-a**2)**2*(21-62*a**2+62*a**4)-\ 120*a**2*(7-30*a**2+46*a**4-23*a**6)*r**2+\ 15*(49-196*a**2+282*a**4-172*a**6+86*a**8)*r**4) R15 = R[15] * (__sqrt__(21)/(8*a**3*__sqrt__((1-a**2)**3))/__sqrt__(1-2*a**2+2*a**4))*\ (-(1-2*a**2)*(6*a**2-6*a**4-5*r**2)*r**2*__sin__(2*u)+\ (5/2)*(1-2*a**2+2**a**4)*r**4*__sin__(4*u)) RW = R1 + R2 + R3+ R4+ R5+ R6+ R7+ R8+ R9+ \ R10+ R11+ R12+ R13+ R14+ R15 return RW
def __seidelpolar__(coefficient,r,u): h = coefficient[0] W = coefficient W200 = W[1] * h**2 W111 = W[2] * h*r*__cos__(u) W020 = W[3] * r**2 W040 = W[4] * r**4 W131 = W[5] * h*r**3*__cos__(u) W222 = W[6] * h**2*r**2*__cos__(u) W220 = W[7] * h**2*r**2 W311 = W[8] * h**3*r*__cos__(u) W = W200+W111+W020+W040+W131+W222+W220+W311 return W
def __seidelpolar__(coefficient, r, u): h = coefficient[0] W = coefficient W200 = W[1] * h**2 W111 = W[2] * h * r * __cos__(u) W020 = W[3] * r**2 W040 = W[4] * r**4 W131 = W[5] * h * r**3 * __cos__(u) W222 = W[6] * h**2 * r**2 * __cos__(u) W220 = W[7] * h**2 * r**2 W311 = W[8] * h**3 * r * __cos__(u) W = W200 + W111 + W020 + W040 + W131 + W222 + W220 + W311 return W
def zernikemap(self, label = True): """ ------------------------------------------------ zernikemap(self, label_1 = True): Return a 2D Zernike Polynomials map figure label: default show label ------------------------------------------------ """ theta = __np__.linspace(0, 2*__np__.pi, 400) rho = __np__.linspace(0, 1, 400) [u,r] = __np__.meshgrid(theta,rho) X = r*__cos__(u) Y = r*__sin__(u) Z = __zernikepolar__(self.__coefficients__,r,u) fig = __plt__.figure(figsize=(12, 8), dpi=80) ax = fig.gca() im = __plt__.pcolormesh(X, Y, Z, cmap=__cm__.RdYlGn) if label == True: __plt__.title('Zernike Polynomials Surface Heat Map',fontsize=18) ax.set_xlabel(self.listcoefficient()[1],fontsize=18) __plt__.colorbar() ax.set_aspect('equal', 'datalim') __plt__.show()
def zernikemap(self, label = True): """ ------------------------------------------------ zernikemap(self, label_1 = True): Return a 2D Zernike Polynomials map figure label: default show label ------------------------------------------------ """ theta = __np__.linspace(0, 2*__np__.pi, 400) rho = __np__.linspace(0, 1, 400) [u,r] = __np__.meshgrid(theta,rho) X = r*__cos__(u) Y = r*__sin__(u) Z = __interferometer__.__zernikepolar__(self.__coefficients__,r,u) fig = __plt__.figure(figsize=(12, 8), dpi=80) ax = fig.gca() im = __plt__.pcolormesh(X, Y, Z, cmap=__cm__.RdYlGn) if label == True: __plt__.title('Zernike Polynomials Surface Heat Map',fontsize=18) ax.set_xlabel(self.listcoefficient()[1],fontsize=18) __plt__.colorbar() ax.set_aspect('equal', 'datalim') __plt__.show()
def aspheresurface(self): """ Show the surface of an asphere. ============================================================= Try: A = opticspy.asphere.Coefficient(R=50,a2=0.18*10**(-8),a3 = 0.392629*10**(-13)) """ R = self.__coefficients__[0] theta = __np__.linspace(0, 2 * __np__.pi, 100) rho = __np__.linspace(0, R, 100) [u, r] = __np__.meshgrid(theta, rho) X = r * __cos__(u) Y = r * __sin__(u) Z = __aspherepolar__(self.__coefficients__, r) fig = __plt__.figure(figsize=(12, 8), dpi=80) ax = fig.gca(projection='3d') surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=__cm__.RdYlGn, linewidth=0, antialiased=False, alpha=0.6) __plt__.show() return 0
def seidelsurface(self, label = True, zlim=[], matrix = False): r1 = __np__.linspace(0, 1, 100) u1 = __np__.linspace(0, 2*__np__.pi, 100) [u,r] = __np__.meshgrid(u1,r1) X = r*__cos__(u) Y = r*__sin__(u) W = __seidelpolar__(self.__coefficients__,r,u) fig = __plt__.figure(figsize=(12, 8), dpi=80) ax = fig.gca(projection='3d') surf = ax.plot_surface(X, Y, W, rstride=1, cstride=1, cmap=__cm__.RdYlGn, linewidth=0, antialiased=False, alpha = 0.6) fig.colorbar(surf, shrink=1, aspect=30) __plt__.show()
def zernikesurface(self, label = True, zlim=[], matrix = False): """ ------------------------------------------------ zernikesurface(self, label_1 = True): Return a 3D Zernike Polynomials surface figure label_1: default show label ------------------------------------------------ """ theta = __np__.linspace(0, 2*__np__.pi, 100) rho = __np__.linspace(0, 1, 100) [u,r] = __np__.meshgrid(theta,rho) X = r*__cos__(u) Y = r*__sin__(u) Z = __interferometer__.__zernikepolar__(self.__coefficients__,r,u) fig = __plt__.figure(figsize=(12, 8), dpi=80) ax = fig.gca(projection='3d') surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=__cm__.RdYlGn, linewidth=0, antialiased=False, alpha = 0.6) if zlim == []: v = max(abs(Z.max()),abs(Z.min())) ax.set_zlim(-v*5, v*5) cset = ax.contourf(X, Y, Z, zdir='z', offset=-v*5, cmap=__cm__.RdYlGn) else: ax.set_zlim(zlim[0], zlim[1]) cset = ax.contourf(X, Y, Z, zdir='z', offset=zlim[0], cmap=__cm__.RdYlGn) ax.zaxis.set_major_locator(__LinearLocator__(10)) ax.zaxis.set_major_formatter(__FormatStrFormatter__('%.02f')) fig.colorbar(surf, shrink=1, aspect=30) p2v = round(__tools__.peak2valley(Z),5) rms1 = round(__tools__.rms(Z),5) label_1 = self.listcoefficient()[0]+"P-V: "+str(p2v)+"\n"+"RMS: "+str(rms1) if label == True: __plt__.title('Zernike Polynomials Surface',fontsize=18) ax.text2D(0.02, 0.1, label_1, transform=ax.transAxes,fontsize=14) else: pass __plt__.show() if matrix == True: return Z else: pass
def zernikesurface(self, label = True, zlim=[], matrix = False): """ ------------------------------------------------ zernikesurface(self, label_1 = True): Return a 3D Zernike Polynomials surface figure label_1: default show label ------------------------------------------------ """ theta = __np__.linspace(0, 2*__np__.pi, 100) rho = __np__.linspace(0, 1, 100) [u,r] = __np__.meshgrid(theta,rho) X = r*__cos__(u) Y = r*__sin__(u) Z = __zernikepolar__(self.__coefficients__,r,u) fig = __plt__.figure(figsize=(12, 8), dpi=80) ax = fig.gca(projection='3d') surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=__cm__.RdYlGn, linewidth=0, antialiased=False, alpha = 0.6) if zlim == []: v = max(abs(Z.max()),abs(Z.min())) ax.set_zlim(-v*5, v*5) cset = ax.contourf(X, Y, Z, zdir='z', offset=-v*5, cmap=__cm__.RdYlGn) else: ax.set_zlim(zlim[0], zlim[1]) cset = ax.contourf(X, Y, Z, zdir='z', offset=zlim[0], cmap=__cm__.RdYlGn) ax.zaxis.set_major_locator(__LinearLocator__(10)) ax.zaxis.set_major_formatter(__FormatStrFormatter__('%.02f')) fig.colorbar(surf, shrink=1, aspect=30) p2v = round(__tools__.peak2valley(Z),5) rms1 = round(__tools__.rms(Z),5) label_1 = self.listcoefficient()[0]+"P-V: "+str(p2v)+"\n"+"RMS: "+str(rms1) if label == True: __plt__.title('Zernike Polynomials Surface',fontsize=18) ax.text2D(0.02, 0.1, label_1, transform=ax.transAxes,fontsize=14) else: pass __plt__.show() if matrix == True: return Z else: pass
def seidelsurface(self, label=True, zlim=[], matrix=False): r1 = __np__.linspace(0, 1, 100) u1 = __np__.linspace(0, 2 * __np__.pi, 100) [u, r] = __np__.meshgrid(u1, r1) X = r * __cos__(u) Y = r * __sin__(u) W = __seidelpolar__(self.__coefficients__, r, u) fig = __plt__.figure(figsize=(12, 8), dpi=80) ax = fig.gca(projection='3d') surf = ax.plot_surface(X, Y, W, rstride=1, cstride=1, cmap=__cm__.RdYlGn, linewidth=0, antialiased=False, alpha=0.6) fig.colorbar(surf, shrink=1, aspect=30) __plt__.show()
def aspheresurface(self): """ Show the surface of an asphere. ============================================================= Try: A = opticspy.asphere.Coefficient(R=50,a2=0.18*10**(-8),a3 = 0.392629*10**(-13)) """ R = self.__coefficients__[0] theta = __np__.linspace(0, 2*__np__.pi, 100) rho = __np__.linspace(0, R, 100) [u,r] = __np__.meshgrid(theta,rho) X = r*__cos__(u) Y = r*__sin__(u) Z = __aspherepolar__(self.__coefficients__,r) fig = __plt__.figure(figsize=(12, 8), dpi=80) ax = fig.gca(projection='3d') surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=__cm__.RdYlGn, linewidth=0, antialiased=False, alpha = 0.6) __plt__.show() return 0
def spherical_surf(l1): R = 1.02 l1 = l1 #surface matrix length theta = __np__.linspace(0, 2*__np__.pi, l1) rho = __np__.linspace(0, 1, l1) [u,r] = __np__.meshgrid(theta,rho) X = r*__cos__(u) Y = r*__sin__(u) Z = __sqrt__(R**2-r**2)-__sqrt__(R**2-1) v_1 = max(abs(Z.max()),abs(Z.min())) noise = (__np__.random.rand(len(Z),len(Z))*2-1)*0.05*v_1 Z = Z+noise fig = __plt__.figure(figsize=(12, 8), dpi=80) ax = fig.gca(projection='3d') surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=__cm__.RdYlGn,\ linewidth=0, antialiased=False, alpha = 0.6) v = max(abs(Z.max()),abs(Z.min())) ax.set_zlim(-1, 2) ax.zaxis.set_major_locator(__LinearLocator__(10)) ax.zaxis.set_major_formatter(__FormatStrFormatter__('%.02f')) cset = ax.contourf(X, Y, Z, zdir='z', offset=-1, cmap=__cm__.RdYlGn) fig.colorbar(surf, shrink=1, aspect=30) __plt__.title('Test Surface: Spherical surface with some noise',fontsize=16) __plt__.show() #Generate test surface matrix from a detector x = __np__.linspace(-1, 1, l1) y = __np__.linspace(-1, 1, l1) [X,Y] = __np__.meshgrid(x,y) Z = __sqrt__(R**2-(X**2+Y**2))-__sqrt__(R**2-1)+noise for i in range(len(Z)): for j in range(len(Z)): if x[i]**2+y[j]**2>1: Z[i][j]=0 return Z
def Z20(self,r,u): return __sqrt__(12)*r**5*__cos__(5*u)
def Z18(self,r,u): return __sqrt__(12)*(5*r**2-4)*r**3*__cos__(3*u)
def Z16(self,r,u): return __sqrt__(12)*(10*r**4-12*r**2+3)*r*__cos__(u)
def Z14(self,r,u): return __sqrt__(10)*r**4*__cos__(4*u)
def Z12(self,r,u): return __sqrt__(10)*(4*r**2-3)*r**2*__cos__(2*u)
def Z10(self,r,u): return __sqrt__(8)*r**3*__cos__(3*u)
def Z8(self,r,u): return __sqrt__(8)*(3*r**2-2)*r*__cos__(u)
def Z28(self,r,u): return __sqrt__(14)*r**6*__cos__(6*u)
def Z24(self,r,u): return __sqrt__(14)*(15*r**4-20*r**2+6)*r**2*__cos__(2*u)
def Z36(self,r,u): return 4*r**7*__cos__(7*u)
def Z32(self,r,u): return 4*(21*r**4-30*r**2+10)*r**3*__cos__(3*u)
def Z26(self,r,u): return __sqrt__(14)*(6*r**2-5)*r**4*__cos__(4*u)
def Z2(self,r,u): return 2*r*__cos__(u)
def Z30(self,r,u): return 4*(35*r**6-60*r**4+30*r**2-4)*r*__cos__(u)
def Z6(self,r,u): return __sqrt__(6)*r**2*__cos__(2*u)
def Z34(self,r,u): return 4*(7*r**2-6)*r**5*__cos__(5*u)
def __zernikepolar__(coefficient,r,u): """ ------------------------------------------------ __zernikepolar__(coefficient,r,u): Return combined aberration Zernike Polynomials Caculation in polar coordinates coefficient: Zernike Polynomials Coefficient from input r: rho in polar coordinates u: theta in polar coordinates ------------------------------------------------ """ Z = [0]+coefficient Z1 = Z[1] * 1*(__cos__(u)**2+__sin__(u)**2) Z2 = Z[2] * 2*r*__cos__(u) Z3 = Z[3] * 2*r*__sin__(u) Z4 = Z[4] * __sqrt__(3)*(2*r**2-1) Z5 = Z[5] * __sqrt__(6)*r**2*__sin__(2*u) Z6 = Z[6] * __sqrt__(6)*r**2*__cos__(2*u) Z7 = Z[7] * __sqrt__(8)*(3*r**2-2)*r*__sin__(u) Z8 = Z[8] * __sqrt__(8)*(3*r**2-2)*r*__cos__(u) Z9 = Z[9] * __sqrt__(8)*r**3*__sin__(3*u) Z10 = Z[10] * __sqrt__(8)*r**3*__cos__(3*u) Z11 = Z[11] * __sqrt__(5)*(1-6*r**2+6*r**4) Z12 = Z[12] * __sqrt__(10)*(4*r**2-3)*r**2*__cos__(2*u) Z13 = Z[13] * __sqrt__(10)*(4*r**2-3)*r**2*__sin__(2*u) Z14 = Z[14] * __sqrt__(10)*r**4*__cos__(4*u) Z15 = Z[15] * __sqrt__(10)*r**4*__sin__(4*u) Z16 = Z[16] * __sqrt__(12)*(10*r**4-12*r**2+3)*r*__cos__(u) Z17 = Z[17] * __sqrt__(12)*(10*r**4-12*r**2+3)*r*__sin__(u) Z18 = Z[18] * __sqrt__(12)*(5*r**2-4)*r**3*__cos__(3*u) Z19 = Z[19] * __sqrt__(12)*(5*r**2-4)*r**3*__sin__(3*u) Z20 = Z[20] * __sqrt__(12)*r**5*__cos__(5*u) Z21 = Z[21] * __sqrt__(12)*r**5*__sin__(5*u) Z22 = Z[22] * __sqrt__(7)*(20*r**6-30*r**4+12*r**2-1) Z23 = Z[23] * __sqrt__(14)*(15*r**4-20*r**2+6)*r**2*__sin__(2*u) Z24 = Z[24] * __sqrt__(14)*(15*r**4-20*r**2+6)*r**2*__cos__(2*u) Z25 = Z[25] * __sqrt__(14)*(6*r**2-5)*r**4*__sin__(4*u) Z26 = Z[26] * __sqrt__(14)*(6*r**2-5)*r**4*__cos__(4*u) Z27 = Z[27] * __sqrt__(14)*r**6*__sin__(6*u) Z28 = Z[28] * __sqrt__(14)*r**6*__cos__(6*u) Z29 = Z[29] * 4*(35*r**6-60*r**4+30*r**2-4)*r*__sin__(u) Z30 = Z[30] * 4*(35*r**6-60*r**4+30*r**2-4)*r*__cos__(u) Z31 = Z[31] * 4*(21*r**4-30*r**2+10)*r**3*__sin__(3*u) Z32 = Z[32] * 4*(21*r**4-30*r**2+10)*r**3*__cos__(3*u) Z33 = Z[33] * 4*(7*r**2-6)*r**5*__sin__(5*u) Z34 = Z[34] * 4*(7*r**2-6)*r**5*__cos__(5*u) Z35 = Z[35] * 4*r**7*__sin__(7*u) Z36 = Z[36] * 4*r**7*__cos__(7*u) Z37 = Z[37] * 3*(70*r**8-140*r**6+90*r**4-20*r**2+1) Z = Z1 + Z2 + Z3+ Z4+ Z5+ Z6+ Z7+ Z8+ Z9+ \ Z10+ Z11+ Z12+ Z13+ Z14+ Z15+ Z16+ Z17+ Z18+ Z19+ \ Z20+ Z21+ Z22+ Z23+ Z24+ Z25+ Z26+ Z27+ Z28+ Z29+ \ Z30+ Z31+ Z32+ Z33+ Z34+ Z35+ Z36+ Z37 return Z
def Z1(self,r,u): return 1*(__cos__(u)**2+__sin__(u)**2)