zblz/naima

problem with Inverse Compton in Klein-Nishina regime

nuk34 opened this issue · 2 comments

nuk34 commented

Hello,
Thanks lot for this great tool. I am playing around with Inverse Compton emission in the Klein-Nishina regime. When plotting the spectrum I noticed a lot of wiggles at higher energies (see IC_KleinNIshina.pdf). Is there something that can be done? Thanks a lot.
Here is my example code:

PL = naima.models.PowerLaw(1e+25 / units.eV, 1 * units.TeV, 1.8)
Tstar = 39400 * units.K
u_rad = 376 * units.erg / units.cm**3
spectrum_energy = numpy.logspace(-1, 2, 1000) * units.TeV
IC = naima.models.InverseCompton(PL, seed_photon_fields=[['star photons', Tstar, u_rad]])
sed = IC.sed(spectrum_energy, distance=50 * units.kpc)
plt.figure()
plt.loglog(spectrum_energy, sed)
plt.xlabel('photon energy [TeV]')
zblz commented

This is a side-effect of the numerical computation method used and the quasi-monochromatic emission spectrum in the deep Klein-Nishina regime. It can be fixed by increasing the number of electron distribution points sampled per energy decade with the parameter nEed of InverseCompton, even though it will make the computation slower. There is a bit more info in #142.

A mention of this should probably be added to the docs.

nuk34 commented

Hi @zblz ,
Thanks a lot. nEed = 1000 gives perfect results at still reasonable computing time. (I should have searched a bit more in the forum to find the trick...)
All the best,
Nukri