zern_polar.pro

来自「IDL语言编写的用于天文自适应光学仿真的软件CAOS V6.0的第一部分。」· PRO 代码 · 共 61 行

PRO
61
字号
; $Id: zern_polar.pro,v 1.1.1.1 2002/03/12 11:53:46 riccardi Exp $
;
; A. Riccardi, Dipartimento di Astronomia di Firenze (Italy).
; e-mail address: riccardi@arcetri.astro.it
; Please, send me a message if you modify this code.


function zern_polar, j, r, theta
;+
; NAME:
;       ZERN_POLAR
;
; PURPOSE:
;       ZERN_POLAR returns the value of j-th Zernike polynomial
;       in a point of polar coordinates r,theta.
;       (We use Noll formulation of Zernike polynomials)
;
; CATEGORY:
;       Special polynomial
;
; CALLING SEQUENCE:
;
;       Result = ZERN_POLAR(J, R, Theta)
;
; INPUTS:
;       J:      index of the polynomial, integer J >= 1
;       R:      point to evaluate (polar coord.)
;       Theta:
;
; OUTPUTS:
;       ZERN_POLAR returns the value of j-th Zernike polynomial
;       in the point of polar coordinates r, theta.
;       If r>1 then return 0. On error return 0.
;
; EXAMPLE:
;       Evaluate Zernike x coma in rho, theta. Enter:
;
;            Result = ZERN_POLAR(8, rho, theta)
;
; MODIFICATION HISTORY:
;       Written by:     A. Riccardi; March, 1995.
;-
	if j lt 1 then begin
		print, 'zern_polar -- must have j>=0'
		return, 0.
	endif

	;calculate radial degree n and azimuthal frequency m
	zern_degree, j, n, m  
  
	result = sqrt(n+1.+r(0)*0.)*zern_radial(n, m, r)

	if m eq 0 then $
		return, result $
	else $
		if is_even(j) then $
			return, sqrt(r(0)*0.+2.)*result*cos(m*theta) $
		else $
			return, sqrt(r(0)*0.+2.)*result*sin(m*theta)
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?