;+ ; Contains the cal function ; ; :Author: ; Philippe Zarka ; ; :History: ; 2005/12/14: Created ; ; 2005/12/14: Last Edit ;- ; ;+ ; Conversion de [tableaux de] couples (agc,auto) ou (agc,cross) en valeurs ; physiques (dB / Volts.Hz^-1/2) ; ; :Uses: ; agc_db, auto_db ; ; :Params: ; agc: in, required, type=float/floatarr ; A parameter named agc ; auto: in, required, type=float/floatarr ; 0-4 (A,B,C,H1,H2) ; bande: in, required, type=byte ; A parameter named ff ; ant: in, required, type=byte ; 0-3 (+X,-X,D,Z) ; freq: in, required, type=int/long/double/float ; frequence (kHz), H1 & H2 seulement; =0 pour ABC ; nfilters: in, required, type=byte ; 1,2,4,8,16,32 (filtres/bande) ; filter: in, required, type=byte ; 1-32 (# du filtre dans la bande) ; ; :Returns: ; <return desc here> ;- Function CAL, agc, auto, bande, ant, freq, nfilters, filter ;, att ; att = 0-1 (Off,On) common KRONOSCAL, a1h1,a1h2,ai,dbcal_abc,dbcal_h if n_elements(ai) eq 0 then restore,getenv('ROOT_RPWS')+'/bin/constants.xdr' ncal=n_elements(agc) if n_elements(att) eq 0 then att=intarr(ncal) a123=fltarr(3,ncal) iant=byte(ant/3) for i=0L,ncal-1L do a123(*,i)=ai(*,iant(i),bande(i),att(i)) ifreq=freq test=where(bande eq 3) if test(0) ne -1 then begin testfreq=where(bande eq 3 and ifreq gt 4300) if testfreq(0) ne -1 then ifreq(testfreq)=4300 ntest=n_elements(test) for i=0L,ntest-1L do a123(0,test(i))= $ a1h1(ant(test(i)),fix(ifreq(test(i))/25),att(test(i))) endif test=where(bande eq 4) if test(0) ne -1 then begin testfreq=where(bande eq 4 and ifreq gt 16075) if testfreq(0) ne -1 then ifreq(testfreq)=16075 ntest=n_elements(test) for i=0L,ntest-1L do a123(0,test(i))= $ a1h2(ant(test(i)),fix((ifreq(test(i))-25)/50),att(test(i))) endif dBcal=fltarr(ncal) test=where(bande le 2) ntest=n_elements(test) if test(0) ne -1 then for i=0L,ntest-1L do dBcal(test(i))= $ dBcal_abc(filter(test(i)),ant(test(i)),bande(test(i)), $ fix(alog(nfilters(test(i))*1.)/alog(2.)+0.5)-3) test=where(bande gt 2) ntest=n_elements(test) if test(0) ne -1 then for i=0L,ntest-1L do dBcal(test(i))= $ dBcal_h(filter(test(i)),iant(test(i)), $ fix(alog(nfilters(test(i))*1.)/alog(2.)+0.5)) dB=fltarr(ncal) test=where(agc ne 255) if test(0) ne -1 then $ dB(test)=AGC_dB(agc(test),a123(0,test),a123(1,test),a123(2,test)) test=where(auto ne 255) if test(0) ne -1 then $ dB(test)=dB(test)+AUTO_dB(auto(test))-dBcal(test) test=where((agc ne 255 or auto ne 255) and ant ne 2) if test(0) ne -1 then dB(test)=dB(test)+3. ; +3 dB en monopole pour apparence summary plots return, dB ; dB = 0 si agc = auto = 0 end