def test_bb_sed_luminosity(self, T_dt): """test that the luminosity of the DT BB SED is the same as xi_dt * L_disk, create DTs with different temperatrues (and radii)""" xi_dt = 0.5 L_dt = xi_dt * L_disk_test dt = RingDustTorus(L_disk_test, xi_dt, T_dt) # compute the SEDs, assume a random redshift z = 0.23 nu = np.logspace(10, 20, 100) * u.Hz sed = dt.sed_flux(nu, z) # compute back the luminosity d_L = Distance(z=z).to("cm") F_nu = sed / nu L = 4 * np.pi * np.power(d_L, 2) * np.trapz(F_nu, nu, axis=0) assert u.isclose(L, L_dt, atol=0 * u.Unit("erg s-1"), rtol=1e-2)
# T_dt/=10 # L_disk/=100 blob1 = Blob(r0, z, delta_D, Gamma, B0, norm, spectrum_dict, xi=xi) dt1 = RingDustTorus(L_disk, xi_dt, T_dt, R_dt=R_dt) # energy density of DT radiation field in the blob u_dt1 = dt1.u_ph(h, blob1) u_synch1 = blob1.u_ph_synch print( "energy density in the blob, DT radiation: ", u_dt1, "synchrotron photons: ", u_synch1, ) dt1_sed = dt1.sed_flux(nu, z) # energy density was set to be the same synch1 = Synchrotron(blob1, ssa=False) synch1_sed = synch1.sed_flux(nu) ssc1 = SynchrotronSelfCompton(blob1, synch1) ssc1_sed = ssc1.sed_flux(nu) ec_dt1 = ExternalCompton(blob1, dt1, h) ec_dt1_sed = ec_dt1.sed_flux(nu) ssc1_total = (np.trapz(ssc1_sed / nu, nu)).to("erg cm-2 s-1") ec_dt1_total = (np.trapz(ec_dt1_sed / nu, nu)).to("erg cm-2 s-1") print("SSC total=", ssc1_total, ", EC DT total=", ec_dt1_total) # similar density of radiation but there is a factor of ~1.4 difference in the integrated flux