;pro plot_erf_comp, ps = ps ;restore, 'erf_results.sav' ; loads X2, energy,width,pixels,date ; Make a histogram of the mean energy and deviation ; Calculate some statistics: ;print, 'Statistics for the Reconstructed Mean Energy:' loadct, 39 ;tsize =3.5 tsize =1.0 ; Identify the pixels that failed this test: badOnes = where(allx2 eq 0, nbad) if nbad gt 0 then begin energy[badOnes] = average(energy[where(allx2 ne 0)]) width[badOnes] = average(width[where(allx2 ne 0)]) endif ;; Okay, now going to do the "threshold" measurement: aveE = average(energy) effE = energy - aveE thresh = 5 * width - effE bmin = 0.3 bmax = 2.5 nbin = 100 if nbad gt 0 then $ thresh[badOnes] = bmin wh = histogram(thresh, min = bmin, max = bmax, binsize = (bmax-bmin)/nbin) wInd = findgen(n_elements(wh)) * (bmax-bmin)/nbin + bmin stp2=findgen(256)/256*(bmax-bmin)+bmin bar2=fltarr(n_elements(stp2),2) bar2[*,0]=stp2 bar2[*,1]=stp2 widthb=bytscl(thresh,min=bmin,max=bmax) plotimage,widthb,yr=[32,0],/xst,/yst,$ pixel_aspect_ratio=1.0,position=[0.14,0.12,0.48,0.75],$ charsize=csize1,xtit="Column",ytit="Row" plotimage,bytscl(bar2),position=[0.14,0.77,0.48,0.80],$ yticks=1,ytickname=[' ',' '],charsize=csize1, /noerase,$ xthick=tsize, ythick=tsize, charthick=tsize,$ imgxrange=[bmin,bmax], title = 'Threshold Energy (keV)' cumu = reverse(findgen(n_elements(thresh) + 1)) xr1 = [0.3, 2.5] yr1 = [0, max(cumu)] cumthresh = thresh[sort(thresh)] plot, cumthresh, cumu, position = [0.65,0.58,0.95,0.90], $ xtitle = 'Threshold Energy (keV)', $ ytitle = 'Number of noisy pixels', $ charsize=csize1, /noerase, $ yrange = yr1,xrange = xr1, /xst, /yst, psym = 4 xyouts, xr1[0]+(xr1[1]-xr1[0])*0.25, yr1[1]*1.05, charsize=csize, $ 'Max threshold: '+string(max(thresh), format = '(f4.2)')+' keV' xr2 = [1.8, 2.5] yr2 = [0, max(cumu[where(cumthresh gt xr2[0])])] plot, cumthresh, cumu, position = [0.65,0.10,0.95,0.42], $ xtitle = 'Threshold Energy (keV)', $ ytitle = 'Number of noisy pixels', $ charsize=csize1, /noerase, $ yrange = yr2,xrange = xr2, /xst, /yst, psym = 4 num2 = where(cumthresh ge 2., noisy) xyouts, xr2[0]+(xr2[1]-xr2[0])*0.25, yr2[1]*1.05, charsize=csize, $ 'Noisy pixels at 2 keV: '+string(noisy, format = '(f6.2)') end