Basics
Basics¶
This notebook is designed to document some simple examples of ALP propagation problems to show how to use ALPRO. We’ll also take a look at some of the classes used, and what needs to be initialised. In the other tutorials, there are more details on setting up your own models.
[1]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import alpro
alpro.util.set_default_plot_params()
The top-level class that is used to interface with photon ALP conversion calculations is the “Survival” class. Any model is initialised through a call like this:
[2]:
s = alpro.Survival()
The ALP parameters are set using the set_params method
[3]:
s.set_params(g = 1e-13 * 1e-9, mass = 1e-13, invgev = False)
We can print out what is contained in the survival class at this stage.
[4]:
for k,v in vars(s).items():
print ("{:20s} {}".format(k,v))
model None
coherence_func None
available_models ['1821', '1275a', '1275b', 'custom', 'file', 'uniform', 'libanov', None]
get_P CPUDispatcher(<function get_P at 0x134b4d7a0>)
pol_matrix_bool False
g_a 1e-22
mass 1e-13
At this stage, we haven’t really initialised anything in the model, and we minimally need a correctly set up domain class which stores the magentic field and density profile used as input to the ALP calculation. A simple way of getting this set up is to use one of the inbuild models, which you can see using the following command. We can pick one of those and see that the domain is now populated.
[5]:
s.show_available_models()
['1821', '1275a', '1275b', 'custom', 'file', 'uniform', 'libanov', None]
[6]:
s = alpro.Survival("uniform")
s.setup_regular_model(B = 1e-5, L = 10.0, ne = 0.0, N = 1, phi = 0.0)
for k,v in vars(s.domain).items():
print ("{:20s} {}".format(k,v))
profile None
beta 100
coherence_r0 None
Bz 1.0
r [0.]
deltaL [10.]
rcen [5.]
ne [0.]
phi [0.]
B [1.e-05]
The variable \(\varphi\) is the angle made between the magnetic field vector and the \(y\)-axis. This model therefore is a single cell model with a \(10\mu\)G magnetic field aligned with the \(y\)-axis, with a \(10\),kpc domain size. We can now compute the conversion probability and compare with the analytic formula.
[7]:
s.set_params(g = 1e-12 * 1e-9, mass = 1e-11) # set up ALP parameters in eV^-1 and eV
energies = np.logspace(3,4,1000) # energies in eV
s.propagate(energies=energies, pol="y") # propagate the photon-ALP beam
fig = s.default_plot(theory = s.analytic_pga) # this will compare to the analytic formula
plt.semilogy()
[7]:
[]
We can re-initialise different ALP parameters and rerun – let’s try something with a larger \(g\).
[8]:
s.set_params(g = 1e-10 * 1e-9, mass = 1e-11) # set up ALP parameters in eV^-1 and eV
s.propagate(energies=energies, pol="y") # propagate the photon-ALP beam
fig = s.default_plot(theory = s.analytic_pga) # this will compare to the analytic formula
plt.semilogy()
[8]:
[]
We can also modify the magnetic field and rerun
[9]:
s.set_params(g = 1e-10 * 1e-9, mass = 1e-11) # set up ALP parameters in eV^-1 and eV
s.domain.B *= 0.01 # make the field 100x weaker
s.propagate(energies=energies, pol="y") # propagate the photon-ALP beam
fig = s.default_plot(theory = s.analytic_pga) # this will compare to the analytic formula
plt.semilogy()
[9]:
[]
You get the idea!