def get_spectrum(self, kT):
"""
Get the thermal emission spectrum given a temperature *kT* in keV.
"""
tindex = np.searchsorted(self.Tvals, kT)-1
if tindex >= self.Tvals.shape[0]-1 or tindex < 0:
return (YTArray(np.zeros(self.nchan), "cm**3/s"),)*2
dT = (kT-self.Tvals[tindex])/self.dTvals[tindex]
cspec_l = self.cosmic_spec[tindex, :]
mspec_l = self.metal_spec[tindex, :]
cspec_r = self.cosmic_spec[tindex+1, :]
mspec_r = self.metal_spec[tindex+1, :]
cosmic_spec = cspec_l*(1.-dT)+cspec_r*dT
metal_spec = mspec_l*(1.-dT)+mspec_r*dT
var_spec = None
if self.var_spec is not None:
vspec_l = self.var_spec[:, tindex, :]
vspec_r = self.var_spec[:, tindex+1, :]
var_spec = vspec_l*(1.-dT) + vspec_r*dT
return cosmic_spec, metal_spec, var_spec
评论列表
文章目录