PRO gfit_plot_cont @labx_common @gfit_common ; Plot contours of Chi2 for fitting grating model to measured ; ratio data. ; Assumes data has been read in with gfit_read_file.pro . ; 3/8/95 dd Changed contour valuse to be reduced Chi2 ; 3/22/95 dd ; 3/28/95 dd Add output text giving analysis grating parameters ; ; Adjust levels and contour values by the number of degrees of freedom deg_of_f = n_elements(where(gf_W GT 0.0)) - 2 ; two fit parameters. ; Use closest power of two for change in the contour levels. adjust = 2^(FIX(ALOG(deg_of_f)/ALOG(2.0)+0.5)) tit_str = gf_data_file + ' : X^2/v Contours, v ='+ $ STRING(deg_of_f,FORMAT='(I2)') ; If the data file is from the pspc data area then remove the ; leading directory info ; and set a flag to over-print the anal driver grat model params anal_model = 0 ; remove /caliber/d1/xgef/pspc_data/ from string of present: c_loc = STRPOS(tit_str, '/caliber/d1/xgef/pspc_data/') if(c_loc NE-1) then begin tit_str = STRMID(tit_str,c_loc+27,100) anal_model=1 end x_str = 'Grating Line-width (A)' & y_str = 'Grating Thickness (A)' levels = SQRT(2.0^FLOAT(indgen(21))) ; spaced by root-2 up to 1024. levels = levels/adjust ; adjusted levels based on degrees of freedom ; Add in a double contour at Delta-Chi2 = 1 (Bevington "Confidence ; Levels for multiparameter fits", p 212 of second edition, Fig.11.2) ; this is the 1 sigma limit for the parameters min_chi2 = min(gf_contour) Dchi2plus1 = (min_chi2*deg_of_f + 1.0)/deg_of_f ; Add in 2 sigma as well, Delta-Chi2 = 4 Dchi2plus4 = (min_chi2*deg_of_f + 4.0)/deg_of_f unsort_levels = [Dchi2plus1*0.995, Dchi2plus1*1.005, levels] unsort_levels = [Dchi2plus4*0.995, Dchi2plus4*1.005, unsort_levels] ; Put the levels in increasing order levels = unsort_levels(SORT(unsort_levels)) ; Plot the results Contour,gf_contour,gf_lines,gf_thks,LEVELS=levels,TITLE=tit_str,$ XTITLE=x_str,YTITLE=y_str,XRANGE=[min(gf_lines),max(gf_lines)], $ YRANGE=[min(gf_thks),max(gf_thks)],$ /XSTYLE,/YSTYLE,charsiz=1.2,C_Charsize=1.3 ; Output the other grating parameters and Syst Limit value xyouts, 0.77, 0.900, SIZE=0.75, $ 'Polyimide = '+STRING(lx_gpoly,FORMAT='(F5.2)')+' um', /NORMAL xyouts, 0.77, 0.870, SIZE=0.75, $ 'Platingbase = '+STRING(lx_gplating,FORMAT='(F5.2)'), /NORMAL xyouts, 0.77, 0.840, SIZE=0.75, $ 'Syst limit = '+STRING(gf_syst_limit*100.,FORMAT='(F5.1)')+' %', /NORMAL xyouts, 0.77, 0.810, SIZE=0.75, $ 'Min X^2/v = '+STRING(min_chi2,FORMAT='(F6.2)'), /NORMAL xyouts, 0.77, 0.780, SIZE=0.75, $ ' at '+STRING(lx_gthk, lx_gline, $ FORMAT='(2F7.0)'), /NORMAL ; Output a short list indicating Energies and orders used for the fit: ; and weight! y_LO_list = 0.900 o_fmt = '(I2)' for ir = 0, n_elements(gf_E)-1 do begin xyouts, 0.25, y_LO_list, SIZE=0.75, $ STRING(gf_E(ir),FORMAT='(F7.3)') + ' keV: ' + $ STRING(gf_m1(ir),FORMAT=o_fmt) + '/' + $ STRING(gf_m2(ir),FORMAT=o_fmt) + $ STRING(gf_W(ir),FORMAT='(F6.2)'), /NORMAL y_LO_list = y_LO_list - 0.025 end ; If the ratios came from PSPC data,, output the anal_model parameters: if anal_model GT 0 then begin xyouts, 0.02, 0.035, 'anal_driver parameters:', /NORMAL ; grat_params = pspc_anal_model() ; xyouts, 0.02, 0.005, STRING(grat_params(0),grat_params(1), $ ; grat_params(2),grat_params(3), FORMAT='(2F6.0,2F5.2)'), $ ; SIZE=0.75, /NORMAL end RETURN END