NuOscProbExact
Code to compute exact two- and three-neutrino oscillation probabilities using SU(2) and SU(3) expansions
Install / Use
/learn @mbustama/NuOscProbExactREADME
NuOscProbExact
Code to compute exact two- and three-neutrino oscillation probabilities using SU(2) and SU(3) expansions
In the works: We are working on optimizing the code to run faster, using Cython
Contents
-
- Basics
- Trivial example
- Oscillations in vacuum: fixed energy and baseline
- Three-neutrino oscillations in vacuum: fixed energy, varying baseline
- Three-neutrino oscillations in vacuum: fixed baseline, varying energy
- Three-neutrino oscillations in matter
- Three-neutrino oscillations in matter with non-standard interactions (NSI)
- Three-neutrino oscillations in a Lorentz invariance-violating (LIV) background
- Arbitrary Hamiltonians
What is NuOscProbExact?
NuOscProbExact is a Python implementation of the method developed by Ohlsson & Snellman to compute exact two-flavor and three-flavor neutrino oscillation probabilities for arbitrary time-independent Hamiltonians. The method was revisited and the code presented in the paper NuOscProbExact: a general-purpose code to compute exact two-flavor and three-flavor neutrino oscillation probabilities (arXiv:1904.12391), by Mauricio Bustamante.
The method relies on expansions of the Hamiltonian and time-evolution operators in terms of SU(2) and SU(3) matrices in order to obtain concise, analytical, and exact expressions for the probabilities, that are also easy to implement and evaluate. For details of the method, see the paper above.
NuOscProbExact was developed by Mauricio Bustamante. If you use it in your work, please follow the directions on Citing.
Requirements
NuOscProbExact is fully written in Python 3. It uses standard modules that are available, sometimes by default, as part of most Python installations, either stand-alone or via Anaconda:
-
Bare minimum requirements: The two core modules (
oscprob2nu.pyandoscprob3nu.py) require onlynumpyandcmath. These are the bare minimum requirements. -
To use the bundled sample Hamiltonians: The modules containing example Hamiltonians (
hamiltonians2nu.pyandhamiltonians3nu.py) require onlynumpy,cmath, andcopy -
To run the test suite: The modules containing the test suites (
oscprob2nu_plot.py,oscprob3nu_plot.py,oscprob3nu_plotpaper.py, andrun_testsuite.py) require onlynumpy,cmath,copy, andmatplotlib
Installation
Because NuOscProbExact is written fully in Python, no compilation or linking is necessary. The installation is simple and consists only in fetching the files from GitHub.
Python 2 compatibility: The code was written and tested using Python 3. Yet, because the core modules
oscprob2nuandoscprob3nuuse only native Python functions and popular modules, they might also run in Python 2. However, this is currently untested.
Instructions:
-
In the file system where you would like to install NuOscProbExact, go to the directory where you would like the code to be downloaded, e.g.,
cd /home/MyProjects -
From there, fetch the code from the GitHub repository with
git clone https://github.com/mbustama/NuOscProbExact.git(Alternatively, you can download the zip file from GitHub and uncompress it.)
Doing this will create the directory
/home/MyProjects/NuOscProbExact, with the following file structure:/NuOscProbExact/README.md The file that you are reading /NuOscProbExact/run_testsuite.py Run this to execute all the examples and create test plots /NuOscProbExact/fig Contains plots generated by the test suite (initially empyty) /NuOscProbExact/img Contains two pre-computed plots displayed in README.md ../prob_3nu_vacuum_vs_baseline_ee_em_et.png ../prob_3nu_vacuum_vs_energy_ee_em_et.png /NuOscProbExact/src Contains the main source files ../hamiltonians2nu.py Routines to compute example two-flavor Hamiltonians ../hamiltonians3nu.py Routines to compute example three-flavor Hamiltonians ../globaldefs.py Physical constants and unit-conversion constants ../oscprob2nu.py Routines to compute the two-flavor probabilities ../oscprob3nu.py Routines to compute the three-flavor probabilities /NuOscProbExact/test Contains the source files to run the test suite ../example_2nu_trivial.py Two-flavor trivial example ../example_2nu_vacuum.py Two-flavor example for oscillations in vacuum ../example_2nu_vacuum_coeffs.py Two-flavor example for coefficients for oscillations in vacuum ../example_3nu_liv.py Three-flavor example for oscillations with LIV ../example_3nu_matter.py Three-flavor example for oscillations in matter ../example_3nu_nsi.py Three-flavor example for oscillations in matter with NSI ../example_3nu_trivial.py Three-flavor trivial example ../example_3nu_vacuum.py Three-flavor example for oscillations in vacuum ../example_3nu_vacuum_coeffs.py Three-flavor example for coefficients for oscillations in vacuum ../oscprob2nu_plot.py Routines to generate two-flavor probability test plots ../oscprob3nu_plot.py Routines to generate three-flavor probability test plots ../oscprob2nu_plotpaper.py Routine to generate the two-flavor plot shown in the paper ../oscprob3nu_plotpaper.py Routine to generate the three-flavor plot shown in the paperNow you are ready to start using NuOscProbExact.
-
(Optional, recommended) Run the examples Inside the directory
test/, we provide several example files to get you started. We also elaborate on these examples later in this README, and show the output thay you should expect from them. To run any of the examples, just execute, e.g.,python example_2nu_trivial.pyInspecting the example files and reading their description below will help you to learn how to use NuOscProbExact in your own project.
-
(Optional) Run the test suite
cd /home/MyProjects/NuOscProbExact python run_testsuite.pyDoing this will do the following:
- Generate plots of the two-neutrino and three-neutrino probabilities vs. distance and vs. energy, for different oscillation scenarios; and
- Generate the plots of two-neutrino and three-neutrino probabilities vs. energy that are included in the paper.
The plots are stored in the
fig/directory. The coderun_testsuite.pycalls routines defined inoscprob2nu_plot.py,oscprob3nu_plot.py,oscprob2nu_plotpaper.py, andoscprob3nu_plotpaper.py, located in theNuOscProbExact/test/directory. Inspecting these files may help you in coding your own project.
Usage and examples
There are only two core modules: oscprobn2nu.py and oscprob3nu.py. Each one is stand-alone (except for the dependencies described above). To use either module in your code, copy it to your project's working directory, or add their location to the paths where your environment looks for modules, e.g.,
import sys
sys.path.append('../src')
In the examples below, we focus mostly on oscprob3nu, but what we show applies to oscprob2nu as well.
Basics
Most of the time, you will be only interested in computing oscillation probabilities, not in the intermediate steps of the method. The functions to compute and return the probabilities are probabilities_3nu, for the three-neutrino case, and probabilities_2nu, for the two-neutrino case. Below, we show how to use them.
Three-neutrino oscillations
The function to compute three-neutrino probabilities is probabilities_3nu in the module oscprob3nu. It takes as input parameters the hamiltonian, in the form of a 3x3 Hermitian matrix, and the baseline L.
This function returns the list of probabilities Pee (nu_e --> nu_e), Pem (nu_e --> nu_mu), Pet (nu_e --> nu_tau), Pme (nu_mu --> nu_e), Pmm (nu_mu --> nu_mu), Pmt (nu_mu --> nu_tau), Pte (nu_tau --> nu_e), Ptm (nu_tau --> nu_mu), and Ptt (nu_tau --> nu_tau).
To use it, call
import oscprob3nu
hamiltonian = [[H11, H12, H13], [H21, H22, H23], [H31, H32, H33]]
Pee, Pem, Pet, Pme, Pmm, Pmt, Pte, Ptm, Ptt = oscprob3nu.probabilities_3nu(hamiltonian, L)
Two-neutrino oscillations
The function to compute two-neutrino probabilities is probabilities_2nu in the module oscprob2nu. It takes as input parameters the hamiltonian, in the form of a 2x2 Hermitian matrix, and the baseline L.
This function returns the list of probabilities Pee (nu_e --> nu_e), Pem (nu_e --> nu_mu), Pme (nu_mu --> nu_e), and Pmm (nu_mu --> nu_mu). (These probabilities could also be Pmm, Pmt, Pmt, and Ptt instead, depending on what Hamiltonian you pass
