; Local_gain_corr.pro Corrects for Local Gain Depression ; Klaus Wilhelm 03 February 1997 ; Rev. 16 August 2005 **** ; Modified to account for very high counting rates, which are, in most cases, ; caused by detector effects and therefore unphysical. Since there are only ; correction data available up to 300 counts per pixel and second, the ; modification just limits the counting rate to this value. A warning will ; be issued and a detailed check has to be performed by the user. ; Apply deadtime correction first! (See deadtime_corr.pro) pro local_gain_corr,detector,output,input ; output (vectors or arrays): detector measurements in counts/pixel/s ; detector: 'A' or 'B' if max(output) gt 300 then begin ; **** output=output<300 ; **** print,$ **** 'WARNING: some counting rates larger than 300 counts per pixel and second.' endif ; **** d1=0 d2=0 output_size=size(output) if output_size(0) eq 1 then d1=output_size(1) if output_size(0) eq 2 then begin d1=output_size(1) d2=output_size(2) endif rate=[0.,0.1,0.3,1.,3.,10.,30.,100.,300.] if strupcase(strtrim(detector,2)) eq 'A' then $ gain=[1.,1.,0.99,0.986,0.928,0.866,0.765,0.5,0.123] else $ gain=[1.,1.,0.99,0.986,0.928,0.866,0.765,0.5,0.123] ; Detector B data not yet available. Quicklook data show that there are only ; minor differences. Consequently, we use A values for B until updated data ; will be available. if d2 eq 0 then gain_intpol = interpol(gain,rate,output) else begin gain_intpol=fltarr(d1,d2) for i=0,d2-1 do gain_intpol(0,i) = interpol(gain,rate,output(*,i)) endelse input=output/gain_intpol return end