Viewing contents of file '../idllib/ghrs/pro/calc_ripple.pro'
;+
;*NAME:
;			calc_ripple
;*PURPOSE:
; Compute approximate ripple function for purposes of estimating
; exposure times.  (no epsilon effect is included and the
; blaze is set to 63.4 degress and 2*delta=13.25)
;
;*CALLING SEQUENCE:
;	calc_ripple,grating,order,wave,ripple
;
;*PARAMETERS
; INPUTS:
;	grating - grating mode (6 for EA and 7 for EB)
;	order - spectral order(s)
;	wave  - wavelength(s)
;
; OUTPUT:
;	ripple - echelle ripple function normallized to 1.0 at
;		the blaze angle.
;
; HISTORY:
; 	version 1  D. Lindler  June 88
;       Mar 11 1991      JKF/ACC    - moved to GHRS DAF (IDL Version 2)
;-
;----------------------------------------------------------------------------
pro calc_ripple,grating,order,wave,ripple
;
; compute scan angle
;
calc_carpos,grating,order,wave,carpos,gamma
theta = 63.4*3.14159/180.0	;blaze angle
delta = 13.25/2*3.14159/180
;
alpha = gamma + delta	;angle of incidence
beta = gamma - delta	;angle of diffraction
;
status= check_math(0,1)
z = order*3.14159*cos(theta+delta)*sin(gamma - theta)/sin(gamma)/cos(delta)
status= check_math(0,0)
if status ne 0 then begin
	print,'WARNING: MATH error detected in routine CALC_RIPPLE'
	print,' z=order*3.14159*cos(theta+delta)*sin(gamma - theta)/sin(gamma)/cos(delta)
	print,check_math_msg(status)
	print,' '
	end
status= check_math(0,1)
ripple = cos(alpha)/cos(beta)*(sin(z)/z)^2
status= check_math(0,0)
if status ne 0 then begin
	print,'WARNING: MATH error detected in routine CALC_RIPPLE'
	print,' ripple = cos(alpha)/cos(beta)*(sin(z)/z)^2'
	print,check_math_msg(status)
	print,' '
	end
;
; normalize to peak of 1.0
;
ripple=ripple*cos(theta-delta)/cos(theta+delta)
return
end