pro icls_white_cal,in=in,out=out,lamp=lamp,plot=plot,rin=rin ;ORNL ICLS 12 inch USS calibration data from Labsphere ;calibration: 8/20/2010 ;Lamp 1 ;lamp current 8.007 A (13.569 V), CCT= 3000K ;radiometer current=8.57e-8 A ;luminace at calibration: 7590.40 ft-lamberts (26004.71 nit) ;wavelength in (nm) lam1=[300.,310.,320.,330.,340.,350.,400.,450.,500.,555.,600.,655.,700.,800.,900.,1050.,1150.,1200.,$ 1300.,1540.,1600.,1700.,2000.,2100.,2300.,2400.] ;spectral radiance in (mW/cm2-sr-microm) rad1=[2.86e-1,4.31e-1,6.29e-1,9.03e-1,1.24,1.67,5.51,1.19e1,2.09e1,3.21e1,4.15e1,5.23e1,6.10e1,$ 7.69e1,8.43e1,8.54e1,7.90e1,7.67e1,6.85e1,4.96e1,4.50e1,3.62e1,1.72e1,9.27,8.39,5.38] radiom1=8.57e-8 ;Lamp 2 ;lamp current 0.417 A (12.551 V), CCT= 2684K ;radiometer current=2.04e-9 A ;luminace at calibration: 180.18 ft-lamberts (617.30 nit) ;wavelength in (nm) lam2=[300.,310.,320.,330.,340.,350.,400.,450.,500.,555.,600.,655.,700.,800.,900.,1050.,1150.,1200.,$ 1300.,1540.,1600.,1700.,2000.,2100.,2300.,2400.] ;spectral radiance in (mW/cm2-sr-microm) rad2=[4.50e-4,5.91e-4,7.86e-4,8.80e-4,1.47e-3,3.28e-3,8.27e-2,2.23e-1,4.37e-1,7.53e-1,1.06,1.45,$ 1.79,2.57,3.08,3.49,3.38,3.37,3.10,2.39,2.21,1.78,8.56e-1,4.43e-1,3.96e-1,2.42e-1] radiom2=2.04e-9 ;Lamp 3 ;lamp current 7.960 A (13.542 V), CCT= 3000K ;radiometer current=8.32e-8 A ;luminace at calibration: 7357.60 ft-lamberts (25207.14 nit) ;wavelength in (nm) lam3=[300.,310.,320.,330.,340.,350.,400.,450.,500.,555.,600.,655.,700.,800.,900.,1050.,1150.,1200.,$ 1300.,1540.,1600.,1700.,2000.,2100.,2300.,2400.] ;spectral radiance in (mW/cm2-sr-microm) rad3=[2.80e-1,4.21e-1,6.16e-1,8.82e-1,1.21,1.63,5.40,1.17e1,2.05e1,3.15e1,4.08e1,5.13e1,5.98e1,$ 7.56e1,8.29e1,8.39e1,7.77e1,7.53e1,6.73e1,4.90e1,4.45e1,3.54e1,1.69e1,8.99,7.96,5.08] radiom3=8.32e-8 ;Lamp 4 ;lamp current 0.417 A (12.682 V), CCT= 2692K ;radiometer current=2.14e-9 A ;luminace at calibration: 189.59 ft-lamberts (649.54 nit) ;wavelength in (nm) lam4=[300.,310.,320.,330.,340.,350.,400.,450.,500.,555.,600.,655.,700.,800.,900.,1050.,1150.,1200.,$ 1300.,1540.,1600.,1700.,2000.,2100.,2300.,2400.] ;spectral radiance in (mW/cm2-sr-microm) rad4=[6.51e-4,7.38e-4,7.96e-4,9.26e-4,1.29e-3,3.38e-3,8.92e-2,2.38e-1,4.63e-1,7.96e-1,1.12,1.52,$ 1.88,2.69,3.21,3.61,3.52,3.48,3.22,2.47,2.28,1.84,8.78e-1,4.78e-1,4.41e-1,2.88e-1] radiom4=2.14e-9 ;fractional uncertainty in percent for wavelengths (nm) wl=[350.,654.6,900.,1300.,1600.,2000.,2400.] fup=[2.0,1.7,1.7,2.1,2.1,2.4,3.6] fup=fup/100. ;convert to fraction if n_elements(lamp) eq 0 then lamp=1 if lamp eq 1 then begin lam=lam1 rad=rad1 radiom=radiom1 endif if lamp eq 2 then begin lam=lam2 rad=rad2 radiom=radiom2 endif if lamp eq 3 then begin lam=lam3 rad=rad3 radiom=radiom3 endif if lamp eq 4 then begin lam=lam4 rad=rad4 radiom=radiom4 endif ;spline fractional uncertainties onto data for error bars y2=spl_init(wl,fup) temp=spl_interp(wl,fup,y2,lam) fup=temp erad=rad*fup ;if radiometer value specified, scale calibration curves ;1.131e-11 A/ftLam (+/- 0.003e-11), 3.302e-12 Amp/nit (+/- 0.008e-12) ;radiometer has ~0.265% error if n_elements(rin) ne 0 then begin print,'!!!!!!!!!!!!! I hope you entered raiometer values in Amperes !!!!!!!!!!!!!' rad=rad*rin/radiom erad=sqrt((erad*rin/radiom)^2+(rad*0.00265/radiom)^2+(rad/radiom^2*rin*0.00265)^2) endif threshold=1.00e-4 ;the threshold for validity of the above data (guessed at for now) ;determine the range over which the data are valid valid=intarr(n_elements(lam)) w_valid=where(rad gt threshold) valid[w_valid]=valid[w_valid]+1 E_photon=1.984e-16/lam ;energy per photon in (J) for lam in (nm) E_photon=E_photon*1000. ;energy in (mJ) per photon flux=rad/E_photon ;fluence (photons/s-cm2-sr-microm) eflux=flux*fup ;ideal blackbody spectrum h=6.626e-34 ;Planck's constant in (J-s) k=1.381e-23 ;Boltzman's constant in (J/K) c=2.998e8 ;speed of light in (m/s) c1=2.*h*c/(1.e-9)^3 c2=h*c/k/1.e-9 ;y=c1/lam^3/(exp(c2/lam)-1.) ;blackbody spectrum in (W/m2-sr-m) for lam in (nm) if keyword_set(plot) then begin !p.multi=[0,1,2] erplot,lam,rad,erad,psym=-3,xtitle='wavelength (nm)',ytitle='spectral radiance (mW/cm2-sr-microm)' erplot,lam,flux,eflux,psym=-3,xtitle='wavelength (nm)',ytitle='photon rate (photons/s-cm2-sr-microm)' endif ;use "in" to input an array of wavelengths (in nm) to spline the calibration data onto if n_elements(in) ne 0 then begin lami=in y2=spl_init(lam,rad) temp=spl_interp(lam,rad,y2,lami) radi=temp y2=spl_init(lam,flux) temp=spl_interp(lam,flux,y2,lami) fluxi=temp y2=spl_init(lam,fup) temp=spl_interp(lam,fup,y2,lami) fupi=temp eradi=radi*fupi efluxi=fluxi*fupi if keyword_set(plot) then oerplot,lami,fluxi,efluxi,psym=-3,color=2 lam=lami rad=radi flux=fluxi erad=eradi eflux=efluxi valid=intarr(n_elements(lam)) w_valid=where(rad gt threshold) valid[w_valid]=valid[w_valid]+1 endif out={lam:lam,rad:rad,erad:erad,flux:flux,eflux:eflux,valid:valid,radiom:radiom} !p.multi=0 ;stop end