Flavour-oscillation probabilities for neutrinos with numpy/torch backends.
Project description
Neutrino Interferometry - nu_waves Python library
What is it?
Neutrino Interferometry, or nu_waves, is a simple Python library
that calculate flavor oscillation of neutrinos.
You can input your own parameters and get the oscillation probabilities.
How to install?
pip install nu-waves
Features
- Embedded GPU acceleration (MPS, CUDA)
- Oscillation framework with
Nneutrinos - Vacuum oscillations
- Custom smearing function (L and E)
- Constant matter MSW
- Multi-layer matter MSW
- Earth model (PREM) with
cosz - Adiabatic transitions
Some nice pictures
Examples
2 flavors oscillation in vacuum
import numpy as np
import matplotlib.pyplot as plt
from nu_waves.models.mixing import Mixing
from nu_waves.models.spectrum import Spectrum
from nu_waves.propagation.oscillator import Oscillator
import nu_waves.utils.flavors as flavors
# sterile test
osc_amplitude = 0.1 # sin^2(2\theta)
angles = {(1, 2): np.arcsin(np.sqrt(osc_amplitude)) / 2}
pmns = Mixing(n_neutrinos=2, mixing_angles=angles)
U_pmns = pmns.build_mixing_matrix()
print(np.round(U_pmns, 3))
# 1 eV^2
spec = Spectrum(n_neutrinos=2, m_lightest=0.)
spec._generate_dm2_matrix({(2, 1): 1})
spec.summary()
m2_diag = np.diag(spec.get_m2())
# oscillator object that calculates the oscillation probability
osc = Oscillator(mixing_matrix=U_pmns, m2_list=spec.get_m2())
# get the oscillation probabilities
E_fixed = 3E-3
L_min, L_max = 1e-3, 20e-3
L_list = np.linspace(L_min, L_max, 200)
print(L_list)
P = osc.probability(
L_km=L_list, E_GeV=E_fixed,
flavor_emit=flavors.electron,
flavor_det=flavors.electron, # muon could be sterile
antineutrino=True
)
# draw it
plt.figure(figsize=(6.5, 4.0))
plt.plot(L_list * 1000, P, label=r"$P_{e e}$ disappearance", lw=2)
plt.plot(L_list * 1000, [1] * len(L_list), "--", label="Total probability", lw=1.5)
plt.xlabel(r"$L_\nu$ [m]")
plt.ylabel(r"Probability")
plt.title(f"eV$^2$ sterile with $E_\\nu$ = {E_fixed * 1000} MeV")
# plt.xlim(L_min, L_max)
plt.ylim(0, 1.05)
plt.legend()
plt.tight_layout()
plt.show()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nu_waves-1.1.0.tar.gz.
File metadata
- Download URL: nu_waves-1.1.0.tar.gz
- Upload date:
- Size: 39.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b2d671d2fc3aa2ada817fbc9d5ae61c42d6f40e41ad8368569d0766fda8a792
|
|
| MD5 |
bdb077a27b933a7510ef7ac1f740706f
|
|
| BLAKE2b-256 |
ba6211a000b8524085d02340f31c8e39a9ad1c37fadcce12bf497ba1be3e9905
|
Provenance
The following attestation bundles were made for nu_waves-1.1.0.tar.gz:
Publisher:
publish.yml on nadrino/neutrino-interferometry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nu_waves-1.1.0.tar.gz -
Subject digest:
3b2d671d2fc3aa2ada817fbc9d5ae61c42d6f40e41ad8368569d0766fda8a792 - Sigstore transparency entry: 641291703
- Sigstore integration time:
-
Permalink:
nadrino/neutrino-interferometry@b807f756e55640acc166d4481ff8e5eaed79c03f -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/nadrino
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b807f756e55640acc166d4481ff8e5eaed79c03f -
Trigger Event:
push
-
Statement type:
File details
Details for the file nu_waves-1.1.0-py3-none-any.whl.
File metadata
- Download URL: nu_waves-1.1.0-py3-none-any.whl
- Upload date:
- Size: 46.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38b2ad3a94cba91652c573e60d4bf9785e46d1757ef2a726213b715b1759076a
|
|
| MD5 |
2c3f4164cec78acdf2e36043f83fdce0
|
|
| BLAKE2b-256 |
a9e6828f73185626cc3b0d799a9522f8607b4bbdee3015e0625f5eff033e4391
|
Provenance
The following attestation bundles were made for nu_waves-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on nadrino/neutrino-interferometry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nu_waves-1.1.0-py3-none-any.whl -
Subject digest:
38b2ad3a94cba91652c573e60d4bf9785e46d1757ef2a726213b715b1759076a - Sigstore transparency entry: 641291709
- Sigstore integration time:
-
Permalink:
nadrino/neutrino-interferometry@b807f756e55640acc166d4481ff8e5eaed79c03f -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/nadrino
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b807f756e55640acc166d4481ff8e5eaed79c03f -
Trigger Event:
push
-
Statement type: