Viewing contents of file '../idllib/astron/contrib/varosi/code/allpro/error_analysis.pro'
;+
; NAME:
;	error_analysis
; PURPOSE:
;	Compute the expected relative error in tranmission images based
;	on the estimated the error properties of original IN & OUT data.
; CALLING:
;	error_analysis, image_List
; INPUT and OUTPUT:
;	image_List = structured array with substructures .info and .info_ref.
;		The tag image_List.Rel_Error is updated.
; HISTORY:
;	written, Frank Varosi 1997.
;-

pro error_analysis, image_List

	info = image_List.info
	image_List.Rel_Err_in = info.E_stdev/info.E_value
	w = where( strpos( image_List.history, "I" ) LT 0, nw )

	if (nw GT 0) then begin
		image_List(w).Rel_Err_out = image_List(w).Rel_Err_in
		image_List(w).Rel_Err_in = 0
	   endif

	binf = check_Bin_Fact( image_List )
	Rel_Error = info.E_stdev/info.E_value/binf + 6e-3/info.exposure

	w = where( info.Lpower GT 0, nw )
	if (nw GT 0) then Rel_Error(w) = Rel_Error(w) + $
					info(w).Lpwrsig/float( info(w).Lpower )

	wt = where( strpos( image_List.history, "/" ) GT 0, nwt )

	if (nwt GT 0) then begin
		info = image_List(wt).info_ref
		image_List(wt).Rel_Err_out = info.E_stdev/info.E_value
		Rel_Error(wt) = Rel_Error(wt) + 6e-3/info.exposure + $
						info.E_stdev/info.E_value/binf	
		w = where( info.Lpower GT 0, nw )
		if (nw GT 0) then Rel_Error(wt(w)) = Rel_Error(wt(w)) +  $
					info(w).Lpwrsig/float( info(w).Lpower )
	   endif

	image_List.Rel_Error = Rel_Error
end