np.power(blob.d_L, 2) * np.power(r, 2) * np.power(target.epsilon_0, 2)) sed = prefactor_num / prefactor_denom * integral_gamma return sed.to("erg cm-2 s-1") # target and distance r = 1e16 * u.cm L_0 = 2e46 * u.Unit("erg s-1") epsilon_0 = 1e-3 ps = PointSourceBehindJet(L_0, epsilon_0) nu = np.logspace(20, 30) * u.Hz # increase the size of the gamma grid blob.set_gamma_size(500) sed_trapz = sed_flux_point_source(nu, blob, ps, r, np.trapz) sed_trapz_loglog = sed_flux_point_source(nu, blob, ps, r, trapz_loglog) plt.loglog(nu, sed_trapz, marker="o", label="np.trapz") plt.loglog(nu, sed_trapz_loglog, ls="--", marker=".", label="naima trapz_loglog") plt.legend() plt.show() # a test with external Compton on point like source print("-> test with EC on disk") # let us adopt the same disk parameters of Finke 2016 M_BH = 1.2 * 1e9 * M_sun.cgs
10, 1 * u.G, pwl_spectrum_norm_test, pwl_dict_test, ) # blob reproducing the EC scenarios in Finke 2016 bpwl_blob_test = Blob( 1e16 * u.cm, 1, 40, 40, 0.56 * u.G, bpwl_spectrum_norm_test, bpwl_dict_test, ) bpwl_blob_test.set_gamma_size(400) # global disk M_BH = 1.2 * 1e9 * M_sun.cgs L_disk = 2e46 * u.Unit("erg s-1") eta = 1 / 12 R_in = 6 R_out = 200 disk_test = SSDisk(M_BH, L_disk, eta, R_in, R_out, R_g_units=True) # global blr xi_line = 0.024 R_line = 1e17 * u.cm blr_test = SphericalShellBLR(L_disk, xi_line, "Lyalpha", R_line) # global dt T_dt = 1e3 * u.K csi_dt = 0.1 dt_test = RingDustTorus(L_disk, csi_dt, T_dt)
"p1": 2.0, "p2": 3.5, "gamma_b": 1e4, "gamma_min": 20, "gamma_max": 5e7, }, } R_B_BPL = 1e16 * u.cm B_BPL = 0.56 * u.G Z_BPL = 1 DELTA_D_BPL = 40 GAMMA_BPL = 40 BPL_BLOB = Blob( R_B_BPL, Z_BPL, DELTA_D_BPL, GAMMA_BPL, B_BPL, BPL_SPECTRUM_NORM, BPL_DICT ) BPL_BLOB.set_gamma_size(500) class TestSynchrotronSelfCompton: """class grouping all tests related to the Synchrotron Slef Compton class""" def test_ssc_reference_sed(self): """test agnpy SSC SED against the one in Figure 7.4 of Dermer Menon""" sampled_ssc_table = np.loadtxt( f"{tests_dir}/sampled_seds/ssc_figure_7_4_dermer_menon_2009.txt", delimiter=",", comments="#", ) sampled_ssc_nu = sampled_ssc_table[:, 0] * u.Hz sampled_ssc_sed = sampled_ssc_table[:, 1] * u.Unit("erg cm-2 s-1") # agnpy