;+ ; NAME: ; Ai_vth_bpow ; PURPOSE: ; the inital values of a for the thermal + double P.L.. ; CALLING SEQUENCE: ; a=Ai_vth_bpow(fy,sfy,e) ; INPUT: ; fy=Log(Photon Flux), ; sfy=Unc. in fy squared, ; e=log(channel energies), ; OUTPUT: ; a=initial values for a, the fit parameters ; HISTORY: ; 16-nov-95, from ai_thppl.pro, jmm ;- FUNCTION Ai_vth_bpow, fy, sfy, e @function_com ;this is needed for epivot, where a(0) is defined as the flux at epivot, nch = N_ELEMENTS(e) lfit_3, fy, sfy, e, nch, ax, fx ;fit fy to a triple power law ;ax=[log(k1),-gm1,log(k2),-gm2,log(k3),-gm3] ;get the broken PL part ebr = (ax(4)-ax(2))/(-ax(5)+ax(3)) ;the break energy ebr = 10.0^ebr IF(epivot LE ebr) THEN a0 = ax(2)+ax(3)*alog10(epivot) $ ELSE a0 = ax(4)+ax(5)*alog10(epivot) apar_hi = [10.0^a0, -ax(3), ebr, -ax(5)] ;the upper double p.l. e10 = 10.0^e ;get the thermal fit... IF (ax(3) LT ax(1)) THEN BEGIN ;ca'nt do this kind of fit message, /info, 'No low energy excess in AI_VTH_BPOW' print, ' We recommend a non-thermal fit...' a = [1.0, 10.0, ai_bpow(fy, sfy, e)] ENDIF ELSE BEGIN fhi = f_bpow(e10, apar_hi) ;high energy part f = (10.0^fy)-fhi ;the low energy excess n = 0 WHILE (f(n) GT 0.0) DO n = n+1 nh = n-1 subs = indgen(n) IF (n GT 1) THEN BEGIN ;now fit the low energy excess elo = e(subs) ;to the thermal fn flo = alog10(f(subs)) slo = sfy(subs) ax1 = ai_thermal(flo, slo, elo, n) ;guess the thermal fit a = [ax1, apar_hi] ;a=[e49, t6,k1,gamma1,ebr,gamma2] ENDIF ELSE a = [1.0, 10.0, apar_hi] ENDELSE RETURN, a END