Magnetic field models for the Milky Way
At the moment, two models of the coherent component of Galactic magnetic field are available. Typically, the coherence length of the turbulent component is too small to induce large scale photon-ALP oscillations at gamma-ray energies and hence only the coherent components are considered here.
The three models are the ones described in detail in [Pshirkov2011], [Jansson2012] and [Unger2024]. For the Jansson & Farrar model [Jansson2012], also the updates from measurements with the Planck satellite are available [Planck2016].
Reference / API
- class gammaALPs.bfields.gmf.GMF(model='jansson12')[source]
Bases:
objectClass with analytical functions that describe the galactic magnetic field according to the model of Jannson & Farrar (2012)
Only the regular field components are implemented. The striated field component is absent.
- hdisk
disk/halo transition height
- Type:
float hdisk_unc: float,
- bn, bn_unc
field strength northern halo
- Type:
Notes
see http://adsabs.harvard.edu/abs/2012ApJ…757…14J Jansson & Farrar (2012)
- BX(rho, z)[source]
X (out of plane) component of galactic magnetic field in galactocentric cylindrical coordinates (rho,phi,z)
BX is purely poloidal, i.e. phi component = 0
- Parameters:
rho (array-like) – N-dim array with distance from origin in GC cylindrical coordinates, is in kpc
z (array-like) – N-dim array with height in kpc in GC cylindrical coordinates
- Returns:
BX, BX_abs – tuple containing the magnetic field of the X component as a (3,N)-dim array with (rho,phi,z) components of disk field for each coordinate tuple and absolute value of the field as N-dim array
- Return type:
tuple of
ndarray
- Bdisk(rho, phi, z)[source]
Disk component of galactic magnetic field in galactocentric cylindrical coordinates (rho,phi,z)
- Parameters:
rho (array-like) – N-dim array with distance from origin in GC cylindrical coordinates, is in kpc
z (array-like) – N-dim array with height in kpc in GC cylindrical coordinates
phi (array-like) – N-dim array with polar angle in GC cylindircal coordinates, in radian
- Returns:
Bdisk, Bdisk_abs – tuple containing the magnetic field of the disk as a (3,N)-dim array with (rho,phi,z) components of disk field for each coordinate tuple and absolute value of the field as N-dim array
- Return type:
tuple of
ndarray
- Bhalo(rho, z)[source]
Halo component of galactic magnetic field in galactocentric cylindrical coordinates (rho,phi,z)
Bhalo is purely azimuthal (toroidal), i.e. has only a phi component
- Parameters:
rho (array-like) – N-dim array with distance from origin in GC cylindrical coordinates, is in kpc
z (array-like) – N-dim array with height in kpc in GC cylindrical coordinates
- Returns:
Bhalo, Bhalo_abs – tuple containing the magnetic field of the halo as a (3,N)-dim array with (rho,phi,z) components of disk field for each coordinate tuple and absolute value of the field as N-dim array
- Return type:
tuple of
ndarray
- __init__(model='jansson12')[source]
Init the GMF class, all B-field values are in muG
- Parameters:
model (str) – either jansson12, jansson12b, or jansson12c, where jansson12 is the original model and the other two options are the modifications of the model with Planck data, see http://arxiv.org/abs/1601.00546
- class gammaALPs.bfields.gmf.GMFPshirkov(model='ASS')[source]
Bases:
objectClass with analytical functions that describe the galactic magnetic field according to the model of Pshirkov et al. (2011)
Only the regular field components are implemented.
Notes
Paper: http://adsabs.harvard.edu/abs/2011ApJ…738..192P Pshirkov et al. (2011)
- Bdisk(rho, phi, z)[source]
Disk component of galactic magnetic field in galactocentric cylindrical coordinates (rho,phi,z)
- Parameters:
rho (array-like) – N-dim array with distance from origin in GC cylindrical coordinates, is in kpc
phi (array-like) – N-dim array with polar angle in GC cylindircal coordinates, in radian
z (array-like) – N-dim array with height in kpc in GC cylindrical coordinates
- Returns:
Bdisk, Bdisk_abs – tuple containing the magnetic field of the disk as a (3,N)-dim array with (rho,phi,z) components of disk field for each coordinate tuple and absolute value of the field as N-dim array
- Return type:
tuple of
ndarray
Notes
See Pshirkov et al. Eq. (3) - (5)
- Bhalo(rho, z)[source]
Halo component of galactic magnetic field in galactocentric cylindrical coordinates (rho,phi,z)
Bhalo is purely azimuthal (toroidal), i.e. has only a phi component
- Parameters:
rho (array-like) – N-dim array with distance from origin in GC cylindrical coordinates, is in kpc
z (array-like) – N-dim array with height in kpc in GC cylindrical coordinates
- Returns:
Bhalo, Bhalo_abs – tuple containing the magnetic field of the halo as a (3,N)-dim array with (rho,phi,z) components of disk field for each coordinate tuple and absolute value of the field as N-dim array
- Return type:
tuple of
ndarray
- class gammaALPs.bfields.gmf.UF23(model='base')[source]
Bases:
objectClass with analytical functions that describe the galactic magnetic field according to the model of Unger & Farrar (2023/2024)
2 components are implemented for the spiral field: The spur_field is only used in the ‘spur’ model. The other 7 models use the spiral_field.
3 components are implemented for the halo field: The twisted_halo_field is only used for the ‘twistX’ model. The other 7 models use the sum of poloidal_halo_field and toroidal_halo_field.
- r_ref
reference radius, for spiral field 5 kpc for spur field sun radius (8.2 kpc) (r_0)
- Type:
- disk_b1, disk_b2, disk_b3
magnetic field strength of mode 1, 2, 3 (B_m)
- Type:
floats
- disk_phase1, disk_phase2, disk_phase3
phase of mode 1, 2, 3 (phi_m)
- Type:
floats
Notes
see: Michael Unger and Glennys R. Farrar Astrophys.J. 970 (2024) 95 https://doi.org/10.3847/1538-4357/ad4a54 and https://doi.org/10.5281/zenodo.11321212
- Bdisk(rho, phi, z)[source]
Returns disk component of milky way magnetic field depending on model in galactocentric cylindrical coordinates (rho, phi, z)
- Parameters:
rho (array-like) – N-dim array with distance from origin in GC cylindrical coordinates, is in kpc
phi (array-like) – N-dim array with polar angle in GC cylindircal coordinates, in radian
z (array-like) – N-dim array with height in kpc in GC cylindrical coordinates
- Returns:
Bdisk, Bdisk_abs – tuple containing the magnetic field of the disk as a (3,N)-dim array with (rho,phi,z) components of disk field for each coordinate tuple and absolute value of the field as N-dim array
- Return type:
tuple of
ndarray
- Bhalo(rho, z)[source]
Returns halo component of milky way magnetic field depending on model in galactocentric cylindrical coordinates (rho, phi, z)
- Parameters:
rho (array-like) – N-dim array with distance from origin in GC cylindrical coordinates, is in kpc
z (array-like) – N-dim array with height in kpc in GC cylindrical coordinates
- Returns:
Bhalo, Bhalo_abs – tuple containing the magnetic field of the disk as a (3,N)-dim array with (rho,phi,z) components of disk field for each coordinate tuple and absolute value of the field as N-dim array
- Return type:
tuple of
ndarray
- __init__(model='base')[source]
Initialize the UF23 class for 8 different models
- Parameters:
model (str) – one of [‘base’, ‘expX’, ‘neCl’, ‘twistX’, ‘nebCor’, ‘cre10’, ‘synCG’, ‘spur’]
- poloidal_halo_field(rho, z)[source]
calculates poloidal halo field component (phi-component = 0) in galactocentric cylindrical coordinates (rho, phi, z)
- Parameters:
rho (array-like) – N-dim array with distance from origin in GC cylindrical coordinates, is in kpc
z (array-like) – N-dim array with height in kpc in GC cylindrical coordinates
- Returns:
b_cyl, b_cyl_abs – tuple containing the magnetic field of the disk as a (3,N)-dim array with (rho,phi,z) components of disk field for each coordinate tuple and absolute value of the field as N-dim array
- Return type:
tuple of
ndarray
Notes
See Unger & Farrar (2024) Section 5.3.2, p. 11
- spiral_field(rho, phi, z)[source]
calculates fourier-spiral disk component in galactocentric cylindrical coordinates (rho, phi, z)
- Parameters:
rho (array-like) – N-dim array with distance from origin in GC cylindrical coordinates, is in kpc
phi (array-like) – N-dim array with polar angle in GC cylindircal coordinates, in radian
z (array-like) – N-dim array with height in kpc in GC cylindrical coordinates
- Returns:
b_cyl, b_cyl_abs – tuple containing the magnetic field of the disk as a (3,N)-dim array with (rho,phi,z) components of disk field for each coordinate tuple and absolute value of the field as N-dim array
- Return type:
tuple of
ndarray
Notes
See Unger & Farrar (2024) Section 5.2.2, p. 9
- spur_field(rho, phi, z)[source]
calculates spiral-spur disk component in galactocentric cylindrical coordinates (rho, phi, z)
- Parameters:
rho (array-like) – N-dim array with distance from origin in GC cylindrical coordinates, is in kpc
phi (array-like) – N-dim array with polar angle in GC cylindircal coordinates, in radian
z (array-like) – N-dim array with height in kpc in GC cylindrical coordinates
- Returns:
b_cyl, b_cyl_abs – tuple containing the magnetic field of the disk as a (3,N)-dim array with (rho,phi,z) components of disk field for each coordinate tuple and absolute value of the field as N-dim array
- Return type:
tuple of
ndarray
Notes
See Unger & Farrar (2024) Section 5.2.3, p. 9
- toroidal_halo_field(rho, z)[source]
calculates toroidal halo field component (has only phi component) in galactocentric cylindrical coordinates (rho, phi, z)
- Parameters:
rho (array-like) – N-dim array with distance from origin in GC cylindrical coordinates, is in kpc
z (array-like) – N-dim array with height in kpc in GC cylindrical coordinates
- Returns:
b_cyl, b_cyl_abs – tuple containing the magnetic field of the disk as a (3,N)-dim array with (rho,phi,z) components of disk field for each coordinate tuple and absolute value of the field as N-dim array
- Return type:
tuple of
ndarray
Notes
See Unger & Farrar (2024) Section 5.3.1, p. 11
- twisted_halo_field(rho, z)[source]
calculates twisted halo field for twistX model with twisting time not 0 in galactocentric cylindrical coordinates (rho, phi, z)
- Parameters:
rho (array-like) – N-dim array with distance from origin in GC cylindrical coordinates, is in kpc
z (array-like) – N-dim array with height in kpc in GC cylindrical coordinates
- Returns:
b_cyl_x, b_cyl_x_abs – tuple containing the magnetic field of the disk as a (3,N)-dim array with (rho,phi,z) components of disk field for each coordinate tuple and absolute value of the field as N-dim array
- Return type:
tuple of
ndarray
Notes
See Unger & Farrar (2024) Section 5.3.3, p. 12
- gammaALPs.bfields.gmf.delta_phi(phi0, phi1)[source]
Calculates the angle between v0 = (cos(phi0), sin(phi0)) and v1 = (cos(phi1), sin(phi1)). Arguments: phi0 : float
First angle in radians
- phi1float
Second angle in radians
Returns: The angle between v0 and v1 in radians.