pro mergeplot,chip,node,type,line,a,offset,sigma,fwhm,chip0,node0,type0,line0,a0,offset0,sigma0,fwhm0 mnka=5.89875 & mnkb=6.49045 ;KeV esc=4.15877 & sika=1.73998 mnfel=0.6374 & au=9.713 mnka=1000*mnka & mnkb=1000*mnkb ;eV esc=1000*esc & sika=1000*sika mnfel=1000*mnfel & au=1000*au line_e=fltarr(n_elements(line)) line_e[where(line eq 'MnKa')]=mnka line_e[where(line eq 'MnKb')]=mnkb line_e[where(line eq 'Esc.')]=esc line_e[where(line eq 'SiKa')]=sika ;line_e[where(line eq 'AuL')]=au line_e0=fltarr(n_elements(line0)) line_e0[where(line0 eq 'MnKa')]=mnka line_e0[where(line0 eq 'MnKb')]=mnkb line_e0[where(line0 eq 'Esc.')]=esc line_e0[where(line0 eq 'SiKa')]=sika ;line_e0[where(line0 eq 'AuL')]=au ;for j=0,9 do begin for j=6,7 do begin for i=1,2 do begin tt='Chip '+string(j,format='(i1)')+', PHA' ;----Offset-------------------------------------- if(i eq 1)then begin ccd=where(chip eq j) t=type[ccd] & n=node[ccd] & l_e=line_e[ccd] y=offset[ccd] xr=[-500,10500] yr=[-50,3050] n1=where(n eq 1) n2=where(n eq 2) n3=where(n eq 3) n4=where(n eq 4) ;---Node 1--- x=l_e[n1] plot,x,y[n1],psym=4,$ ymargin=[0,0],xrange=xr,yrange=yr,$ xstyle=1,ystyle=1,ytitle='Node 1 Offset [ADU]',title=tt if(n_elements(y[n1]) gt 1) then begin if(i eq 1)then begin fit=linfit(x,y[n1],sigma=sigma) oplot,x,fit[0]+(x*(fit[1])) slope='Slope = '+string(fit[1],format='(f8.4)')+' +-'+string(sigma[1],format='(f6.4)') int='Intercept = '+string(fit[0],format='(f6.1)')+' +-'+string(sigma[0],format='(f5.1)') xyouts,0,yr[1]-(0.1*yr[1]),slope,/data xyouts,0,yr[1]-(0.2*yr[1]),int,/data gain1=fit[1] xyouts,0,yr[1]-(0.3*yr[1]),'Gain = '+string(gain1,format='(f6.4)')+' [ADU/eV]',/data x1=x res1 = (y[n1]) - (fit[0]+(x*(fit[1]))) endif endif ;---Node 2--- x=l_e[n2] plot,x,y[n2],psym=4,$ ymargin=[0,0],xrange=xr,yrange=yr,$ xstyle=1,ystyle=1,ytitle='Node 2 Offset [ADU]' if(i eq 1)then begin fit=linfit(x,y[n2],sigma=sigma) oplot,x,fit[0]+(x*(fit[1])) slope='Slope = '+string(fit[1],format='(f8.4)')+' +-'+string(sigma[1],format='(f6.4)') int='Intercept = '+string(fit[0],format='(f6.1)')+' +-'+string(sigma[0],format='(f5.1)') xyouts,0,yr[1]-(0.1*yr[1]),slope,/data xyouts,0,yr[1]-(0.2*yr[1]),int,/data gain2=fit[1] xyouts,0,yr[1]-(0.3*yr[1]),'Gain = '+string(gain2,format='(f6.4)')+' [ADU/eV]',/data x2=x res2 = (y[n2]) - (fit[0]+(x*(fit[1]))) endif ;---Node 3--- if(n3[0] ne -1)then begin x=l_e[n3] plot,x,y[n3],psym=4,$ ymargin=[0,0],xrange=xr,yrange=yr,$ xstyle=1,ystyle=1,ytitle='Node 3 Offset [ADU]' if(i eq 1)then begin fit=linfit(x,y[n3],sigma=sigma) oplot,x,fit[0]+(x*(fit[1])) slope='Slope = '+string(fit[1],format='(f8.4)')+' +-'+string(sigma[1],format='(f6.4)') int='Intercept = '+string(fit[0],format='(f6.1)')+' +-'+string(sigma[0],format='(f5.1)') xyouts,0,yr[1]-(0.1*yr[1]),slope,/data xyouts,0,yr[1]-(0.2*yr[1]),int,/data gain3=fit[1] xyouts,0,yr[1]-(0.3*yr[1]),'Gain = '+string(gain3,format='(f6.4)')+' [ADU/eV]',/data x3=x res3 = (y[n3]) - (fit[0]+(x*(fit[1]))) endif endif ;---Node 4--- if(n4[0] ne -1)then begin x=l_e[n4] plot,x,y[n4],psym=4,$ ymargin=[3,0],xrange=xr,yrange=yr,$ xstyle=1,ystyle=1,ytitle='Node 4 Offset [ADU]',$ xtitle='Line energy [eV]' if(i eq 1)then begin fit=linfit(x,y[n4],sigma=sigma) oplot,x,fit[0]+(x*(fit[1])) slope='Slope = '+string(fit[1],format='(f8.4)')+' +-'+string(sigma[1],format='(f6.4)') int='Intercept = '+string(fit[0],format='(f6.1)')+' +-'+string(sigma[0],format='(f5.1)') xyouts,0,yr[1]-(0.1*yr[1]),slope,/data xyouts,0,yr[1]-(0.2*yr[1]),int,/data gain4=fit[1] xyouts,0,yr[1]-(0.3*yr[1]),'Gain = '+string(gain4,format='(f6.4)')+' [ADU/eV]',/data x4=x res4 = (y[n4]) - (fit[0]+(x*(fit[1]))) endif endif endif ;if(i eq 1)then begin ;----offset residuals-------------------------- if(i eq 1) then begin plot,x1,res1,psym=4,ymargin=[0,0],xrange=xr,yrange=[-25,25],$ xstyle=1,ystyle=1,ytitle='Node 1 Offset Residuals [ADU]',title=tt oplot,[-20000,20000],[0,0],linestyle=0 xyouts,0,15,'Std. Dev.= '+string(stddev(res1),format='(f4.2)')+' ADU' plot,x2,res2,psym=4,ymargin=[0,0],xrange=xr,yrange=[-25,25],$ xstyle=1,ystyle=1,ytitle='Node 2 Offset Residuals [ADU]' oplot,[-20000,20000],[0,0],linestyle=0 xyouts,0,15,'Std. Dev.= '+string(stddev(res2),format='(f4.2)')+' ADU' plot,x3,res3,psym=4,ymargin=[0,0],xrange=xr,yrange=[-25,25],$ xstyle=1,ystyle=1,ytitle='Node 3 Offset Residuals [ADU]' oplot,[-20000,20000],[0,0],linestyle=0 xyouts,0,15,'Std. Dev.= '+string(stddev(res3),format='(f4.2)')+' ADU' plot,x4,res4,psym=4,ymargin=[3,0],xrange=xr,yrange=[-25,25],$ xstyle=1,ystyle=1,ytitle='Node 4 Offset Residuals [ADU]',$ xtitle='Line energy [eV]' oplot,[-20000,20000],[0,0],linestyle=0 xyouts,0,15,'Std. Dev.= '+string(stddev(res4),format='(f4.2)')+' ADU' endif ;----FWHM-------------------------------------- if(i eq 2)then begin ccd=where((chip eq j)and(fwhm ne 666)) t=type[ccd] & n=node[ccd] & l_e=line_e[ccd] y=fwhm[ccd] ccd0=where((chip0 eq j)and(fwhm0 ne 666)) t0=type0[ccd0] & n0=node0[ccd0] & l_e0=line_e0[ccd0] y0=fwhm0[ccd0] xr=[-500,10500] yr=[0,350] n1=where(n eq 1) & n2=where(n eq 2) n3=where(n eq 3) & n4=where(n eq 4) n10=where(n0 eq 1) & n20=where(n0 eq 2) n30=where(n0 eq 3) & n40=where(n0 eq 4) plot,l_e[n1],y[n1]/gain1,psym=4,$ ymargin=[0,0],xrange=xr,yrange=yr,$ xstyle=1,ystyle=1,ytitle='Node 1 FWHM [eV]',title=tt oplot,l_e0[n1],y0[n1]/gain1,psym=1 plot,l_e[n2],y[n2]/gain2,psym=4,$ ymargin=[0,0],xrange=xr,yrange=yr,$ xstyle=1,ystyle=1,ytitle='Node 2 FWHM [eV]' oplot,l_e0[n2],y0[n2]/gain2,psym=1 if(n3[0] ne -1)then begin plot,l_e[n3],y[n3]/gain3,psym=4,$ ymargin=[0,0],xrange=xr,yrange=yr,$ xstyle=1,ystyle=1,ytitle='Node 3 FWHM [eV]' oplot,l_e0[n3],y0[n3]/gain3,psym=1 plot,l_e[n4],y[n4]/gain4,psym=4,$ ymargin=[3,0],xrange=xr,yrange=yr,$ xstyle=1,ystyle=1,ytitle='Node 4 FWHM [eV]',$ xtitle='Line energy [eV]' oplot,l_e0[n4],y0[n4]/gain4,psym=1 endif endif ;if(i eq 2)then begin endfor ;for i=1,2 do begin endfor ;for j=6,7 do begin end