def twyman_green(self, lambda_1 = 632, PR = 1): lambda_1 = lambda_1*(10**-9) A = self.__coefficients__ r = __np__.linspace(-PR, PR, 400) x, y = __np__.meshgrid(r,r) OPD = __seidelcartesian__(A,x,y)*2/PR ph = 2 * __np__.pi * OPD I1 = 1 I2 = 1 Ixy = I1 + I2 + 2 * __np__.sqrt(I1*I2) * __np__.cos(ph) __tools__.makecircle(Ixy, r, PR) fig = __plt__.figure(figsize=(9, 6), dpi=80) __plt__.imshow(-Ixy, extent=[-PR,PR,-PR,PR]) __plt__.set_cmap('Greys') __plt__.show()
def twyman_green(self, lambda_1=632, PR=1): lambda_1 = lambda_1 * (10**-9) A = self.__coefficients__ r = __np__.linspace(-PR, PR, 400) x, y = __np__.meshgrid(r, r) OPD = __seidelcartesian__(A, x, y) * 2 / PR ph = 2 * __np__.pi * OPD I1 = 1 I2 = 1 Ixy = I1 + I2 + 2 * __np__.sqrt(I1 * I2) * __np__.cos(ph) __tools__.makecircle(Ixy, r, PR) fig = __plt__.figure(figsize=(9, 6), dpi=80) __plt__.imshow(-Ixy, extent=[-PR, PR, -PR, PR]) __plt__.set_cmap('Greys') __plt__.show()
def twyman_green(coefficients, lambda_1=632, PR=1): """ Genertate Twyman_Green Interferogram based on zernike polynomials ============================================= input ---------------------------------------------- Class zernike polynomials coefficients in wavenumber see Class:opticspy.zernike.Coefficients lambda_1: wavelength in nanometer, default = 632nm PR: pupil radius, default = 1mm output ---------------------------------------------- Interferogram of aberration """ lambda_1 = lambda_1 * (10**-9) coefficients = coefficients.__coefficients__ r = __np__.linspace(-PR, PR, 400) x, y = __np__.meshgrid(r, r) rr = __np__.sqrt(x**2 + y**2) OPD = __zernike__.__zernikecartesian__(coefficients, x, y) * 2 / PR ph = 2 * __np__.pi * OPD I1 = 1 I2 = 1 Ixy = I1 + I2 + 2 * __np__.sqrt(I1 * I2) * __np__.cos(ph) __tools__.makecircle(Ixy, r, PR) #====================================================== fig = __plt__.figure(figsize=(9, 6), dpi=80) __plt__.imshow(-Ixy, extent=[-PR, PR, -PR, PR]) __plt__.set_cmap('Greys') label = 'Zernike Coefficients:' m = 1 for i in coefficients: if i != 0: label = label + "Z" + str(m) + "=" + str(i) + " " m = m + 1 __plt__.xlabel(label, fontsize=16) __plt__.title('Twyman Green Interferogram', fontsize=16) fig.set_tight_layout(True) __plt__.show()
def twyman_green(coefficients, lambda_1 = 632, PR = 1): """ Genertate Twyman_Green Interferogram based on zernike polynomials ============================================= input ---------------------------------------------- Class zernike polynomials coefficients in wavenumber see Class:opticspy.zernike.Coefficients lambda_1: wavelength in nanometer, default = 632nm PR: pupil radius, default = 1mm output ---------------------------------------------- Interferogram of aberration """ lambda_1 = lambda_1*(10**-9) coefficients = coefficients.__coefficients__ r = __np__.linspace(-PR, PR, 400) x, y = __np__.meshgrid(r,r) rr = __np__.sqrt(x**2 + y**2) OPD = __zernike__.__zernikecartesian__(coefficients,x,y)*2/PR ph = 2 * __np__.pi * OPD I1 = 1 I2 = 1 Ixy = I1 + I2 + 2 * __np__.sqrt(I1*I2) * __np__.cos(ph) __tools__.makecircle(Ixy, r, PR) #====================================================== fig = __plt__.figure(figsize=(9, 6), dpi=80) __plt__.imshow(-Ixy, extent=[-PR,PR,-PR,PR]) __plt__.set_cmap('Greys') label = 'Zernike Coefficients:' m = 1 for i in coefficients: if i!=0: label = label + "Z" + str(m) + "=" + str(i) +" " m = m + 1 __plt__.xlabel(label,fontsize=16) __plt__.title('Twyman Green Interferogram',fontsize=16) fig.set_tight_layout(True) __plt__.show()
def twyman_green(coefficients, lambda_1=632, PR=1): """ Genertate Twyman_Green Interferogram based on zernike polynomials ============================================= input ---------------------------------------------- Class zernike polynomials coefficients in wavenumber see Class:opticspy.zernike.Coefficients lambda_1: wavelength in nanometer, default = 632nm PR: pupil radius, default = 1mm output ---------------------------------------------- Interferogram of aberration """ lambda_1 = lambda_1 * (10**-9) coefficients = coefficients.__coefficients__ r = __np__.linspace(-PR, PR, 400) x, y = __np__.meshgrid(r, r) rr = __np__.sqrt(x**2 + y**2) OPD = __zernike__.__zernikecartesian__(coefficients, x, y) * 2 / PR ph = 2 * __np__.pi * OPD I1 = 1 I2 = 1 Ixy = I1 + I2 + 2 * __np__.sqrt(I1 * I2) * __np__.cos(ph) __tools__.makecircle(Ixy, r, PR) #====================================================== fig = __plt__.figure(figsize=(11, 9), dpi=60) __plt__.imshow(-Ixy, extent=[-PR, PR, -PR, PR]) ax = fig.gca() ax.set_aspect('equal', 'datalim') __plt__.set_cmap('Greys') __plt__.title('Twyman Green Interferogram', fontsize=18) __plt__.colorbar() fig.set_tight_layout(True) return fig ################################################################
def twyman_green(coefficients, lambda_1 = 632, PR = 1): """ Genertate Twyman_Green Interferogram based on zernike polynomials ============================================= input ---------------------------------------------- Class zernike polynomials coefficients in wavenumber see Class:opticspy.zernike.Coefficients lambda_1: wavelength in nanometer, default = 632nm PR: pupil radius, default = 1mm output ---------------------------------------------- Interferogram of aberration """ lambda_1 = lambda_1*(10**-9) coefficients = coefficients.__coefficients__ r = __np__.linspace(-PR, PR, 400) x, y = __np__.meshgrid(r,r) rr = __np__.sqrt(x**2 + y**2) OPD = __zernike__.__zernikecartesian__(coefficients,x,y)*2/PR ph = 2 * __np__.pi * OPD I1 = 1 I2 = 1 Ixy = I1 + I2 + 2 * __np__.sqrt(I1*I2) * __np__.cos(ph) __tools__.makecircle(Ixy, r, PR) #====================================================== fig = __plt__.figure(figsize=(11, 9), dpi=60) __plt__.imshow(-Ixy, extent=[-PR,PR,-PR,PR]) ax = fig.gca() ax.set_aspect('equal', 'datalim') __plt__.set_cmap('Greys') __plt__.title('Twyman Green Interferogram',fontsize=18) __plt__.colorbar() fig.set_tight_layout(True) return fig ################################################################
def twyman_green(A=0, B=0, C=0, D=0, E=0, F=0, G=0, lambda_1 = 632, PR = 1): """ Genertate Twyman_Green Interferogram based on Seidel aberration ============================================= input ---------------------------------------------- coefficients in wavenumber(ex. D=8 means 8 max error in defocus aberration) A: Constant(piston)term B: Tilt about the y axis C: Tilt about the x axis D: Reference sphere change, also called defocus E: Sagittal astigmatism along the y axis F: Sagittal coma along the y axis G: Primary spherical aberration lambda_1: wavelength in nanometer, default = 632nm PR: pupil radius, default = 1 output ---------------------------------------------- Interferogram of aberration """ lambda_1 = lambda_1*(1e-9) coefficients = [A,B,C,D,E,F,G] r = __np__.linspace(-PR, PR, 400) x, y = __np__.meshgrid(r,r) rr = __np__.sqrt(x**2 + y**2) wavemap = lambda n: n*lambda_1*2/PR [A,B,C,D,E,F,G] = map(wavemap, [A,B,C,D,E,F,G]) OPD = A + \ B * x + \ C * y + \ D * (x**2 + y**2) + \ E * (x**2 + 3 * y**2) + \ F * y * (x**2 + y**2) + \ G * (x**2 + y**2)**2 ph = 2 * __np__.pi/lambda_1 * OPD I1 = 1 I2 = 1 Ixy = I1 + I2 + 2 * __np__.sqrt(I1*I2) * __np__.cos(ph) __tools__.makecircle(Ixy, r, PR) #====================================================== fig = __plt__.figure(figsize=(9, 6), dpi=80) __plt__.imshow(-Ixy, extent=[-PR,PR,-PR,PR]) __plt__.set_cmap('Greys') label = '' def labelgenerate(b): label = 'Interferogram with ' count = 0 count_1 = 0 labellist = ['A: piston', 'B: Tilt about the y axis', 'C: Tilt about the x axis', 'D: Defocus', 'E: Sagittal astigmatism along the y axis', 'F: Sagittal coma along the y axis', 'G: Primary spherical aberration'] for i in b: if i != 0: label = label + str(i) + r'$\lambda$' + ' ' + labellist[count] + '\n' else: count_1 = count_1 + 1 count = count + 1 if count_1 == len(b): label = label + ' ' + 'no aberration' return label label = labelgenerate(coefficients) __plt__.xlabel(label,fontsize=16) __plt__.title('Twyman Green Interferogram',fontsize=16) fig.set_tight_layout(True) __plt__.show()
def twyman_green(A=0, B=0, C=0, D=0, E=0, F=0, G=0, lambda_1=632, PR=1): """ Genertate Twyman_Green Interferogram based on Seidel aberration ============================================= input ---------------------------------------------- coefficients in wavenumber(ex. D=8 means 8 max error in defocus aberration) A: Constant(piston)term B: Tilt about the y axis C: Tilt about the x axis D: Reference sphere change, also called defocus E: Sagittal astigmatism along the y axis F: Sagittal coma along the y axis G: Primary spherical aberration lambda_1: wavelength in nanometer, default = 632nm PR: pupil radius, default = 1 output ---------------------------------------------- Interferogram of aberration """ lambda_1 = lambda_1 * (1e-9) coefficients = [A, B, C, D, E, F, G] r = __np__.linspace(-PR, PR, 400) x, y = __np__.meshgrid(r, r) rr = __np__.sqrt(x**2 + y**2) wavemap = lambda n: n * lambda_1 * 2 / PR [A, B, C, D, E, F, G] = map(wavemap, [A, B, C, D, E, F, G]) OPD = A + \ B * x + \ C * y + \ D * (x**2 + y**2) + \ E * (x**2 + 3 * y**2) + \ F * y * (x**2 + y**2) + \ G * (x**2 + y**2)**2 ph = 2 * __np__.pi / lambda_1 * OPD I1 = 1 I2 = 1 Ixy = I1 + I2 + 2 * __np__.sqrt(I1 * I2) * __np__.cos(ph) __tools__.makecircle(Ixy, r, PR) #====================================================== fig = __plt__.figure(figsize=(9, 6), dpi=80) __plt__.imshow(-Ixy, extent=[-PR, PR, -PR, PR]) __plt__.set_cmap('Greys') label = '' def labelgenerate(b): label = 'Interferogram with ' count = 0 count_1 = 0 labellist = [ 'A: piston', 'B: Tilt about the y axis', 'C: Tilt about the x axis', 'D: Defocus', 'E: Sagittal astigmatism along the y axis', 'F: Sagittal coma along the y axis', 'G: Primary spherical aberration' ] for i in b: if i != 0: label = label + str( i) + r'$\lambda$' + ' ' + labellist[count] + '\n' else: count_1 = count_1 + 1 count = count + 1 if count_1 == len(b): label = label + ' ' + 'no aberration' return label label = labelgenerate(coefficients) __plt__.xlabel(label, fontsize=16) __plt__.title('Twyman Green Interferogram', fontsize=16) fig.set_tight_layout(True) __plt__.show()