;+
;
; NAME:
; 		F_THERM_DEM_POW
;
; PURPOSE:
; This function returns the differential photon spectrum at the Earth, d(Flux)(eph)/dt,
; from plasma with temperature t.
; The differential emission measure has a power-law dependence on temperature.
; This is the integrand for the numerical integration in F_MULTI_THERM_POW.
;
; CATEGORY:
;       SPECTRA, XRAYS
;
; CALLING SEQUENCE:
;       Flux = F_THERM_DEM_POW(eph, t, emission, alpha)
;
; CALLED BY: f_multi_therm_pow
;
; CALLS:
;       f_vth.pro
;
; INPUTS:
;       eph -      array of photon energies or energy bands in keV
;       t -        temperature in keV
;       emission - differential emission measure (DEM) at t = 2 keV
;       alpha -    power-law index for computation of DEM(t) = a(0) * (2./t)^(alpha)
; KEYWORD INPUTS:
;       rel_abun - relative abundance (see f_vth)
;
;
; WRITTEN: Linhui Sui, 2003/08/28
;
; REVISED: Gordon Holman, 2003/09/04, Expanded documentation.
; 10-Mar-2006, Kim Tolbert.  Added _extra keyword so chianti/mewe and cont/lines keyword
;   will get passed into f_vth
; 24-mar-2006, richard.schwartz@gsfc.nasa.gov, revised
;   to take advantage of new vector temperature feature
;   of F_vth
; 19-Apr-2006, Kim.  call f_vth with t in multi_temp keyword, and with rel_abun keyword
;
;-


function f_therm_dem_pow, eph, t, emission, alpha, $
   rel_abun=rel_abun, _extra=_extra

; The t dimension is array of [eph_dim, t_dim]

flux = f_vth(eph, [emission, 0., rel_abun[1,0]], $
   multi_temp=reform(t[0,*]), _extra=_extra) * (2.0/t)^(alpha)

;tsize = size(t)
;flux = fltarr(tsize[1], tsize[2])

;for i = 0,  tsize[2] - 1 do begin
;	para = [emission, t[0,i]]
;	flux[*, i] = f_vth(eph, para, _extra=_extra) * (2.0/t[0, i])^(alpha)
;endfor

return, flux

end
