def find_gamma(energy, jnu, Z=1): """ Find the photoionization rate / 1e12 given the spectrum as a function of energy in Rydbergs. in units of photons / s. This is copying JFH's code in cldy_cuba_jfh.pro. """ sigma_nu = photo_cross_section_hydrogenic(energy, Z=Z) # output is in units of 1e-12 integrand = 4. * pi * jnu * sigma_nu / hplanck * 1e12 log_energy = np.log10(energy) isort = np.argsort(log_energy) # don't understand why this works... gamma = np.log(10) * simps(integrand[isort], x=log_energy[isort]) return gamma
sigma_nu = photo_cross_section_hydrogenic(energy, Z=Z) # output is in units of 1e-12 integrand = 4. * pi * jnu * sigma_nu / hplanck * 1e12 log_energy = np.log10(energy) isort = np.argsort(log_energy) # don't understand why this works... gamma = np.log(10) * simps(integrand[isort], x=log_energy[isort]) return gamma if 0: # They match, woot! iHeII = 2 E = 10**np.linspace(1, 5, 100) * u.eV s, Eth, Emax = sigma_Verner96(E, iHeII) s2 = photo_cross_section_hydrogenic(E.to(u.rydberg).value, Z=2) plt.loglog(E.value, s.value*1e18) plt.loglog(E.value, s2*1e18) show() if 1: # measure the photoionization rate, which is the integral of the # ionizing field * the cross section. # from McQuinn and Worseck 2014MNRAS.440.2406M # eta = 0.43 * gamma_HI / gamma_HeII # Faucher-Giguere 2009 gamma_HI = 0.861e-12 print 'gamma HeII'
# output is in units of 1e-12 integrand = 4. * pi * jnu * sigma_nu / hplanck * 1e12 log_energy = np.log10(energy) isort = np.argsort(log_energy) # don't understand why this works... gamma = np.log(10) * simps(integrand[isort], x=log_energy[isort]) return gamma if 0: # They match, woot! iHeII = 2 E = 10**np.linspace(1, 5, 100) * u.eV s, Eth, Emax = sigma_Verner96(E, iHeII) s2 = photo_cross_section_hydrogenic(E.to(u.rydberg).value, Z=2) plt.loglog(E.value, s.value * 1e18) plt.loglog(E.value, s2 * 1e18) show() if 1: # measure the photoionization rate, which is the integral of the # ionizing field * the cross section. # from McQuinn and Worseck 2014MNRAS.440.2406M # eta = 0.43 * gamma_HI / gamma_HeII # Faucher-Giguere 2009 gamma_HI = 0.861e-12 print 'gamma HeII'