Models

API

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
n0Quantity float

Total ion number density.

Other Parameters
weight_eefloat

Weight of electron-electron bremsstrahlung. Defined as \(\sum_i Z_i X_i\), default is 1.088.

weight_epfloat

Weight of electron-proton bremsstrahlung. Defined as \(\sum_i Z_i^2 X_i\), default is 1.263.

property We

Total energy in electrons used for the radiative calculation

compute_We(Eemin=None, Eemax=None)

Total energy in electrons between energies Eemin and Eemax

Parameters
EeminQuantity float, optional

Minimum electron energy for energy content calculation.

EemaxQuantity float, optional

Maximum electron energy for energy content calculation.

flux(energy, *args, **kwargs)

Differential flux at a given distance from the source.

Parameters
photon_energyQuantity float or array

Photon energy array.

distanceQuantity float, optional

Distance to the source. If set to 0, the intrinsic differential luminosity will be returned. Default is 1 kpc.

sed(photon_energy, distance=<Quantity 1. kpc>)

Spectral energy distribution at a given distance from the source.

Parameters
photon_energyQuantity float or array

Photon energy array.

distanceQuantity float, optional

Distance to the source. If set to 0, the intrinsic luminosity will be returned. Default is 1 kpc.

set_We(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
WeQuantity float

Desired energy in electrons.

EeminQuantity float, optional

Minimum electron energy for energy content calculation.

EemaxQuantity float, optional

Maximum electron energy for energy content calculation.

amplitude_namestr, 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
amplitudefloat

Model amplitude at the break energy

e_0Quantity float

Reference point

e_breakQuantity float

Break energy

alpha_1float

Power law index for x < x_break

alpha_2float

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.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
redshiftfloat

Redshift considered for the absorption evaluation.

ebl_absorption_model{‘Dominguez’}

Name of the EBL absorption model to use (Dominguez by default).

See also

TableModel

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).

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
amplitudefloat

Model amplitude at the break point

e_0Quantity float

Reference point

e_breakQuantity float

Break energy

alpha_1float

Power law index for x < x_break

alpha_2float

Power law index for x > x_break

e_cutoffQuantity float

Exponential Cutoff energy

betafloat, 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.ExponentialCutoffPowerLaw(amplitude, e_0, alpha, e_cutoff, beta=1.0)[source]

One dimensional power law model with an exponential cutoff.

Parameters
amplitudefloat

Model amplitude

e_0Quantity float

Reference point

alphafloat

Power law index

e_cutoffQuantity float

Cutoff point

betafloat

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.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
particle_distributionfunction

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_fieldsstring 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:

    1. A name for the seed photon field.

    2. Its temperature (thermal source) or energy (monochromatic or non-thermal source) as a Quantity instance.

    3. Its photon field energy density as a Quantity instance.

    4. Optional: The angle between the seed photon direction and the scattered photon direction as a Quantity float instance.

Other Parameters
EeminQuantity float instance, optional

Minimum electron energy for the electron distribution. Default is 1 GeV.

EemaxQuantity float instance, optional

Maximum electron energy for the electron distribution. Default is 510 TeV.

nEedscalar

Number of points per decade in energy for the electron energy and distribution arrays. Default is 300.

property We

Total energy in electrons used for the radiative calculation

compute_We(Eemin=None, Eemax=None)

Total energy in electrons between energies Eemin and Eemax

Parameters
EeminQuantity float, optional

Minimum electron energy for energy content calculation.

EemaxQuantity float, optional

Maximum electron energy for energy content calculation.

flux(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_energyQuantity float or array

Photon energy array.

distanceQuantity float, optional

Distance to the source. If set to 0, the intrinsic luminosity will be returned. Default is 1 kpc.

seedint, 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(photon_energy, distance=<Quantity 1. kpc>, seed=None)[source]

Spectral energy distribution at a given distance from the source

Parameters
photon_energyQuantity float or array

Photon energy array.

distanceQuantity float, optional

Distance to the source. If set to 0, the intrinsic luminosity will be returned. Default is 1 kpc.

seedint, 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(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
WeQuantity float

Desired energy in electrons.

EeminQuantity float, optional

Minimum electron energy for energy content calculation.

EemaxQuantity float, optional

Maximum electron energy for energy content calculation.

amplitude_namestr, 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.LogParabola(amplitude, e_0, alpha, beta)[source]

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

Parameters
amplitudefloat

Model amplitude

e_0Quantity float

Reference point

alphafloat

Power law index

betafloat

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.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
particle_distributionfunction

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.

nhQuantity

Number density of the target protons. Default is \(1 \mathrm{cm}^{-3}\).

nuclear_enhancementbool

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.

Other Parameters
EpminQuantity float

Minimum proton energy for the proton distribution. Default is 1.22 GeV, the dynamical threshold for pion production in pp interactions.

EpmaxQuantity float

Minimum proton energy for the proton distribution. Default is 10 PeV.

nEpdscalar

Number of points per decade in energy for the proton energy and distribution arrays. Default is 100.

hiEmodelstr

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.

useLUTbool

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.

property Wp

Total energy in protons

compute_Wp(Epmin=None, Epmax=None)

Total energy in protons between energies Epmin and Epmax

Parameters
EpminQuantity float, optional

Minimum proton energy for energy content calculation.

EpmaxQuantity float, optional

Maximum proton energy for energy content calculation.

flux(energy, *args, **kwargs)

Differential flux at a given distance from the source.

Parameters
photon_energyQuantity float or array

Photon energy array.

distanceQuantity float, optional

Distance to the source. If set to 0, the intrinsic differential luminosity will be returned. Default is 1 kpc.

sed(photon_energy, distance=<Quantity 1. kpc>)

Spectral energy distribution at a given distance from the source.

Parameters
photon_energyQuantity float or array

Photon energy array.

distanceQuantity float, optional

Distance to the source. If set to 0, the intrinsic luminosity will be returned. Default is 1 kpc.

set_Wp(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
WpQuantity float

Desired energy in protons.

EpminQuantity float, optional

Minimum proton energy for energy content calculation.

EpmaxQuantity float, optional

Maximum proton energy for energy content calculation.

amplitude_namestr, 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.PowerLaw(amplitude, e_0, alpha)[source]

One dimensional power law model.

Parameters
amplitudefloat

Model amplitude.

e_0Quantity float

Reference energy

alphafloat

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.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
particle_distributionfunction

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.

BQuantity float instance, optional

Isotropic magnetic field strength. Default: equipartition with CMB (3.24e-6 G)

Other Parameters
EeminQuantity float instance, optional

Minimum electron energy for the electron distribution. Default is 1 GeV.

EemaxQuantity float instance, optional

Maximum electron energy for the electron distribution. Default is 510 TeV.

nEedscalar

Number of points per decade in energy for the electron energy and distribution arrays. Default is 100.

property We

Total energy in electrons used for the radiative calculation

compute_We(Eemin=None, Eemax=None)

Total energy in electrons between energies Eemin and Eemax

Parameters
EeminQuantity float, optional

Minimum electron energy for energy content calculation.

EemaxQuantity float, optional

Maximum electron energy for energy content calculation.

flux(energy, *args, **kwargs)

Differential flux at a given distance from the source.

Parameters
photon_energyQuantity float or array

Photon energy array.

distanceQuantity float, optional

Distance to the source. If set to 0, the intrinsic differential luminosity will be returned. Default is 1 kpc.

sed(photon_energy, distance=<Quantity 1. kpc>)

Spectral energy distribution at a given distance from the source.

Parameters
photon_energyQuantity float or array

Photon energy array.

distanceQuantity float, optional

Distance to the source. If set to 0, the intrinsic luminosity will be returned. Default is 1 kpc.

set_We(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
WeQuantity float

Desired energy in electrons.

EeminQuantity float, optional

Minimum electron energy for energy content calculation.

EemaxQuantity float, optional

Maximum electron energy for energy content calculation.

amplitude_namestr, 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.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
energyQuantity array

Array of energies at which the model values are given

valuesarray

Array with the values of the model at energies energy.

amplitudefloat

Model amplitude that is multiplied to the supplied arrays. Defaults to 1.