Core Modules
This page describes the core modules that users are likely to interface most frequently.
The two classes Source
and ALP
are helper classes
which store information about the assumed astrophysical source (like its redshift) and about the assumed
ALP, in particular its mass and its coupling to photons.
For instance, a source is initialized in this way, providing the redshift and the sky coordinates:
src = Source(z=0.859, ra='22h53m57.7s', dec='+16d08m54s')
The ALP
class is initialized by simply providing values for the ALP mass
(in nano electron volts, \(\mathrm{neV}\equiv 10^{-9}\,\mathrm{eV}\)) and the coupling to photons,
\(g_{a\gamma}\) in units of \(10^{-11}\,\mathrm{GeV}^{-1}\).
from gammaALPs.core import ALP
alp = ALP(m = 1., g = 1.)
print (alp.m, alp.g)
With the initialized Source
and ALP
classes, we can
now initialize the ModuleList
class. This class stores the astrophysical
environments in which we would like to calculate the photon-ALP propagation in the
modules()
property. This is essentially a list of environments with its
first entry being the environment closest to the source and the last entry the environment closest to the observer.
The ModuleList
is initialized like this:
from gammaALPs.core import ModuleList
ml = ModuleList(alp, src)
Environments are added with the add_propagation()
function and the overall
conversion probability is then calculated by running run()
.
Details on the available environments are available on the Implemented Astrophysical Environments page.
The usage of these core classes is further demonstrated in the Tutorials.
Reference / API
- class gammaALPs.core.Source(z, **kwargs)[source]
Bases:
object
Class that stores information about the source: redshift Sky coordinates: ra, dec, l,b As well as jet parameters: bulk Lorentz factor, observation and jet opening angle
- __init__(z, **kwargs)[source]
Initialize the source class
- Parameters:
z (float) – source redshift
ra (float or string) – Right Ascension compatible with
SkyCoord
objectdec (float or string) – Declination compatible with
SkyCoord
objectl (float) – Galactic longitude or None. If given, overwrites ra and dec
b (float) – Galactic latitude or None. If given, overwrites ra and dec
theta_obs (float) – Angle between l.o.s. and jet axis in degrees (default: 3.)
bLorentz (float) – bulk lorentz factor of gamma-ray emitting plasma (default: 10.)
theta_jet (float) – Jet opening angle in degrees. Default: 1/bLorentz
- property b
- property bLorentz
- property c
- property c_gal
- property dec
- property l
- property ra
- property theta_jet
- property theta_obs
- property z
- class gammaALPs.core.ALP(m, g)[source]
Bases:
object
Class to store the ALP parameters
- property g
- property m
- class gammaALPs.core.ModuleList(alp, source, pin=None, EGeV=None, seed=None, log_level='info')[source]
Bases:
object
Class that collects all environments for photon-ALP mixing and manages common parameters such as photon-ALP coupling, the ALP mass, the source, and the energies at which the photon-ALP oscillation is computed.
- property EGeV
- __init__(alp, source, pin=None, EGeV=None, seed=None, log_level='info')[source]
Initialize the class, energy range, and polarization matrices
- Parameters:
alp (
ALP
) –ALP
object with ALP parameterssource (
Source
) –Source
object with source parameterspin (array-like) – 3x3 dim matrix with initial polarization. Default: un-polarized photon beam
EGeV (array-like) – n-dim numpy array with gamma-ray energies in GeV Default: log-spaced array between 1 GeV and 10 TeV
seed (int, optional) – Seed for RandomState for numpy random numbers. Must be convertible to 32 bit unsigned integers.
log_level (str) – level for logging, either ‘debug’, ‘info’, ‘warning’ or ‘error’
- add_disp_abs(EGeV, r_kpc, disp, module_id, type_matrix='dispersion', **kwargs)[source]
Add dispersion, absorption, or extra momentum difference term to a propagation module using interpolation of of a 2d dispersion / absorption matrix
- Parameters:
EGeV (array-like) – n-dim array with gamma-ray energies in GeV at which dispersion/absorption/momentum difference matrix is calculated
r_kpc (array-like) – m-dim array with distnaces in kpc at which dispersion/absorption/momentum difference matrix is calculated
disp (array-like) – n x m-dim array with dispersion (unitless) / absorption (in kpc^-1) / momentum difference (in kpc^-1)
module_id (int) – id of module to which dispersion / absorption /momentum difference is added
type_matrix (str) – either ‘dispersion’, ‘absorption’, or ‘Delta’, specifies type of matrix disp
- add_propagation(environ, order, **kwargs)[source]
Add a propagation environment to the module list
- Parameters:
Notes
kwargs are passed to the specific environment.
Available environments are the classes given in
environs
, where all the specific options are listed. The identifiers for the environments are:- IGMF: initializes
MixIGMFCell
for mixing in intergalactic magnetic field (IGMF) which is assumed to be of a cell-like structure
- IGMF: initializes
- ICMCell: initializes
MixICMCell
for mixing in intra-cluster medium which is assumed to be of a cell-like structure
- ICMCell: initializes
- ICMGaussTurb: initializes
MixICMGaussTurb
for mixing in intra-cluster medium which is assumed to follow a Gaussian turbulence spectrum
- ICMGaussTurb: initializes
- ICMStructured: initializes :py:class:`~gammaALPs.base.environs.MixICMStructured`for mixing
in intra-cluster medium which is assumed to be structured with radial, poloidal and toroidal components, see 1008.5353 and 1908.03084
- Jet: initializes
MixJet
for mixing in the AGN jet, where the field is assumed to be coherent
- Jet: initializes
- JetHelicalTangled: initializes
MixJetHelicalTangled
for mixing in the AGN jet with two field components (tangled and helical)
- JetHelicalTangled: initializes
- GMF: initializes
MixGMF
for mixing in the Galactic magnetic field (GMF) of the Milky Way
- GMF: initializes
- File: initializes
MixFromFile
for mixing in a magnetic field given by a data file
- File: initializes
- Array: initializes
MixFromArray
for mixing in a magnetic field given by a numpy arrays for B,psi,nel,r, and dL
- Array: initializes
- EBL: initializes
OptDepth
for EBL attenuation, i.e. no photon-ALP mixing in the intergalactic medium
- EBL: initializes
- property alp
- property modules
- property pa
- property pin
- property px
- property py
- run(multiprocess=1)[source]
Run the photon-ALP conversion probability calculation for all modules
- Parameters:
multiprocess (int) – number of cores to perform calculation; only used when random B field is requested by one of the modules and number of realizations is > 1
- Returns:
Px, Py, Pa – N x M dim. arrays with final photon and ALP states (Px, Py, Pa). Each P_i is of dimension (number of realizations x number of energy bins). Flat arrays are returned when number of realizations = 1.
- Return type:
tuple with
numpy.ndarray
- property seed
- property source