# Models¶

## API¶

class naima.models.Synchrotron(particle_distribution, B=<Quantity 3.24e-06 G>, **kwargs)[source]

Synchrotron emission from an electron population.

This class uses the approximation of the synchrotron emissivity in a random magnetic field of Aharonian, Kelner, and Prosekin 2010, PhysRev D 82, 3002 (arXiv:1006.1045).

Parameters: Other Parameters: particle_distribution : function Particle distribution function, taking electron energies as a Quantity array or float, and returning the particle energy density in units of number of electrons per unit energy as a Quantity array or float. B : Quantity float instance, optional Isotropic magnetic field strength. Default: equipartition with CMB (3.24e-6 G) Eemin : Quantity float instance, optional Minimum electron energy for the electron distribution. Default is 1 GeV. Eemax : Quantity float instance, optional Maximum electron energy for the electron distribution. Default is 510 TeV. nEed : scalar Number of points per decade in energy for the electron energy and distribution arrays. Default is 100.
We

Total energy in electrons used for the radiative calculation

compute_We(self, Eemin=None, Eemax=None)

Total energy in electrons between energies Eemin and Eemax

Parameters: Eemin : Quantity float, optional Minimum electron energy for energy content calculation. Eemax : Quantity float, optional Maximum electron energy for energy content calculation.
flux(cls, energy, *args, **kwargs)

Differential flux at a given distance from the source.

Parameters: photon_energy : Quantity float or array Photon energy array. distance : Quantity float, optional Distance to the source. If set to 0, the intrinsic differential luminosity will be returned. Default is 1 kpc.
sed(self, photon_energy, distance=<Quantity 1. kpc>)

Spectral energy distribution at a given distance from the source.

Parameters: photon_energy : Quantity float or array Photon energy array. distance : Quantity float, optional Distance to the source. If set to 0, the intrinsic luminosity will be returned. Default is 1 kpc.
set_We(self, We, Eemin=None, Eemax=None, amplitude_name=None)

Normalize particle distribution so that the total energy in electrons between Eemin and Eemax is We

Parameters: We : Quantity float Desired energy in electrons. Eemin : Quantity float, optional Minimum electron energy for energy content calculation. Eemax : Quantity float, optional Maximum electron energy for energy content calculation. amplitude_name : str, optional Name of the amplitude parameter of the particle distribution. It must be accesible as an attribute of the distribution function. Defaults to amplitude.
class naima.models.InverseCompton(particle_distribution, seed_photon_fields=['CMB'], **kwargs)[source]

Inverse Compton emission from an electron population.

If you use this class in your research, please consult and cite Khangulyan, D., Aharonian, F.A., & Kelner, S.R. 2014, Astrophysical Journal, 783, 100

Parameters: Other Parameters: particle_distribution : function Particle distribution function, taking electron energies as a Quantity array or float, and returning the particle energy density in units of number of electrons per unit energy as a Quantity array or float. seed_photon_fields : string or iterable of strings (optional) A list of gray-body or non-thermal seed photon fields to use for IC calculation. Each of the items of the iterable can be either: A string equal to CMB (default), NIR, or FIR, for which radiation fields with temperatures of 2.72 K, 30 K, and 3000 K, and energy densities of 0.261, 0.5, and 1 eV/cm³ will be used (these are the GALPROP values for a location at a distance of 6.5 kpc from the galactic center). A list of length three (isotropic source) or four (anisotropic source) composed of: A name for the seed photon field. Its temperature (thermal source) or energy (monochromatic or non-thermal source) as a Quantity instance. Its photon field energy density as a Quantity instance. Optional: The angle between the seed photon direction and the scattered photon direction as a Quantity float instance. Eemin : Quantity float instance, optional Minimum electron energy for the electron distribution. Default is 1 GeV. Eemax : Quantity float instance, optional Maximum electron energy for the electron distribution. Default is 510 TeV. nEed : scalar Number of points per decade in energy for the electron energy and distribution arrays. Default is 300.
We

Total energy in electrons used for the radiative calculation

compute_We(self, Eemin=None, Eemax=None)

Total energy in electrons between energies Eemin and Eemax

Parameters: Eemin : Quantity float, optional Minimum electron energy for energy content calculation. Eemax : Quantity float, optional Maximum electron energy for energy content calculation.
flux(self, photon_energy, distance=<Quantity 1. kpc>, seed=None)[source]

Differential flux at a given distance from the source from a single seed photon field

Parameters: photon_energy : Quantity float or array Photon energy array. distance : Quantity float, optional Distance to the source. If set to 0, the intrinsic luminosity will be returned. Default is 1 kpc. seed : int, str or None Number or name of seed photon field for which the IC contribution is required. If set to None it will return the sum of all contributions (default).
sed(self, photon_energy, distance=<Quantity 1. kpc>, seed=None)[source]

Spectral energy distribution at a given distance from the source

Parameters: photon_energy : Quantity float or array Photon energy array. distance : Quantity float, optional Distance to the source. If set to 0, the intrinsic luminosity will be returned. Default is 1 kpc. seed : int, str or None Number or name of seed photon field for which the IC contribution is required. If set to None it will return the sum of all contributions (default).
set_We(self, We, Eemin=None, Eemax=None, amplitude_name=None)

Normalize particle distribution so that the total energy in electrons between Eemin and Eemax is We

Parameters: We : Quantity float Desired energy in electrons. Eemin : Quantity float, optional Minimum electron energy for energy content calculation. Eemax : Quantity float, optional Maximum electron energy for energy content calculation. amplitude_name : str, optional Name of the amplitude parameter of the particle distribution. It must be accesible as an attribute of the distribution function. Defaults to amplitude.
class naima.models.PionDecay(particle_distribution, nh=<Quantity 1. 1 / cm3>, nuclear_enhancement=True, **kwargs)[source]

Pion decay gamma-ray emission from a proton population.

Compute gamma-ray spectrum arising from the interaction of a relativistic proton distribution with stationary target protons using the parametrization of Kafexhiu et al. (2014).

If you use this class in your research, please consult and cite Kafexhiu, E., Aharonian, F., Taylor, A.M., & Vila, G.S. 2014, Physical Review D, 90, 123014.

Parameters: Other Parameters: particle_distribution : function Particle distribution function, taking proton energies as a Quantity array or float, and returning the particle energy density in units of number of protons per unit energy as a Quantity array or float. nh : Quantity Number density of the target protons. Default is $$1 \mathrm{cm}^{-3}$$. nuclear_enhancement : bool Whether to apply the energy-dependent nuclear enhancement factor considering a target gas with local ISM abundances. See Section IV of Kafexhiu et al. (2014) for details. Here the proton-nucleus inelastic cross section of Sihver et al. (1993, PhysRevC 47, 1225) is used. Epmin : Quantity float Minimum proton energy for the proton distribution. Default is 1.22 GeV, the dynamical threshold for pion production in pp interactions. Epmax : Quantity float Minimum proton energy for the proton distribution. Default is 10 PeV. nEpd : scalar Number of points per decade in energy for the proton energy and distribution arrays. Default is 100. hiEmodel : str Monte Carlo model to use for computation of high-energy differential cross section. Can be one of Geant4, Pythia8, SIBYLL, or QGSJET. See Kafexhiu et al. (2014) for details. Default is Pythia8. useLUT : bool Whether to use a lookup table for the differential cross section. The only lookup table packaged with naima is for the Pythia 8 model and ISM nuclear enhancement factor.
Wp

Total energy in protons

compute_Wp(self, Epmin=None, Epmax=None)

Total energy in protons between energies Epmin and Epmax

Parameters: Epmin : Quantity float, optional Minimum proton energy for energy content calculation. Epmax : Quantity float, optional Maximum proton energy for energy content calculation.
flux(cls, energy, *args, **kwargs)

Differential flux at a given distance from the source.

Parameters: photon_energy : Quantity float or array Photon energy array. distance : Quantity float, optional Distance to the source. If set to 0, the intrinsic differential luminosity will be returned. Default is 1 kpc.
sed(self, photon_energy, distance=<Quantity 1. kpc>)

Spectral energy distribution at a given distance from the source.

Parameters: photon_energy : Quantity float or array Photon energy array. distance : Quantity float, optional Distance to the source. If set to 0, the intrinsic luminosity will be returned. Default is 1 kpc.
set_Wp(self, Wp, Epmin=None, Epmax=None, amplitude_name=None)

Normalize particle distribution so that the total energy in protons between Epmin and Epmax is Wp

Parameters: Wp : Quantity float Desired energy in protons. Epmin : Quantity float, optional Minimum proton energy for energy content calculation. Epmax : Quantity float, optional Maximum proton energy for energy content calculation. amplitude_name : str, optional Name of the amplitude parameter of the particle distribution. It must be accesible as an attribute of the distribution function. Defaults to amplitude.
class naima.models.Bremsstrahlung(particle_distribution, n0=<Quantity 1. 1 / cm3>, **kwargs)[source]

Bremsstrahlung radiation on a completely ionised gas.

This class uses the cross-section approximation of Baring, M.G., Ellison, D.C., Reynolds, S.P., Grenier, I.A., & Goret, P. 1999, Astrophysical Journal, 513, 311.

The default weights are assuming a completely ionised target gas with ISM abundances. If pure electron-electron bremsstrahlung is desired, n0 can be set to the electron density, weight_ep to 0 and weight_ee to 1.

Parameters: Other Parameters: n0 : Quantity float Total ion number density. weight_ee : float Weight of electron-electron bremsstrahlung. Defined as $$\sum_i Z_i X_i$$, default is 1.088. weight_ep : float Weight of electron-proton bremsstrahlung. Defined as $$\sum_i Z_i^2 X_i$$, default is 1.263.
We

Total energy in electrons used for the radiative calculation

compute_We(self, Eemin=None, Eemax=None)

Total energy in electrons between energies Eemin and Eemax

Parameters: Eemin : Quantity float, optional Minimum electron energy for energy content calculation. Eemax : Quantity float, optional Maximum electron energy for energy content calculation.
flux(cls, energy, *args, **kwargs)

Differential flux at a given distance from the source.

Parameters: photon_energy : Quantity float or array Photon energy array. distance : Quantity float, optional Distance to the source. If set to 0, the intrinsic differential luminosity will be returned. Default is 1 kpc.
sed(self, photon_energy, distance=<Quantity 1. kpc>)

Spectral energy distribution at a given distance from the source.

Parameters: photon_energy : Quantity float or array Photon energy array. distance : Quantity float, optional Distance to the source. If set to 0, the intrinsic luminosity will be returned. Default is 1 kpc.
set_We(self, We, Eemin=None, Eemax=None, amplitude_name=None)

Normalize particle distribution so that the total energy in electrons between Eemin and Eemax is We

Parameters: We : Quantity float Desired energy in electrons. Eemin : Quantity float, optional Minimum electron energy for energy content calculation. Eemax : Quantity float, optional Maximum electron energy for energy content calculation. amplitude_name : str, optional Name of the amplitude parameter of the particle distribution. It must be accesible as an attribute of the distribution function. Defaults to amplitude.
class naima.models.BrokenPowerLaw(amplitude, e_0, e_break, alpha_1, alpha_2)[source]

One dimensional power law model with a break.

Parameters: amplitude : float Model amplitude at the break energy e_0 : Quantity float Reference point e_break : Quantity float Break energy alpha_1 : float Power law index for x < x_break alpha_2 : float Power law index for x > x_break

Notes

Model formula (with $$A$$ for amplitude, $$E_0$$ for e_0, $$\alpha_1$$ for alpha_1 and $$\alpha_2$$ for alpha_2):

$\begin{split}f(E) = \left \{ \begin{array}{ll} A (E / E_0) ^ {-\alpha_1} & : E < E_{break} \\ A (E_{break}/E_0) ^ {\alpha_2-\alpha_1} (E / E_0) ^ {-\alpha_2} & : E > E_{break} \\ \end{array} \right.\end{split}$
static eval(e, amplitude, e_0, e_break, alpha_1, alpha_2)[source]

One dimensional broken power law model function

class naima.models.ExponentialCutoffPowerLaw(amplitude, e_0, alpha, e_cutoff, beta=1.0)[source]

One dimensional power law model with an exponential cutoff.

Parameters: amplitude : float Model amplitude e_0 : Quantity float Reference point alpha : float Power law index e_cutoff : Quantity float Cutoff point beta : float Cutoff exponent

Notes

Model formula (with $$A$$ for amplitude, $$\alpha$$ for alpha, and $$\beta$$ for beta):

$f(E) = A (E / E_0) ^ {-\alpha} \exp (- (E / E_{cutoff}) ^ \beta)$
static eval(e, amplitude, e_0, alpha, e_cutoff, beta)[source]

One dimensional power law with an exponential cutoff model function

class naima.models.PowerLaw(amplitude, e_0, alpha)[source]

One dimensional power law model.

Parameters: amplitude : float Model amplitude. e_0 : Quantity float Reference energy alpha : float Power law index

Notes

Model formula (with $$A$$ for amplitude, $$\alpha$$ for alpha):

$f(E) = A (E / E_0) ^ {-\alpha}$
static eval(e, amplitude, e_0, alpha)[source]

One dimensional power law model function

class naima.models.LogParabola(amplitude, e_0, alpha, beta)[source]

One dimensional log parabola model (sometimes called curved power law).

Parameters: amplitude : float Model amplitude e_0 : Quantity float Reference point alpha : float Power law index beta : float Power law curvature

Notes

Model formula (with $$A$$ for amplitude and $$\alpha$$ for alpha and $$\beta$$ for beta):

$f(e) = A \left(\frac{E}{E_{0}}\right)^ {- \alpha - \beta \log{\left (\frac{E}{E_{0}} \right )}}$
static eval(e, amplitude, e_0, alpha, beta)[source]

One dimenional log parabola model function

class naima.models.ExponentialCutoffBrokenPowerLaw(amplitude, e_0, e_break, alpha_1, alpha_2, e_cutoff, beta=1.0)[source]

One dimensional power law model with a break.

Parameters: amplitude : float Model amplitude at the break point e_0 : Quantity float Reference point e_break : Quantity float Break energy alpha_1 : float Power law index for x < x_break alpha_2 : float Power law index for x > x_break e_cutoff : Quantity float Exponential Cutoff energy beta : float, optional Exponential cutoff rapidity. Default is 1.

Notes

Model formula (with $$A$$ for amplitude, $$E_0$$ for e_0, $$\alpha_1$$ for alpha_1, $$\alpha_2$$ for alpha_2, $$E_{cutoff}$$ for e_cutoff, and $$\beta$$ for beta):

$\begin{split}f(E) = \exp(-(E / E_{cutoff})^\beta)\left \{ \begin{array}{ll} A (E / E_0) ^ {-\alpha_1} & : E < E_{break} \\ A (E_{break}/E_0) ^ {\alpha_2-\alpha_1} (E / E_0) ^ {-\alpha_2} & : E > E_{break} \\ \end{array} \right.\end{split}$
static eval(e, amplitude, e_0, e_break, alpha_1, alpha_2, e_cutoff, beta)[source]

One dimensional broken power law model function

class naima.models.TableModel(energy, values, amplitude=1)[source]

A model generated from a table of energy and value arrays.

The units returned will be the units of the values array provided at initialization. The model will return values interpolated in log-space, returning 0 for energies outside of the limits of the provided energy array.

Parameters: energy : Quantity array Array of energies at which the model values are given values : array Array with the values of the model at energies energy. amplitude : float Model amplitude that is multiplied to the supplied arrays. Defaults to 1.
class naima.models.EblAbsorptionModel(redshift, ebl_absorption_model='Dominguez')[source]

A TableModel containing the different absorption values from a specific model.

It returns dimensionless opacity values, that could be multiplied to any model.

Parameters: redshift : float Redshift considered for the absorption evaluation. ebl_absorption_model : {‘Dominguez’} Name of the EBL absorption model to use (Dominguez by default).

Notes

Dominguez model refers to the Dominguez 2011 EBL model. Current implementation does NOT perform an interpolation in the redshift, so it just uses the closest z value from the finely binned tau_dominguez11.npz file (delta_z=0.01).