magnus.oscprob
oscprob.py
Contains routines to compute the neutrino oscillation probability.
Internally, the probability is computed using Magnus expansion, but the
user does not call the routines in the magnus.magnus module
directly. Instead, the user calls the osc_prob(), which calls the
Magnus expansion routines internally. The function osc_prob() is
generic, flexible, and computationally efficient.
osc_prob(): Primordial function to compute the oscillation probability, for any given Hamiltonian, either time-dependent or -independent (or, equivalently, position-dependent or -independent). Supports arbitrary number of neutrino flavors.
The module contains additional functions that are wrappers of
osc_prob() to compute commonly studied cases.
Neutrino oscillations in vacuum:
osc_prob_2nu_vacuum(): Two-neutrino oscillation probabilities.osc_prob_3nu_vacuum(): Three-flavor oscillation probabilities.osc_prob_4nu_vacuum(): One additional flavor (i.e., 3+1 sterile neutrino model).osc_prob_5nu_vacuum(): Two additional flavors (i.e., 3+2 sterile neutrino model).
Neutrino oscillations in constant-density matter:
osc_prob_2nu_matter_constant_density(): Two-neutrino oscillation probabilities.osc_prob_3nu_matter_constant_density(): Three-neutrino oscillation probabilities.osc_prob_4nu_matter_constant_density(): One additional flavor (i.e., 3+1 sterile model).osc_prob_5nu_matter_constant_density(): Two additional flavors (i.e., 3+2 sterile model).
Neutrino oscillations in exponentially falling matter density profile (e.g., in a supernova or the Sun):
osc_prob_2nu_matter_exp_density(): Two-neutrino oscillation probabilities.osc_prob_3nu_matter_exp_density(): Three-neutrino oscillation probabilities.osc_prob_4nu_matter_exp_density(): One additional flavor. Matter potential affects only \(\nu_e\).osc_prob_5nu_matter_exp_density(): Two additional flavors. Matter potential affects only \(\nu_e\).
Neutrino oscillations between any two locations on the surface of the Earth, useful for long-baseline neutrino experiments:
osc_prob_2nu_earth(): Two-neutrino oscillation probabilities.osc_prob_3nu_earth(): Three-neutrino oscillation probabilities.osc_prob_4nu_earth(): One additional flavor. Matter potential affects only \(\nu_e\).osc_prob_5nu_earth(): Two additional flavors. Matter potential affects only \(\nu_e\).osc_prob_earth(): Oscillation probabilities for arbitrary number of flavors and arbitrary Hamiltonian. Does not assume standard oscillations.
Note
These routines use the Preliminary Reference Earth Model for the
matter density profile inside Earth. To use a different density
profile (including also profiles for bodies other than the Earth),
use the primordial function osc_prob() instead.
Neutrino oscillations in the Sun:
osc_prob_2nu_sun(): Two-neutrino oscillation probabilities.osc_prob_3nu_sun(): Three-neutrino oscillation probabilities.osc_prob_4nu_sun(): One additional flavor. Matter potential affects only \(\nu_e\).osc_prob_5nu_sun(): Two additional flavors. Matter potential affects only \(\nu_e\).osc_prob_sun(): Oscillation probabilities for arbitrary number of flavors and arbitrary Hamiltonian. Does not assume standard oscillations.
Note
These routines use a simple exponentially falling function of radial distance for the matter density inside the Sun: \(N_e(r) = N_e(0) \exp(-r/r_0)\), with \(N_e(0) = 245 N_\text{Av}~\text{cm}^{-3}\) and \(r_0 = R_\odot/10.54\). See Eq. (10.62) in Fundamentals of Neutrino Physics and Astrophysics by Carlo Giunti and Chung Wook Kim.
To use a different density profile, use the primordial function
osc_prob() instead.
Functions designed for specific beyond-the-Standard-Model proposals:
Non-standard neutrino interactions (NSI):
Lorentz-invariance violation:
Examples
See also
Find many more examples, including advanced applications and plots, in the Jupyter notebooks that are distributed with \({\rm Mag}{\nu}s\).
The code blocks below run when these docs are built, so the output shown is always current.
import numpy as np
import magnus.oscprob as oscprob
import magnus.globaldefs as gd
np.set_printoptions(precision=3)
# Warnings are normally prefixed with an ANSI-colored "Warning:", which is
# meant for a terminal and renders as escape-code noise in HTML. These docs
# therefore switch to plain text; in a terminal, leave this alone.
gd.set_color_output(False)
Calling osc_prob_3nu_vacuum() returns a \(3 \times 3\) NumPy array
of probabilities whose entry [i][j] is the probability of a neutrino
produced with flavor i being detected with flavor j
For a single neutrino energy and baseline:
baseline = 10.0 * gd.UNIT_KM # 10 km in natural units [eV^-1]
energy = 1.0 * gd.UNIT_MEV # [eV]
oscprob.osc_prob_3nu_vacuum(energy, baseline)
array([[0.445, 0.299, 0.257],
[0.251, 0.639, 0.11 ],
[0.304, 0.062, 0.634]])
The probabilities returned by osc_prob_3nu_vacuum() (and also
osc_prob_2nu_vacuum(),
osc_prob_2nu_matter_constant_density(), and
osc_prob_3nu_matter_constant_density()) are returned with machine
(or NumPy) precision, since first-order Magnus expansion is enough to
compute them.
Pick one channel only, e.g., \(\nu_e \to \nu_\mu\), by passing
an initial flavor, nu_i, and a final flavor nu_f:
oscprob.osc_prob_3nu_vacuum(energy, baseline, nu_i=gd.NUE, nu_f=gd.NUMU)
np.float64(0.2986723533641986)
The flavor indices NUE, NUMU, and NUTAU are defined in the
magnus.globaldefs module. For anti-neutrinos, i.e.,
\(\bar{\nu}_e \to \bar{\nu}_\mu\):
oscprob.osc_prob_3nu_vacuum(energy, baseline, nu_i=gd.NUE, nu_f=gd.NUMU,
nubar=True)
np.float64(0.2510712771435615)
Calling osc_prob_3nu_vacuum() without specifying the values of the
oscillation parameters will compute probabilities using the default
values in \({\rm Mag}{\nu}s\) (see
gd.OSC_PARAMS_PREDEFINED['OSC_PARAMS_DEFAULT'].)
We can specify values of the oscillation parameters. Unspecified values
are set to their defaults (pass nonzero verbose to see this and
other warnings):
oscprob.osc_prob_3nu_vacuum(energy, baseline, s12=0.0, verbose=1)
Warning: Setting unspecified standard oscillation parameters to default values from the predefined set OSC_PARAMS_NU_FIT_6_0_NO (NuFit 6.0, NO, with SK atmospheric data):
s23 = 0.6855654600401044
s13 = 0.14882876066137216
dCP = 3.7000980142279785 rad
D21 = 7.49e-05 eV^2
D31 = 0.002513 eV^2
Warning: The provided Hamiltonian is time-independent. Overwriting the run parameters to magnus_exp_order = 1, n_slabs = 1, n_tpts_per_slab = 2, rtol = None, atol = None, and n_jobs = 1 for speed-up.
array([[0.985, 0.007, 0.008],
[0.007, 0.736, 0.257],
[0.008, 0.257, 0.735]])
Fixed energy, multiple baselines:
baselines = gd.UNIT_KM * np.array([1.0, 10.0, 100.0])
oscprob.osc_prob_3nu_vacuum(energy, baselines, nu_i=gd.NUE, nu_f=gd.NUMU)
array([0.004, 0.299, 0.019])
Fixed baseline, multiple energies:
energies = gd.UNIT_MEV * np.array([1.0, 10.0, 100.0])
oscprob.osc_prob_3nu_vacuum(energies, baseline, nu_i=gd.NUE, nu_f=gd.NUMU)
array([0.299, 0.004, 0.003])
Multiple energies and baselines:
oscprob.osc_prob_3nu_vacuum(energies, baselines, nu_i=gd.NUE, nu_f=gd.NUMU)
array([0.004, 0.004, 0.004])
To compute the oscillation probabilities in constant-density matter, we
need to specify the matter density, rho, i.e.,
rho = 10.0 * gd.UNIT_G_PER_CM3
oscprob.osc_prob_3nu_matter_constant_density(energy, baseline, rho,
nu_i=gd.NUE, nu_f=gd.NUMU)
np.float64(0.3005879215484481)
To compute oscillation probabilities for a time-dependent Hamiltonian,
we need to call osc_prob() directly which, while still
straightforward, requires us to pass a Hamiltonian function explicitly.
For instance, for density matter profile that is exponentially falling with distance:
Hint
There is a good chance that the scenario you are interested in calculating was already developed in the \({\rm Mag}{\nu}s\) Jupyter notebooks.
Worked-out examples include: oscillations in various matter density profiles, in the Earth, and in the Sun, oscillograms, biprobability plots, and new-physics models like additional neutrino flavors (3+1 and 3+2 sterile neutrino models), non-standard neutrino interactions, and Lorentz-invariance violation.
See Code Architecture for how the osc_prob_* functions listed above
are layered internally (primordial/middle/wrapper) and how to add a new one.
Attributes
Module-level constant |
|
Module-level constant |
|
Module-level constant |
|
Module-level constant |
|
Module-level constant |
|
Module-level constant |
|
Module-level constant |
|
Module-level constant |
|
Module-level constant |
|
Module-level constant |
|
Module-level constant |
|
Module-level constant |
Exceptions
Warns that a refinement ladder ran out of room before it converged. |
|
Warns that |
|
Warns that a cumulative baseline scan was asked to integrate a Hamiltonian that is |
|
Warns that the profile has structure too narrow for any grid this package lays down. |
|
Warns that |
|
Warns that |
Functions
|
Prints the Magnus ASCII banner, version, and author string. |
|
Prints the banner (once per session) and the parameters passed to |
|
Validates the inputs common to the |
|
Resolves (costhz, L) for |
|
Remaps 3-flavor-style flavor indices onto valid 2-flavor indices (0 or 1). |
|
Return values of unspecified standard oscillation parameters |
|
Unpack oscillation parameters from the osc_params dict |
|
Unpack NSI parameters from the nsi_params dict |
|
Unpack LIV parameters from the liv_params dict |
|
Computes the evolution operator inside a given time slab. This functions is not designed to |
|
Computes the evolution operators of a chain of time slabs. This function is not designed |
|
Computes and returns the neutrino oscillation probability. |
|
Compute and return oscillation probabilities for given arrays of |
|
Answer the same request with every engine that applies, and report how far apart they are. |
|
Computes and returns neutrino oscillation probabilities for |
|
Computes and returns neutrino oscillation probabilities for |
|
Computes and returns neutrino oscillation probabilities for |
|
Computes and returns neutrino oscillation probabilities for |
|
Compute and return the two-neutrino oscillation probability in |
|
Compute and return the three-neutrino oscillation probability in |
|
Compute and return the four-neutrino (3+1) oscillation |
|
Compute and return the five-neutrino (3+2) oscillation |
|
Compute and return the two-neutrino oscillation probability in |
|
Compute and return the three-neutrino oscillation probability in |
|
Compute and return the four-neutrino oscillation probability in |
|
Compute and return the five-neutrino oscillation probability in |
|
Compute and return the two-neutrino oscillation |
|
Compute and return the three-neutrino oscillation |
|
Compute and return the four-neutrino (3+1) oscillation |
|
Compute and return the five-neutrino (3+2) oscillation |
|
Compute and return the two-neutrino oscillation probability |
|
Compute and return the three-neutrino oscillation probability |
|
Compute and return the four-neutrino oscillation probability |
|
Compute and return the five-neutrino oscillation probability |
|
Compute and return the neutrino oscillation probability inside |
|
Compute and return the two-neutrino oscillation probability |
|
Compute and return the three-neutrino oscillation probability |
|
Compute and return the four-neutrino (3+1) oscillation |
|
Compute and return the five-neutrino (3+2) oscillation |
|
Compute and return the neutrino oscillation probability inside |
Compute and return the two-neutrino oscillation probability in |
|
Compute and return the three-neutrino oscillation probability in |
|
Compute and return the four-neutrino oscillation probability in |
|
Compute and return the five-neutrino oscillation probability in |
|
|
Compute and return the two-neutrino oscillation probability in |
|
Compute and return the three-neutrino oscillation probability in |
|
Compute and return the four-neutrino (3+1) oscillation |
|
Compute and return the five-neutrino (3+2) oscillation |
|
Compute and return the two-neutrino oscillation probability |
|
Compute and return the three-neutrino oscillation probability |
|
Compute and return the four-neutrino oscillation probability |
|
Compute and return the five-neutrino oscillation probability |
|
Compute and return the two-neutrino oscillation probability |
|
Compute and return the three-neutrino oscillation probability |
|
Compute and return the four-neutrino (3+1) oscillation |
|
Compute and return the five-neutrino (3+2) oscillation |
|
Compute and return the two-neutrino oscillation probability in |
|
Compute and return the three-neutrino oscillation probability in |
|
Compute and return the four-neutrino oscillation probability in |
|
Compute and return the five-neutrino oscillation probability in |
Compute and return the two-neutrino oscillation probability in |
|
Compute and return the three-neutrino oscillation probability in |
|
Compute and return the four-neutrino oscillation probability in |
|
Compute and return the five-neutrino oscillation probability in |
|
|
Compute and return the two-neutrino oscillation probability in |
|
Compute and return the three-neutrino oscillation probability in |
|
Compute and return the four-neutrino oscillation probability in |
|
Compute and return the five-neutrino oscillation probability in |
|
Compute and return the two-neutrino oscillation probability |
|
Compute and return the three-neutrino oscillation probability |
|
Compute and return the four-neutrino oscillation probability |
|
Compute and return the five-neutrino oscillation probability |
|
Compute and return the two-neutrino oscillation probability |
|
Compute and return the three-neutrino oscillation probability |
|
Compute and return the four-neutrino oscillation probability |
|
Compute and return the five-neutrino oscillation probability |
Module Contents
- magnus.oscprob.MAX_N_SLABS_DEFAULT[source]
Module-level constant
Default cap on the number of slabs, per
integration_method, used whenmax_n_slabsis left as None.The cap exists to bound cost, and cost per slab differs by more than an order of magnitude between the two families of integrators.
'gl'evaluates the Hamiltonian 1, 2, or 3 times per slab (set by the expansion order), while'trapezoid'and'simpson'evaluate itn_tpts_per_slabtimes (100 by default, up to 500). A single cap tuned for one family therefore starves the other: at 2000 slabs – the quadrature cap, unchanged here –'gl'was hitting the ceiling on cases it could resolve comfortably, and reporting that it could not verify convergence, on answers that were in fact far more accurate than the quadrature methods managed within their own cap.The
'gl'value is set from both directions. The hardest case in the validation suite (5 flavors, eV-scale sterile splittings, Earth-crossing baseline) converges at about 8,600 slabs, so 20000 leaves better than a factor of two of headroom. At the same time, 20000 slabs at 2-3 nodes is roughly 40,000-60,000 Hamiltonian evaluations, still well under the ~200,000 that 2000 quadrature slabs at 100 points per slab already permit – so the more generous cap is also the cheaper worst case.Passing
max_n_slabsexplicitly always wins; this is only the fallback.Added in version 1.0.0.
- Type:
- magnus.oscprob.IP_EXP_N_SLABS_CAP = 2000000[source]
Module-level constant
Slab ceiling for the closed-form interaction-picture integrator (
_osc_prob_ip_exp_core), deliberately decoupled from the caller’smax_n_slabs, which is calibrated for the far more expensive quadrature slabs of the general method. Each slab here costs one 2x2 eigendecomposition, so the ceiling is affordable in time.It is not, on its own, affordable in memory: the integrator works on arrays of shape
(n_energies, n_slabs, d, d), so the working set scales with the number of energies as well as the slab count, and at this ceiling it reached ~1.3 GB per energy – enough for a batched solar call to exhaust the machine. The working set is now tiled toBATCH_WORKING_ENTRIESindependently of both, so this ceiling bounds only time. Seedocs/dev/BUG_IP_EXP_MEMORY.md.Named rather than inlined so that the method’s give-up behaviour at the ceiling can be exercised by a test at a small cap: reaching two million slabs to check what happens at the boundary would cost minutes, so with the value buried in the function body those branches could not be tested at all.
Added in version 1.0.0.
- Type:
- magnus.oscprob.MIN_EFFECTIVE_REFINEMENT = 1.25[source]
Module-level constant
Least ratio of actual slab edges between two refinement levels for their agreement to be allowed to count as convergence.
The ladder multiplies
n_slabsbygrowth_factor_n_slabs, butt_breakpointsare re-inserted into every level’s grid, so at small counts the nominal step and the real one are very different things: on a chord with fourteen PREM crossings a nominal 2 -> 3 slab step is a 16 -> 17 edge step, a 6% refinement rather than a 50% one. Two grids differing by 6% give nearly the same answer for reasons that have nothing to do with having converged, andnp.allclosereads that as success.This was returning answers outside the requested tolerance, silently. Measured over 120 Earth configurations (costhz -0.15 to -0.99, 0.5-8 GeV, rtol = atol = 1e-3 / 1e-4 / 1e-5, 3nu, scored against a 6000-slab reference verified converged to 1e-13): one silent violation, 2.1x outside the tolerance asked for, and five more that missed but did at least warn. At 1.25 all six become zero. The value is the smallest that clears the population:
bound
silent violations
missed but warned
median slabs returned
1.00
1
5
9
1.15
0
1
14
1.25
0
0
21
1.40
0
0
108
1.50
0
0
20 000
1.40 buys nothing and costs twelve times the slabs. The levels 1.25 adds are the cheap small ones, so wall clock rises far less than the slab count: a 60-energy Earth scan goes from 9 ms to 10 ms.
One constant covers every case measured; none of them wanted their own. Repeating the sweep at four and five flavours (same chords and energies, three tolerances, against a 4000-slab reference) gives zero silent violations at 1.25 in all of 3nu, 4nu and 5nu. Four and five flavours each keep one case that misses but warns, which is the existing contract rather than this defect. Breakpoint density does not reach it either: swept at 0, 10, 50, 200 and 1000 user-supplied breakpoints, the ladder converged with identical slab counts either side of the gate, because its seed starts in the thousands and never visits the small counts where dense breakpoints would dominate the ratio.
The bound must stay below ``growth_factor_n_slabs``, and the cliff is sharp. At 1.50 the ratio is only reachable when rounding happens to favour it, so the ladder runs to the cap instead: median slabs returned goes to 20 000 –
max_n_slabs– at every flavour count, for no accuracy gained over 1.25. That is the failure mode of a bound set too high, and it is why the measured value sits a comfortable distance under the growth factor rather than just beneath it.It is a no-op wherever there are no breakpoints, since the edge count is then the slab count and the ratio is
growth_factor_n_slabsitself – solar probabilities are bit-identical either side of this change, verified to fifteen digits. It also cannot cause a spurious non-convergence atmax_n_slabs, where the cap logic ends the ladder independently; checked.A growth-rule fix was tried instead – enlarging
n_slabsso that the edge count grows bygrowth_factor_n_slabs– and rejected on measurement: it left two of the six misses in place and cost slightly more (median 22 slabs against 21).Added in version 1.0.0.
- Type:
- magnus.oscprob.BATCH_WORKING_ENTRIES = 65536[source]
Module-level constant
Ceiling on the number of complex entries in any one temporary array of the batched scan engines – about 1 MB at 16 bytes each. Both batched engines work on arrays indexed by (energy, slab, …), whose size is the product of quantities the caller controls independently, so neither a slab cap nor an energy count bounds them on its own. Tiling against a fixed entry budget does, and it makes peak memory a property of the library rather than of the call.
The value is measured, and it is small on purpose. The batched kernels are memory-bound rather than compute-bound: the stack is written by the Hamiltonian builder and then streamed by the kernel, which does little arithmetic per byte, so a working set that fits in cache is read back nearly free and one that does not is refetched from memory. Swept over 1 MB / 4.2 MB / 12.6 MB / 67 MB / 268 MB across fifteen workloads on three engines (microseconds per probability):
workload
1.0 MB
4.2 MB
12.6 MB
67 MB
268 MB
separable, 3nu, 2000 E
96.4
103.1
112.6
115.2
114.8
separable, 4nu, 20000 E
124.8
127.6
138.9
171.3
191.5
separable, 5nu, 2000 E
146.1
155.1
172.2
201.8
202.1
cumulative, 2nu, 60 L
1720.4
1909.4
1984.0
1995.5
1996.5
1 MB won eight of the eleven memory-bound workloads and was never worse than the previous 67 MB default; the gain over it runs to 1.19x-1.38x on Earth energy scans and grows with both flavour count and scan length. Short scans (a few hundred points) are flat within 2%, where fixed overhead dominates. The interaction-picture engine is flat at 1.00x throughout – it is compute-bound, so this constant does not reach it.
Tiling never changes the answer: every workload above was bit-identical at every budget, because the tiles are independent and only concatenated. So this is a pure performance knob, and retuning it needs no accuracy justification.
Two caveats on the number. It was measured on one machine (13 MB L3, 6.5 MB L2), and the optimum sits below the last-level cache – 1 MB beat 12.6 MB – which suggests L2 or streaming behaviour, not last-level residency, is what actually matters. That also means autodetecting the last-level cache and sizing to it, as NuOscProbExact does for its own chunking, would have landed on a worse value here than this fixed constant. Set the constant to retune; nothing caches it, and both batched engines read it at call time.
Added in version 1.0.0.
- Type:
- magnus.oscprob.CUMULATIVE_AUTO_MIN_POINTS = 2[source]
Module-level constant
Fewest baselines at which
cumulative='auto'engages the cumulative scan inosc_prob_energy_baseline().A single baseline has no prefix to reuse, and would pay for the adaptive probe that sizes the inherited grid without getting anything back – which matters because every single-point call through the wrapper layer is served by
osc_prob_energy_baseline. From two baselines upward there is something to share.That argument is about sharing, and one thing it does not establish is whether paying for the probe once is worse than what a single point gets instead. Measured against the engine
'auto'otherwise uses on a single point – the adiabatic hybrid path – it is not: the cumulative scan at N = 1 is cheaper on every profile of the physical population, from 0.62x on a tabulated profile to 0.02x on a real solar model, median 0.15x (docs/dev/adversarial_batteries/physical_battery.py seam_cost). And with this constant at 1 alongsideHYBRID_YIELDS_TO_CUMULATIVE_MIN_POINTS, both silent misses the physical population produced are repaired: 1.380e-03 -> 1.707e-05 on the BS2005-AGS,OP solar model at 5 MeV, and 1.095e-03 -> 2.586e-06 on a supernova shock.It is nevertheless still 2, because lowering it changes which engine answers most requests this package serves, and the measurement above does not license that – see
HYBRID_YIELDS_TO_CUMULATIVE_MIN_POINTSfor the three reasons, of which the sharpest is that a declining hybrid path does not hand the request to the cumulative scan but to whichever engine applies next.Note that this constant being 2 is what kept two latent defects in the cumulative branch unreachable by default, both fixed here and both reachable on the shipped tree through an explicit
cumulative=True: a missing scalar squeeze, and aconvergence_infokeyword forwarded to an engine that rejects it.The threshold is deliberately not set at the point where the cumulative scan becomes faster, which is higher (measured against
solve_ivp, on a 5 MeV solar scan to one solar radius: 0.75x at N = 2, 0.87x at N = 10, 2.65x at N = 25, 84x at N = 1000). Below that crossover the cumulative scan is at most ~1.3x slower in wall time while being one to three orders of magnitude more accurate – and the per-point path it replaces returns answers outside the requested 1e-3 there (9.7e-3 at N = 10, 5.6e-3 at N = 25, 2.6e-3 at N = 100). Trading a few milliseconds for that is the right way round.Added in version 1.0.0.
- Type:
- magnus.oscprob.HYBRID_YIELDS_TO_CUMULATIVE_MIN_POINTS = 8[source]
Module-level constant
Fewest baselines at which
_osc_prob_hybrid_dispatchstands aside, understrategy='auto', so that a single-energy baseline scan reaches the cumulative scan instead.Deliberately larger than
CUMULATIVE_AUTO_MIN_POINTS, because the two thresholds guard different trades, and because being the larger keeps the fall-through safe: whenever the hybrid dispatcher declines on this count,cumulative='auto'is guaranteed to engage, so a scan can never decline both paths and land on the general per-point method.This was 25, and both halves of the justification for that turned out to be wrong. The original reasoning was that below N = 25 the cumulative scan’s near-constant cost is not yet amortised, so yielding would make a small scan “several times slower (7.6x at N = 2) to buy accuracy that was already two orders inside what the caller asked for”. Both clauses were measured on solar profiles only, which is the easiest case for the hybrid path and the hardest for the cumulative scan’s strict probe.
The accuracy clause, re-measured over 42 workloads spanning 7 profile families, d = 2 and 3, and single points, baseline scans and energy scans (
docs/dev/adversarial_batteries/fallback_quality.py):engine
worst error
adiabatic hybrid, over 42 workloads
1.68e-03
cumulative scan, over the 28 it serves
1.13e-07
Not two orders inside the tolerance: on 30 of 42 workloads
'auto'was more than 10x worse than the best engine that applied, by up to 900 000x, and on two it was outside the requested 1e-3 with no warning at all. Both of those were baseline scans at N = 8, which the cumulative scan answers to ~1e-9.The cost clause, re-measured by alternating with a control that came back at 0.99x (
seam.py), as the median cumulative/hybrid ratio across 3 profiles x d = 2, 3:N
median cost
worst case
2
0.87x
5.75x (solar, d = 3)
4
0.48x
2.84x (solar, d = 3)
8
0.25x
1.44x (solar, d = 3)
16
0.17x
0.72x
24
0.12x
0.50x
The cumulative scan is cheaper on median at every size measured, and on a multi-resonance profile at N = 8 it is 30x cheaper. The 7.6x figure was solar, at N = 2, where the hybrid path is at its best.
8 was where the worst case stopped mattering, on that population: at N = 8 the only profile on which yielding cost anything was solar at d = 3, at 1.44x, in exchange for three to six orders of accuracy; at N = 4 that worst case was 2.84x and at N = 2 it was 5.75x.
Lowering it to 1 was built, measured and REVERTED. Eight is a threshold on point count, so it repaired baseline scans and cannot, even in principle, reach a single point – and single points turned out to be where the remaining silent misses live. Over 195 configurations of a physically-motivated population (
docs/dev/adversarial_batteries/physical_profiles.py: a real published solar model, a supernova shock and turbulence from the literature, Earth with a non-PREM crust, interpolated density tables),strategy='auto'was outside the requested 1e-3 with no warning at all on exactly two, and both were single points on which the cumulative scan was already 400-1100x more accurate and structurally unreachable:configuration
hybrid, N = 1
cumulative
BS2005-AGS,OP solar model, d = 2, 5 MeV
1.380e-03
1.707e-05
supernova shock w = 1e-3, d = 3, 15 MeV
1.095e-03
2.586e-06
The first is the one that decided it: a real published solar model, at an energy in the 8B spectrum, in the two-flavour treatment that is standard for the solar problem, returning a certified answer outside the caller’s tolerance in silence.
And the cost objection did not survive measurement either. Re-measured on the physical population by alternating the two engines with a control that returned 1.00x, 1.01x and 1.06x across three rounds (
physical_battery.py seam_cost), reading minima rather than medians because interference can only add time:N = 1 profile
cumulative / hybrid cost
BS05 solar model
0.02x (681 ms -> 15 ms)
turbulence
0.01x
Earth crust
0.15x
supernova shock
0.27x
tabulated
0.62x
The cumulative scan is cheaper at N = 1 on every profile measured, median 0.15x. There is no accuracy-against-cost trade here to balance: the engine that is three orders more accurate on the failing cases is also one to two orders cheaper on them. Across the whole sweep exactly one row costs anything –
tabulatedat N = 2, at 1.61x – and that is a case which is already well inside tolerance either way.So why is this still 8? Because setting both constants to 1 was tried, and the routing consequence is not the one the cost measurement implies. Three findings, in order of how much they matter:
Standing aside does not mean the cumulative scan answers. The dispatch order is hybrid -> interaction picture -> separable -> cumulative. When the hybrid path declines, the next engine that applies takes the request, and on several workloads that is
ip_exp, not the cumulative scan. The measurement above compares hybrid against cumulative; it does not measure hybrid against whatever comes next, which is what actually happens. Two tests caught this asassert 'ip_exp' == 'hybrid'.The cumulative branch is under-exercised, because it has never been the default. Making it so immediately surfaced two latent defects, both reachable on the shipped tree via an explicit
cumulative=Trueand both fixed here: a missing scalar squeeze that returned(1, d, d)instead of(d, d), and aconvergence_infokeyword forwarded to an engine that rejects it, raisingTypeErrorinstead of returning a probability. Two found in minutes says the branch needs its own audit before it carries the default traffic.It is a change of default, not a dominant engine. The cumulative scan’s worst error over the 76 physical workloads it serves is 5.10e-03, and on one the hybrid path was 15x better.
The exposure is real and remains open: see
docs/dev/FINDINGS_ROBUSTNESS_PROGRAMME.md§13. The fix is a surgical one – have the hybrid path yield to the cumulative scan specifically rather than merely decline – not a threshold change.Accuracy still steps at this threshold, and it is a large step. Because the two sides are different methods rather than two settings of one method, adding a single baseline can change every answer in a scan. Measured against
solve_ivpacross the old threshold, which is the same discontinuity moved to a new place:profile
below
above
step
solar exponential
3.30e-05
2.13e-08
1 546x
noisy
6.27e-04
1.04e-08
60 418x
multi-resonance
1.58e-03
2.86e-09
552 945x
The step is always toward the truth, so it is a discontinuity to know about rather than a defect. Pass
cumulative=Trueto take the cumulative scan below the threshold as well, orcumulative=Falseto stay off it entirely.Added in version 1.0.0.
- Type:
- magnus.oscprob.CUMULATIVE_N_ACC_SAFETY = 4[source]
Module-level constant
Multiple of the inherited slab count used for the accuracy grid of a cumulative baseline scan (
osc_prob_energy_baseline(..., cumulative=True)).The grid is sized from one adaptive
osc_prob()call at the longest baseline, which reports the slab count that baseline needed. Applied unmultiplied, the same uniform density is thinner than what a per-point path would have chosen for the shorter baselines in the scan, and the result – while inside the requested tolerance – comes out less accurate than the path it replaces. Measured on a 1000-point solar scan againstsolve_ivp, where the per-point path takes 12.0 s for an error of 5.6e-5:safety
n_acctime
error
1
14 883
0.049 s
2.35e-04
2
29 766
0.097 s
5.10e-06
4
59 532
0.173 s
3.34e-07
8
119 064
0.346 s
1.80e-08
Why four rather than two. Two was chosen when the cumulative scan’s only alternative was the general per-point path, against which it was already 124x faster and 11x more accurate. Since the dispatch chain routes wrapper baseline scans here (see
HYBRID_YIELDS_TO_CUMULATIVE_MIN_POINTS), the alternative is the hybrid strategy instead, which is considerably more accurate than the per-point path – so the bar moved. At two, a 48-configuration sweep found three where the cumulative scan was less accurate than the hybrid answer it replaced, all at high energy over a short baseline:configuration
hybrid
safety 2
safety 4
60 MeV, N=150, 0.4 Rsun
1.57e-05
5.03e-05
8.56e-07
100 MeV, N=150, 0.4 Rsun
2.51e-05
3.77e-05
6.11e-07
100 MeV, N=40, 0.4 Rsun
9.13e-06
1.10e-05
5.58e-07
Four removes all three and beats the hybrid answer on each, while improving the unaffected configurations by roughly twenty times as well (5 MeV, N = 150: 8.4e-07 -> 3.7e-08). It costs about 1.4x in wall time – 28 ms -> 40 ms, 260 ms -> 366 ms on the cases above – against a path it is still tens of times faster than. Eight is better again but 2.4x, and buys accuracy no longer needed to clear the bar.
Note that the error is not concentrated where the shape of this constant suggests: on the 60 MeV case it sits at the longest baselines (5.03e-05 there against 2.18e-06 over the shortest third), and the grid density at the short end already matches what a probe there would ask for to within 1%. What the multiplier buys is total resolution, not better placement.
The probe does not always converge, and then this multiplier is doing more work than its name suggests. Over a full solar radius at 5 and 10 MeV the strict probe reaches
max_n_slabs(20 000) without two successive levels agreeing, so the count it reports is the cap rather than a converged requirement, andn_accis 80 000 by way of a ceiling. The resulting scans are accurate (~5e-08 measured againstsolve_ivp), but the safety margin is what makes that so. A caller who lowersmax_n_slabslowers the scan’s resolution with it, in proportion and without a separate warning.Added in version 1.0.0.
- Type:
- magnus.oscprob.OUTPUT_GUARD_MIN_BYTES = 67108864[source]
Module-level constant
Requested-output size below which
osc_prob_energy_baseline()does not bother checking whether the result will fit in memory. The check itself costs one integer multiply below this threshold and a single read of the operating system’s free-memory figure above it, so the floor exists to keep even that off the path of ordinary calls.Added in version 1.0.0.
- Type:
- magnus.oscprob.OUTPUT_GUARD_SAFETY = 2.0[source]
Module-level constant
Multiple of the requested result size that must fit in available memory before
osc_prob_energy_baseline()will attempt a scan. Greater than one because the adaptive engines hold at least the current and the previous probability matrices at once, plus the caller’s own input arrays.Deliberately not larger: the guard exists to turn an out-of-memory kill into a diagnosable error, not to second-guess a caller who knows their machine. It refuses only when the answer alone would claim more than half of what is free.
Added in version 1.0.0.
- Type:
- magnus.oscprob.IP_EXP_LOOP_CAP = 30[source]
Module-level constant
Maximum number of refinement loops in
_osc_prob_ip_exp_core.Note this ceiling is not what stops the loop in practice: the slab count doubles each pass, so it reaches
IP_EXP_N_SLABS_CAPafter about twenty passes and returns there, well before a thirtieth pass could occur. It is a backstop against a future change to the growth factor or the slab ceiling, not a live limit.Added in version 1.0.0.
- Type:
- exception magnus.oscprob.ToleranceNotAchievedWarning[source]
Bases:
UserWarningWarns that a refinement ladder ran out of room before it converged.
What was detected. A cap was reached –
max_num_loops,max_n_slabs, ormax_n_tpts_per_slab– while the last two refinement levels still disagreed by more than the requestedrtol/atol.What it means for the answer. The result is still exactly unitary, so it looks plausible; its accuracy is unverified. The message says how far from converged the ladder stopped, as a multiple of the tolerance asked for, because that disagreement is computed anyway by the comparison that decides convergence and it is the difference between raising a cap as a guess and as a decision. A ladder that stopped a few times outside tolerance is a different situation from one that stopped thirty times outside it.
What to change. Raise the cap the message names; or loosen
rtol/atolto what the levels actually agreed to; or, if the profile has a density jump or a kink, passt_breakpointsthere – no number of slabs fixes a slab that straddles one.When it is safe to ignore. When the reported shortfall is smaller than the accuracy the result is used at. Not otherwise: this reports a genuine failure of the convergence test, unlike
magnus.magnus.MagnusConvergenceWarning, which reports a slab width.Also raised by a cumulative baseline scan whose accuracy grid was sized from
max_n_slabsrather than from a converged probe. That instance is worth its own message because the consequence is larger than one point: the whole scan inherits the capped grid.Two subclasses narrow the diagnosis:
HybridCertificationWarningandUnmarkedDiscontinuityWarning. Code filtering on this class catches both.Measured rates (
docs/dev/adversarial_batteries/warn_fp.py, 168 configurations): fired 37 times, 16 true positives and 21 false positives – a 57 % false-positive rate. A false positive here means the ladder genuinely ran out of room and the answer was nonetheless inside tolerance, which is the expected shape: a cap is reached before convergence has been verified, not before it has been achieved.Added in version 1.0.0.
- exception magnus.oscprob.HybridCertificationWarning[source]
Bases:
ToleranceNotAchievedWarningWarns that
strategy='hybrid'was requested (forcingmagnus.adiabatic.hybrid_propagator()) but the self-certifying refinement of at least one requested (energy, L) point did not converge within its internal iteration/slab caps.The returned probabilities remain exactly unitary (every piece of the hybrid propagator – the adiabatic transport and the local Magnus patches – is unitary by construction) but their accuracy relative to the requested
rtol/atolis not certified. This subclassesToleranceNotAchievedWarningso existing code that filters on the parent class also catches this warning; it is issued regardless of the verbosity setting. With the defaultstrategy='auto', this situation instead falls back silently to the general slab-refinement method (which raisesToleranceNotAchievedWarningitself if it also fails to converge), so this warning fires only whenstrategy='hybrid'was explicitly requested. See Adiabatic + Magnus Hybrid Strategy.Uncertified means unverified, not wrong. The message says so, and names three things to change rather than leaving the reader with a disclaimer:
strategy='auto'– the automatic fallback, which hands exactly these points to the general Magnus path and certifies there instead;t_breakpointsat any known structure – a density jump, a kink, or a feature narrower than 1/200 of the trajectory, which is the one cure for what the probe grid cannot resolve;a looser
rtol/atol, when the accuracy needed is less than the accuracy requested.
Which one applies is visible without guessing: pass
strategy_info(seeosc_prob_matter_std_potential()) and read'declined', or passinfotomagnus.adiabatic.hybrid_propagator()directly for'resolved'and'gamma_max'.Added in version 1.0.0.
- exception magnus.oscprob.UnmarkedDiscontinuityWarning[source]
Bases:
ToleranceNotAchievedWarningWarns that a cumulative baseline scan was asked to integrate a Hamiltonian that is discontinuous at the scale of the grid it built, without being told where the discontinuities are.
The cumulative scan lays a uniform accuracy grid over the trajectory (plus the requested baselines, plus any
t_breakpoints). A slab that straddles a density jump degrades the quadrature to low order no matter how highmagnus_exp_orderis, and refining the grid does not fix it – the straddling slab merely gets narrower. The cure is to put an edge on the discontinuity, which is whatt_breakpointsis for.Fuzzing 150 random piecewise-constant profiles, declaring the edges gave a median error of 1.34e-12 and nothing outside tolerance; leaving them undeclared gave a median of 7.76e-04 with 59 of 150 outside it. Of those 59, all but two already warned for other reasons (usually
ToleranceNotAchievedWarningfrom the probe). This warning exists for those two: measured at 1.36e-03 and 2.10e-03 against a requested 1e-3, silently, and 2.33e-11 and 4.35e-14 once the edges were declared.Detection is a measurement, not a guess: the profile is sampled at two grid densities and the largest adjacent change in
His compared (seemagnus.adiabatic._profile_is_resolved). A \(C^1\) profile halves that change when the spacing halves; a jump does not. On the profile families this package ships — solar exponential, multi-resonance, noisy, sinusoidal — the test reports “resolved” every time, and it flagged 12 of 12 random piecewise profiles.Subclasses
ToleranceNotAchievedWarningso that code already filtering on the parent also catches this. Not raised whent_breakpointswas supplied: the caller has then said where the edges are, and the grid honours them.Measured rates (
docs/dev/adversarial_batteries/warn_fp.py, 168 configurations including 48 random piecewise-constant profiles with the edges deliberately left undeclared): fired 56 times, 23 true positives and 33 false positives – 59 %. Read that number carefully: this reports a condition about the input, not a prediction about the error, and on every one of those 33 the condition was real – there was an undeclared discontinuity – and the answer happened to come out inside tolerance anyway. Declaring the edges would still have improved it (median 7.8e-04 to 1.3e-12 inFINDINGS§9.2). A warning whose claim is true and whose advice is worth taking is not made a false alarm by the answer surviving.Also raised on the hybrid path. The same detector already ran inside
magnus.adiabatic.hybrid_propagator(), where failing it makes the strategy decline – silently, so the caller heard about slab widths from whichever engine answered instead, which is true and points at the wrong knob. It now says what it found there too. The detector, its two-stage protocol and its measured false-positive rate are unchanged; only the number of places that report it has grown. On an unmarked density step the adiabatic answer was wrong by 0.54 in probability while reporting itself certified, and that is the case this instance exists for.Added in version 1.0.0.
- exception magnus.oscprob.HiddenFeatureWarning[source]
Bases:
ToleranceNotAchievedWarningWarns that the profile has structure too narrow for any grid this package lays down.
What was detected. A feature whose variation is concentrated between samples of even the finest grid the adaptive machinery reaches – see
magnus.adiabatic.find_hidden_features()andmagnus.adiabatic.HIDDEN_FEATURE_CONCENTRATION. The message names the position.What it means for the answer. Possibly wrong, and no choice of strategy or tolerance helps. This is the one exposure the adversarial validation (
docs/dev/FINDINGS_ADVERSARIAL_VALIDATION.md§8.3) could not close: the hybrid strategy’s probe grid, the general ladder’s slabs and the cumulative scan’s accuracy grid all miss the same feature, so they agree with each other and are wrong together – which is also whycross_check_strategies()cannot see it either. Measured on a Gaussian of width \(3\times10^{-5}\) of the trajectory: wrong by 2.9e-02 against a requested 1e-3, with no warning at all before this existed.What to change. Pass
t_breakpointsbracketing the position in the message, padded by a few reference intervals. Measured on the two constructions above, going from nothing to a padded breakpoint set: 3.9e-03 → 8.5e-05 and 1.3e-03 → 4.4e-04, and the answer stops being silent. The cure is real but partial – putting edges on a feature helps the quadrature, it does not conjure resolution that the sampling never had. For a feature you know the width of, a denser grid there is better still.When it is safe to ignore. When the narrow structure is an artefact of how the profile function was written rather than physics – an interpolation kink, a rounding step in a tabulated density – and you know the physical profile is smooth there.
Subclasses
ToleranceNotAchievedWarning, so code already filtering on the parent catches it. Not raised whent_breakpointswas supplied: the caller has then already said where the structure is. The scan depends on the profile and the interval but not on energy, so it runs once per call, not once per (energy, L) point.Added in version 1.0.0.
- exception magnus.oscprob.PhaseAveragingWarning[source]
Bases:
UserWarningWarns that
average=Truewas requested at an (energy, L) point where the oscillation has not, in fact, averaged.The phase-averaged probability is the exact limit reached when every pair of eigenvalues has accumulated many cycles of relative phase (see
magnus.avgprob). A pair whose relative phase is neither much larger than \(2\pi\) nor much smaller than one radian is in neither limit, and no averaged expression describes it – the oscillation probability itself is the meaningful quantity there.This is not a statement about numerical accuracy: the returned matrix is still a valid, doubly stochastic probability matrix. It is a statement that the question does not apply at that baseline, which is why it warns rather than refining anything.
Added in version 1.0.0.
- exception magnus.oscprob.CrossCheckInconclusiveWarning[source]
Bases:
UserWarningWarns that
cross_check_strategies()reported a spread of zero because it made no comparison, not because the engines agreed.The diagnostic returns
max_spreadandmax_spread_independentas plain floats, and both are0.0when no pair of engines was compared – the same value they take when two engines agree perfectly. A caller who reads either number without also readingrancannot tell the two apart, and the reassuring reading is the wrong one.Three ways to get a vacuous zero:
No engine ran. Every engine declined, most often because the entry point has no
strategyparameter –osc_prob()itself is such an entry point, so it is an easy one to reach for. Pass a wrapper such asosc_prob_matter_std_potential()instead.One engine ran. There is nothing to compare it with.
Only one family ran.
max_spread_independentis zero because no cross-family pair exists. Engines within a family share machinery, so their agreement is the self-certification this diagnostic exists to avoid relying on – seeENGINE_FAMILIES.
A warning rather than an error: the returned dictionary is still well-formed,
declinedsays exactly why each engine stood down, and a caller who wants only one engine’s answer is entitled to ask for it.Added in version 1.0.0.
- magnus.oscprob.print_banner(file: io.TextIOWrapper = None)[source]
Prints the Magnus ASCII banner, version, and author string.
Prints an ASCII-art banner followed by the package version (
magnus.__version__, resolved frompyproject.toml) and author (magnus.authors.__authors__). Both live in internal metadata modules that are excluded from the API reference, so they are shown as literals rather than as cross-references. Uses ANSI color codes when printing to stdout (file is None); plain text otherwise (e.g., when writing to a log file).Added in version 1.0.0.
- Parameters:
file (TextIOWrapper, optional) – File object to print to, in addition to (or instead of, depending on the caller) stdout. If None (default), print to stdout with color.
- Return type:
None
- magnus.oscprob.print_run_parameters(H_func: Callable | numpy.ndarray, t_ini: int | float, t_fin: int | float, n_slabs: int | None = 1, n_tpts_per_slab: int | None = 100, t_slab_edges: list | numpy.ndarray | None = None, magnus_exp_order: int | None = 4, n_jobs: int | None = 1, integration_method: str | None = 'gl', rtol: int | float | None = None, atol: int | float | None = None, growth_factor_n_slabs: int | float | None = 1.5, growth_factor_n_tpts_per_slab: int | float | None = 1.5, max_num_loops: int | None = 50, min_n_slabs: int | None = 1, max_n_slabs: int | None = None, min_n_tpts_per_slab: int | None = 2, max_n_tpts_per_slab: int | None = 500, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', new_recursion_limit: int | None = 5000, verbose: int | None = 0, file_log: io.TextIOWrapper | None = None)[source]
Prints the banner (once per session) and the parameters passed to
osc_prob().Diagnostic/logging helper called from
osc_prob()whenverbose >= 1orsave_logis True. Prints (to stdout, and additionally tofile_logifsave_logis True) the values of every refinement/logging parameter for the current call, to help reproduce or debug a specific run.Added in version 1.0.0.
- Parameters:
H_func (Callable or np.ndarray) – The Hamiltonian passed to
osc_prob().t_ini (int or float) – Integration limits passed to
osc_prob().t_fin (int or float) – Integration limits passed to
osc_prob().n_slabs (int) – Forwarded verbatim from the calling
osc_prob(); see its docstring.n_tpts_per_slab (int) – Forwarded verbatim from the calling
osc_prob(); see its docstring.t_slab_edges (list or np.ndarray, optional) – Forwarded verbatim from the calling
osc_prob(); see its docstring.magnus_exp_order (int) – Forwarded verbatim from the calling
osc_prob(); see its docstring.n_jobs (int) – Forwarded verbatim from the calling
osc_prob(); see its docstring.integration_method (str) – Forwarded verbatim from the calling
osc_prob(); see its docstring.rtol (int or float, optional) – Forwarded verbatim from the calling
osc_prob(); see its docstring.atol (int or float, optional) – Forwarded verbatim from the calling
osc_prob(); see its docstring.growth_factor_n_slabs (int or float) – Forwarded verbatim from the calling
osc_prob(); see its docstring.growth_factor_n_tpts_per_slab (int or float) – Forwarded verbatim from the calling
osc_prob(); see its docstring.max_num_loops (int) – Forwarded verbatim from the calling
osc_prob(); see its docstring.min_n_slabs (int) – Forwarded verbatim from the calling
osc_prob(); see its docstring.max_n_slabs (int) – Forwarded verbatim from the calling
osc_prob(); see its docstring.min_n_tpts_per_slab (int) – Forwarded verbatim from the calling
osc_prob(); see its docstring.max_n_tpts_per_slab (int) – Forwarded verbatim from the calling
osc_prob(); see its docstring.validate_input (bool) – Forwarded verbatim from the calling
osc_prob(); see its docstring.save_log (bool) – Forwarded verbatim from the calling
osc_prob(); see its docstring.filename_log (str) – Forwarded verbatim from the calling
osc_prob(); see its docstring.new_recursion_limit (int, optional) – Forwarded verbatim from the calling
osc_prob(); see its docstring.verbose (int) – Forwarded verbatim from the calling
osc_prob(); see its docstring.file_log (TextIOWrapper, optional) – Forwarded verbatim from the calling
osc_prob(); see its docstring.
- Return type:
None
- magnus.oscprob.validate_input_battery(source_func_name: str, energy: int | float | list | numpy.ndarray | None = None, L: int | float | list | numpy.ndarray | None = None, L0: int | float | None = None, num_flavors: int | None = None, nu_i: int | None = None, nu_f: int | None = None, osc_params: list | numpy.ndarray | None = None, rho_func: Callable | int | float | None = None, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, validate_energy_and_L: bool | None = True, validate_flavor_indices: bool | None = True, validate_osc_params: bool | None = True, validate_initial_position: bool | None = False, validate_density: bool | None = False) None[source]
Validates the inputs common to the
osc_prob_*family of functions.Runs a battery of type/shape/value checks (selected by the
validate_*flags below) and raisesValueErrorwith a descriptive message identifying the offending argument and the calling function (viasource_func_name) if any check fails, rather than letting an invalid input propagate into a cryptic NumPy/linear-algebra error deep inside the Magnus core.Added in version 1.0.0.
- Parameters:
source_func_name (str) – Name of the calling function, used to build more informative error messages.
energy (int, float, list, or np.ndarray, optional) – Neutrino energy/energies to validate (checked if
validate_energy_and_Lis True).L (int, float, list, or np.ndarray, optional) – Baseline(s) to validate (checked if
validate_energy_and_Lis True).L0 (int or float, optional) – Initial position to validate (checked if
validate_initial_positionis True).num_flavors (int, optional) – Number of neutrino flavors, used to validate
nu_i/nu_f/osc_params.nu_i (int, optional) – Initial flavor index to validate (checked if
validate_flavor_indicesis True).nu_f (int, optional) – Final flavor index to validate (checked if
validate_flavor_indicesis True).osc_params (list or np.ndarray, optional) – Unpacked oscillation parameters to validate (checked if
validate_osc_paramsis True).rho_func (Callable, int, or float, optional) – Matter density (function or constant) to validate (checked if
validate_densityis True).ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter, validated alongside the density. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction, validated alongside the density. Default: 0.5.
validate_energy_and_L (bool, optional) – If True, validate
energyandL. Default: True.validate_flavor_indices (bool, optional) – If True, validate
nu_iandnu_fagainstnum_flavors. Default: True.validate_osc_params (bool, optional) – If True, validate
osc_params. Default: True.validate_initial_position (bool, optional) – If True, validate
L0. Default: False.validate_density (bool, optional) – If True, validate
rho_func,ratio_number_neutrons_to_protons, andelectron_fraction. Default: False.
- Return type:
None
- Raises:
ValueError – If any requested check fails. The message names the offending argument and the calling function.
- magnus.oscprob.validate_input_osc_prob_earth(source_func_name: str, loc_ini: Tuple[float, float] | list | numpy.ndarray | str | None = None, loc_fin: Tuple[float, float] | list | numpy.ndarray | str | None = None, costhz: int | float | None = None, L: float | list | numpy.ndarray | None = None, verbose: int | None = 0) Tuple[float, numpy.ndarray][source]
Resolves (costhz, L) for
osc_prob_earth(), from either two locations or costhz+L.Implements the two mutually exclusive ways of specifying an Earth-crossing trajectory: either give both
loc_iniandloc_fin(the chord’s zenith angle and length are computed from their coordinates), or givecosthzandLdirectly. Aborts with a descriptive error if exactly one location is given, or if neither locations nor (costhz, L) are given.Added in version 1.0.0.
- Parameters:
source_func_name (str) – Name of the calling function, used to build more informative error messages.
loc_ini (tuple, list, np.ndarray, or str, optional) – Initial location, as (latitude, longitude) coordinates or a predefined location name (see
magnus.earth.loc_coords_dms). Must be given together withloc_fin.loc_fin (tuple, list, np.ndarray, or str, optional) – Final location, same format as
loc_ini. Must be given together withloc_ini.costhz (int or float, optional) – Cosine of the zenith angle of the neutrino. Used only if
loc_ini/loc_finare not given.L (float, list, or np.ndarray, optional) – Baseline(s). Used only if
loc_ini/loc_finare not given.verbose (int, optional) – Verbosity level: if > 0, print a note when the chord between the two given locations is used as the baseline. Default: 0.
- Returns:
The resolved
(costhz, L)pair.- Return type:
(float, np.ndarray)
- magnus.oscprob.valid_flavor_indices_2nu(nu_i: int, nu_f: int) Tuple[int, int][source]
Remaps 3-flavor-style flavor indices onto valid 2-flavor indices (0 or 1).
Two-flavor wrappers (e.g.
osc_prob_2nu_matter_constant_density()) acceptnu_i/nu_fvalues from the sameNUE/NUMU/NUTAUconstants used by the 3/4/5-flavor wrappers, for interface consistency, even though a two-flavor system only has indices 0 and 1. This remaps the flavor not included in the two-flavor system (whichever of NUE/NUMU/NUTAU is not being used) onto the other valid index, so that, e.g., requesting the nu_e-nu_tau channel of a system parametrized by \(\theta_{13}\) (which is really a nu_e-nu_x system) resolves correctly.Added in version 1.0.0.
- magnus.oscprob.values_to_unspecified_osc_params(s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', verbose: int | None = 0) Tuple[float, float, float, float, float, float][source]
Return values of unspecified standard oscillation parameters
If any of the oscillation parameters has not been given a value, assign to it the value from the specified parameter set with name default_osc_params_set_name. When input validation is on (validate_input == True), the routine checks whether the parameter set name is among the predefined ones (see validation above). Only the values of the parameters passed as None are assigned from the predefined set; other parameters are not modified.
Added in version 1.0.0.
- Parameters:
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\); if None, taken from the predefined set.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\); if None, taken from the predefined set.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\); if None, taken from the predefined set.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]; if None, taken from the predefined set.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\); if None, taken from the predefined set.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\); if None, taken from the predefined set.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set to draw missing values from (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.verbose (int, optional) – Verbosity level. Default: 0.
- Returns:
(s12, s23, s13, dCP, D21, D31), with every previously-None entry filled in from the predefined set.- Return type:
- magnus.oscprob.unpack_oscillation_params_from_dict(source_func_name: str, num_flavors: int, osc_params: Dict, h_vac_energy_indep: list | numpy.ndarray) numpy.ndarray[source]
Unpack oscillation parameters from the osc_params dict
Extracts the standard oscillation parameters for
num_flavorsflavors fromosc_params(as built by eachosc_prob_{N}nu_*wrapper), in the fixed order expected by the matchinghamiltonians.hamiltonian_{N}nu_vacuum_energy_independentfunction. Aborts with a descriptive error if a required key is missing.Added in version 1.0.0.
- Parameters:
source_func_name (str) – Name of the calling function, used to build more informative error messages.
num_flavors (int) – Number of neutrino flavors (2, 3, 4, or 5; or higher, if
h_vac_energy_indepis given).osc_params (dict) – Dictionary of oscillation parameters. For
num_flavors == 2, must contain ‘sth’, ‘Dm2’. For 3, 4, 5, must contain ‘s12’, ‘s23’, ‘s13’, ‘dCP’, ‘D21’, ‘D31’, plus, for 4: ‘s14’, ‘d14’, ‘s24’, ‘d24’, ‘s34’, ‘D41’; and for 5, additionally ‘s15’, ‘d15’, ‘s25’, ‘s34’, ‘s35’, ‘d35’, ‘D51’.h_vac_energy_indep (list or np.ndarray) – Precomputed energy-independent vacuum Hamiltonian, required (and used, instead of
osc_params) whennum_flavorsexceedsglobaldefs.MAGNUS_MAX_PREDEFINED_NUM_FLAVORS.
- Returns:
The unpacked oscillation parameters, in the order expected by the matching
hamiltonian_{N}nu_vacuum_energy_independentfunction.- Return type:
np.ndarray
- magnus.oscprob.unpack_nsi_params_from_dict(source_func_name: str, num_flavors: int, nsi_params: Dict, h_nsi: list | numpy.ndarray) numpy.ndarray[source]
Unpack NSI parameters from the nsi_params dict
Extracts the NSI epsilon parameters for
num_flavorsflavors fromnsi_params(as built by eachosc_prob_{N}nu_*_nsi_*wrapper), in the fixed order expected by the matchinghamiltonians.hamiltonian_{N}nu_nsifunction. Aborts with a descriptive error if a required key is missing.Added in version 1.0.0.
- Parameters:
source_func_name (str) – Name of the calling function, used to build more informative error messages.
num_flavors (int) – Number of neutrino flavors (2, 3, 4, or 5; or higher, if
h_nsiis given).nsi_params (dict) – Dictionary of NSI parameters. For
num_flavors == 2, must contain ‘eps_aa’, ‘eps_ab’. For 3, must contain ‘eps_ee’, ‘eps_em’, ‘eps_et’, ‘eps_mm’, ‘eps_mt’, ‘eps_tt’. For 4, additionally ‘eps_es’, ‘eps_ms’, ‘eps_ts’, ‘eps_ss’. For 5, instead of the sterile-flavor keys above, ‘eps_es1’, ‘eps_es2’, ‘eps_ms1’, ‘eps_ms2’, ‘eps_ts1’, ‘eps_ts2’, ‘eps_s1s1’, ‘eps_s1s2’, ‘eps_s2s2’.h_nsi (list or np.ndarray) – Precomputed NSI Hamiltonian, required when
num_flavorsexceedsglobaldefs.MAGNUS_MAX_PREDEFINED_NUM_FLAVORS(in which case there is nothing to unpack fromnsi_paramsand this function returns None).
- Returns:
The unpacked NSI parameters, in the order expected by the matching
hamiltonian_{N}nu_nsifunction; or None ifnum_flavorsexceedsglobaldefs.MAGNUS_MAX_PREDEFINED_NUM_FLAVORS(the caller usesh_nsidirectly).- Return type:
np.ndarray or None
- magnus.oscprob.unpack_liv_params_from_dict(source_func_name: str, num_flavors: int, liv_params: Dict, h_liv: list | numpy.ndarray) numpy.ndarray[source]
Unpack LIV parameters from the liv_params dict
Extracts the LIV parameters for
num_flavorsflavors fromliv_params(as built by eachosc_prob_{N}nu_*_livwrapper), in the fixed order expected by the matchinghamiltonians.hamiltonian_{N}nu_liv_energy_independentfunction. Validates thatLambdais positive and aborts with a descriptive error if a required key is missing.Added in version 1.0.0.
- Parameters:
source_func_name (str) – Name of the calling function, used to build more informative error messages.
num_flavors (int) – Number of neutrino flavors (2, 3, 4, or 5; or higher, if
h_livis given).liv_params (dict) – Dictionary of LIV parameters. Always must contain ‘Lambda’ (LIV energy scale, must be positive) and ‘n_liv’ (power of the energy dependence). For
num_flavors == 2, must also contain ‘sxi’, ‘b1’, ‘b2’. For 3, ‘sxi12’, ‘sxi23’, ‘sxi13’, ‘dxiCP’, ‘b1’, ‘b2’, ‘b3’. For 4, additionally ‘dxi13’ (replacing ‘dxiCP’), ‘sxi14’, ‘dxi14’, ‘sxi24’, ‘dxi24’, ‘sxi34’, ‘b4’. For 5, additionally ‘sxi15’, ‘dxi15’, ‘sxi25’, ‘sxi35’, ‘dxi35’, ‘b5’.h_liv (list or np.ndarray) – Precomputed LIV Hamiltonian, required when
num_flavorsexceedsglobaldefs.MAGNUS_MAX_PREDEFINED_NUM_FLAVORS(in which case there is nothing to unpack fromliv_paramsand this function returns None).
- Returns:
The unpacked LIV parameters, in the order expected by the matching
hamiltonian_{N}nu_liv_energy_independentfunction; or None ifnum_flavorsexceedsglobaldefs.MAGNUS_MAX_PREDEFINED_NUM_FLAVORS(the caller usesh_livdirectly).- Return type:
np.ndarray or None
- magnus.oscprob.compute_evolution_operator(H_func: Callable, t_slab: list | numpy.ndarray, n_tpts_per_slab: int, magnus_exp_order: int, **kwargs) numpy.ndarray[source]
Computes the evolution operator inside a given time slab. This functions is not designed to be called directly by the user, but rather internally by
osc_prob().Added in version 1.0.0.
- Parameters:
H_func (Callable) – Hamiltonian, a function of time or position that returns a square matrix (NumPy array).
t_slab (list or np.ndarray) – Start and end times or positions of the slab,
[t0, t1].n_tpts_per_slab (int) – Number of time points inside the slab at which to evaluate
H_functo numerically compute the integrals required by the Magnus expansion.magnus_exp_order (int) – Highest order of the Magnus expansion used to compute the evolution operator (should not exceed
globaldefs.MAGNUS_EXP_ORDER_MAX).**kwargs – Additional arguments passed to
magnus.magnus.magnus_expansion()(e.g.,integration_method).
- Returns:
The evolution operator for the given time slab.
- Return type:
np.ndarray
- magnus.oscprob.compute_evolution_operator_multiple_slabs(H_func: Callable, t_slabs: list | numpy.ndarray, n_tpts_per_slab: int, magnus_exp_order: int, symmetric_over: tuple | None = None, **kwargs) numpy.ndarray[source]
Computes the evolution operators of a chain of time slabs. This function is not designed to be called directly by the user, but rather internally by
osc_prob().All slabs are computed at once by
magnus.magnus.magnus_expansion_multislab(), which batches the Hamiltonian evaluation, the quadrature, the commutator algebra, and the matrix exponentials over the slab axis. Slabs of zero width yield identity operators.Added in version 1.0.0.
- Parameters:
H_func (Callable) – Hamiltonian, a function of time or position that returns a square matrix (NumPy array). If it also accepts an array of times (returning a stack of matrices), the vectorized form is detected and used automatically for speed.
t_slabs (list or np.ndarray) – Pairs specifying the start and end times or positions of each slab, i.e.,
[[t0, t1], [t1, t2], ...].n_tpts_per_slab (int) – Number of time points inside each slab at which to evaluate
H_functo numerically compute the integrals required by the Magnus expansion (ignored by the ‘gl’ integration method).magnus_exp_order (int) – Highest order of the Magnus expansion used to compute the evolution operator (should not exceed
globaldefs.MAGNUS_EXP_ORDER_MAX).symmetric_over (tuple, optional) – Forwarded to
magnus.magnus.magnus_expansion_multislab(): the interval over which the caller declaresH_functo be mirror-symmetric. Not a user-facing parameter – see that function, anddocs/dev/PLAN_PALINDROMIC_PROFILES.mdsection 3d(ii), for why it is a declaration rather than something detected here.**kwargs – Additional arguments passed to
magnus.magnus.magnus_expansion_multislab()(e.g.,integration_method).
- Returns:
Evolution operators, shape (n_slabs, dim, dim), ordered like
t_slabs(earliest slab first). Note that the time-ordered product over the chain isU_total = U[-1] @ ... @ U[1] @ U[0], i.e., the last slab is the leftmost factor.- Return type:
np.ndarray
- magnus.oscprob.osc_prob(H_func: Callable | numpy.ndarray, t_ini: int | float, t_fin: int | float, n_slabs: int | None = 1, n_tpts_per_slab: int | None = 100, t_slab_edges: list | numpy.ndarray | None = None, magnus_exp_order: int | None = 4, n_jobs: int | None = 1, integration_method: str | None = 'gl', rtol: int | float | None = 0.001, atol: int | float | None = 0.001, growth_factor_n_slabs: int | float | None = 1.5, growth_factor_n_tpts_per_slab: int | float | None = 1.5, max_num_loops: int | None = 50, min_n_slabs: int | None = 1, max_n_slabs: int | None = None, min_n_tpts_per_slab: int | None = 2, max_n_tpts_per_slab: int | None = 500, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, new_recursion_limit: int | None = 5000, verbose: int | None = 0, A_eval_mode: str | None = None, convergence_info: Dict | None = None, t_breakpoints: list | numpy.ndarray | None = None, strict_convergence: bool | None = False, symmetric_over: tuple | None = None, **kwargs) numpy.ndarray[source]
Computes and returns the neutrino oscillation probability.
Computes the oscillation probability of neutrinos starting at time (or position)
t_iniand ending at time (or position)t_fin.Added in version 1.0.0.
- Parameters:
H_func (Callable or np.ndarray) – The Hamiltonian, which is a function of time or position that returns a square matrix (a NumPy array). The Hamiltonian can have complex-valued entries.
t_ini (int or float) – Initial time or position of the neutrino.
t_fin (int or float) – Final time or position of the neutrino.
n_slabs (int, optional) –
Number of slabs, or subintervals, into which the interval [
t_ini,t_fin] is partitioned in order to compute the neutrino evolution operators. A higher value ofn_slabsyields a more accurate probability.If no target tolerance is requested (i.e., if
rtolandatolare bothNone), then the given value ofn_slabsis the final number of slabs used in the computation.If a target tolerance is requested (i.e., if either
rtoloratolis notNone), then the given value ofn_slabsacts as a floor: the number of slabs is increased progressively, starting frommax(min_n_slabs, n_slabs), until the tolerance is achieved or until we hitmax_n_slabs, whichever happens first. The refinement never runs coarser than what was asked for, so a caller who knows the feature scale of their profile can state it here and have it respected. With the default,n_slabs = 1, the floor is inactive and refinement starts atmin_n_slabsas before.n_tpts_per_slab (int, optional) – Number of time-points inside the slab at which to evaluate H_func in order to numerically compute the integrals over time required by the Magnus expansion. A higher value of
n_tpts_per_slabyields a more accurate probability.t_slab_edges (list or np.ndarray, optional) – Optional list of pairs [[t0, t1], [t1, t2], …] with the edges of each time slab. If given, it overrides
n_slabsand the uniform partitioning of [t_ini,t_fin]; the user must ensure that the slabs chain without gaps. If a tolerance is requested, onlyn_tpts_per_slabis grown (the user-provided edges are kept fixed).magnus_exp_order (int, optional) – Order at which the Magnus expansion is truncated (1 to
globaldefs.MAGNUS_EXP_ORDER_MAX).n_jobs (int, optional) – Number of parallel joblib workers used to compute the per-slab evolution operators. With the default,
n_jobs = 1, all slabs are computed in a single vectorized (batched) call, which is usually fastest; usen_jobs > 1only for very expensive Hamiltonian functions.integration_method (str, optional) – ‘gl’ for Gauss-Legendre collocation, which needs only 1, 2, or 3 Hamiltonian evaluations per slab for orders <= 2, <= 4, <= 6, and ignores
n_tpts_per_slab; or ‘trapezoid’/’simpson’ for cumulative quadrature overn_tpts_per_slabpoints per slab. Default: ‘gl’.rtol (int or float, optional) –
Relative tolerance on the agreement between successive refinement loops. Set both
rtolandatoltoNoneto run once with the given fixed parameters. If only one of the two isNone, it is treated as 0.This is a stopping criterion, not an accuracy guarantee, and the distinction is not pedantic. The ladder stops when two successive levels agree to within
atol + rtol*|P|; it never estimates the error of the answer it returns. A stepping ODE integrator’srtolis a different thing: it controls an estimated local error per step. Nothing here is estimated.Usually the criterion is conservative – for a converging sequence the level-to-level gap overstates the error of the finer level, so an answer that stopped at 1e-3 is typically better than 1e-3. But agreement is evidence of convergence, not proof of it: on a sequence that is still jumping around, two levels can agree by coincidence while both are far from the truth. Measured on a sawtooth density, levels at 3 and 4 slabs agreed and the returned answer was wrong by 0.855 in probability.
strict_convergenceexists for that case and requires two consecutive agreements instead of one.If you need to know how far the last two levels actually were apart, pass
convergence_infoand readlast_gapfrom it; see that parameter for what the number does and does not mean.atol (int or float, optional) – Absolute tolerance on the same agreement; see
rtol.growth_factor_n_slabs (int or float, optional) – Factor by which
n_slabsis multiplied on each refinement loop (used only when a tolerance is requested).growth_factor_n_tpts_per_slab (int or float, optional) – Factor by which
n_tpts_per_slabis multiplied on each refinement loop (used only when a tolerance is requested).max_num_loops (int, optional) – Maximum number of refinement loops.
min_n_slabs (int, optional) – Number of slabs used in the first refinement loop.
max_n_slabs (int, optional) – Maximum allowed number of slabs. If None (default), a cap appropriate to
integration_methodis used: 20000 for ‘gl’, 2000 for the cumulative-quadrature methods (seeMAX_N_SLABS_DEFAULT). ‘gl’ costs 1-3 Hamiltonian evaluations per slab against the quadrature methods’n_tpts_per_slab, so the same cost budget buys it far more slabs. An explicit value is always used as given.min_n_tpts_per_slab (int, optional) – Number of time points per slab in the first refinement loop.
max_n_tpts_per_slab (int, optional) – Maximum allowed number of time points per slab.
validate_input (bool, optional) – If True, validate the input parameters (set to False for a small speed-up once a call is known to be well-formed).
save_log (bool, optional) – If True, also write all messages to the log file.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given).file_log (TextIOWrapper, optional) – Optional file object to write log messages to.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning.
new_recursion_limit (int, optional) – If not None, raise Python’s recursion limit to this value.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops).
A_eval_mode (str, optional) – How the Hamiltonian can be evaluated: ‘vector’ (accepts an array of positions), ‘constant’, or ‘scalar’. Determined automatically when None; pass it explicitly (e.g., from
magnus.magnus.probe_eval_mode()) to skip the probe.convergence_info (Dict, optional) –
If a dict is passed, it is filled in place with what the refinement ladder actually did. Callers use it to warm-start neighboring computations, and to see how the answer was arrived at.
It carries facts, never an estimate of the error, and no key in it is an accuracy bound. Keys:
'n_slabs','n_tpts_per_slab'– the level returned.'n_slab_edges'– slabs actually used, which is larger thann_slabswhenevert_breakpointsinserted edges.'n_slabs_previous','n_tpts_per_slab_previous','n_slab_edges_previous'– the level compared against, or None if no second level was ever computed.'last_gap'–max|P - P_old|between those two levels, or None if only one level was ever computed (which happens whenever the seed already sits atmax_n_slabs).'n_agreements'– consecutive agreements at the point of return.'tolerance_achieved'– True if the ladder stopped because it agreed, False if it ran out of room, None if no tolerance was asked for. The programmatic form ofToleranceNotAchievedWarning.
``last_gap`` is not the error, and can be far smaller than it. It is the distance between the last two levels. Two failure modes are measured and neither is rare. A sequence still jumping around can put two levels close together by coincidence – on a sawtooth density the 3- and 4-slab levels agreed while the answer was wrong by 0.855. And on a breakpoint-dominated grid the gap measures the refinement step rather than the error, because inserting the same fixed edges at every level makes an apparent 2 -> 3 slab step a 16 -> 17 edge one: measured on plain PREM chords at
rtol=atol=1e-4, the ladder stopped with gaps of 1.9e-5 and 5.0e-5 while the true errors were 8.5e-4 and 8.3e-4. Comparen_slab_edgesagainstn_slab_edges_previousto see how little a step actually was.There is deliberately no key holding an error estimate. Converting the gap into one by Richardson extrapolation is what the sibling NuOscProbExact does, and it is sound there because its per-slab solver is exact: one error mechanism, a guaranteed order, an exact refinement ratio and nested grids. Magnus has four interacting error sources (Magnus truncation, slab count, quadrature, breakpoint-perturbed non-nested grids) and no stable convergence order – fitted on Earth chords it scatters from 1.4 to 7.2 against nominal orders of 2 and 4. Every extrapolation tried under-reported the true error on a large fraction of real refinement pairs, which is the dangerous direction. See
docs/source/implementation_details.rst.t_breakpoints (list or np.ndarray, optional) – Optional positions at which the Hamiltonian is known to be non-smooth (e.g., density discontinuities such as the PREM layer boundaries). They are inserted as mandatory slab edges into the automatically generated slab grid at every refinement level, so that the quadrature never integrates across them. Ignored when
t_slab_edgesis given explicitly.symmetric_over (tuple, optional) –
Caller’s declaration that
H_func(t) == H_func(lo + hi - t)on(lo, hi). When the slab chain is found to span exactly that interval, the Magnus core evaluatesH_funcon its first half only and mirrors the rest, halving the Hamiltonian evaluations.Passed as the interval, not as a flag, and that is what makes it safe in a scan: a chord through the Earth is symmetric over its full length and over no shorter prefix, so a scan point at a shorter baseline spans
(L0, baseline), fails to match, and takes the ordinary path. No extra bookkeeping is needed for that – the check inmagnus.magnus._mirror_appliesis the whole of it.Not a user-facing switch, and unchecked: verifying it would need the evaluations it exists to avoid, and declaring it of a profile that is not symmetric returns a silently wrong answer. It is set by the Earth entry points, where the symmetry is a fact of chord geometry – a chord meets every radius twice – rather than a claim. Turn the mechanism off globally with
magnus.magnus.USE_PALINDROME = False.strict_convergence (bool, optional) –
Require the refinement ladder to agree twice in a row before declaring convergence, instead of once. Default: False.
What the ladder normally does. With a tolerance requested,
osc_probcomputes the probability on a grid ofn_slabsslabs, then again on a finer one (n_slabsgrows bygrowth_factor_n_slabseach time), and returns as soon as two successive grids agree withinrtol/atol. The assumption is that agreement between successive refinements means the answer has stopped changing because it has converged.When that assumption fails. It is only safe while the sequence is settling down. If the grid is still too coarse to resolve the Hamiltonian, successive refinements do not approach the answer smoothly – they jump around it – and two neighboring jumps can land close together by coincidence.
np.allclosecannot tell that apart from convergence, so the ladder stops early and returns a plausible, exactly unitary, wrong answer with no warning. Measured example (2 flavors, solar exponential profile, 10 MeV over one solar radius, defaultrtol=atol=1e-3): the errors at successive levels run 5.9e-02, 3.8e-03, 1.6e-02, 1.7e-02, 8.1e-03, 4.5e-03, 3.5e-06. Levels 3 and 4 agree to 1.1e-03 – inside the requested tolerance – while both are wrong by ~1.6e-02, and the next level moves by 2.5e-02.What this flag changes. Convergence is declared only after two consecutive agreements, so a lone coincidence is vetoed by the level that follows it. On the example above the ladder continues to
n_slabs = 20000and an error of 6.8e-08.What it costs. One extra refinement level, each costing about
growth_factor_n_slabstimes the last: measured median 1.53x (worst 1.75x) on calls whose first agreement was already genuine. On calls this actually rescues it costs 3.5-8.6x, because there the second agreement is several levels away – that cost is paid only where the answer would otherwise have been wrong.When you do not need it. If the quantity you care about is an average over many oscillations – the usual case for solar neutrinos, where the survival probability oscillates thousands of times along the trajectory – most of the error this guards against is in the phase and cancels in the average. On the 10 MeV example the pointwise error of 2.5e-02 becomes 1.9e-04 once averaged over 25 oscillations. Prefer
average=Trueon the wrapper functions (seeosc_prob_matter_std_potential()), which computes the phase-averaged probability directly and far more cheaply. Usestrict_convergencewhen the oscillating probability itself is the answer you want – a probability-versus- baseline or versus-energy curve, an oscillogram, or a fixed baseline and energy.What it does not fix. A refinement ladder of any strictness is powerless against an incomplete
t_breakpointslist. If the Hamiltonian is discontinuous somewhere that is not marked as a slab edge, every level integrates across that discontinuity, successive levels can agree to machine precision, and the shared answer is simply wrong. Measured on a 50-wall piecewise-constant profile whose first boundary was left unmarked: the error sat at 1.6e-02, bit-identical fromn_slabs = 4through 32, and adding the one missing edge moved it to 3.6e-12 at every slab count. When a profile is discontinuous, marking every discontinuity – including where it switches on and off, which may lie inside the trajectory – is worth more than any amount of refinement.**kwargs – Additional arguments passed through to the Magnus-expansion routines
- Returns:
NumPy array containing the probability matrix of the same dimensions as the Hamiltonian,
H_func.- Return type:
np.ndarray
- magnus.oscprob.PARAMETER_SET_METADATA_KEYS = ('name', 'description')[source]
Module-level constant
Keys carried by the entries of
magnus.globaldefs.OSC_PARAMS_PREDEFINEDthat label the parameter set rather than parameterize the physics.They are the reason
**OSC_PARAMS_PREDEFINED['OSC_PARAMS_DEFAULT']cannot be splatted into a probability function: the two strings travel down the shared**kwargschain and are rejected at the far end bymagnus_expansion_multislab, whose complaint names neither the caller nor the parameter set it came from.magnus.globaldefs.load_nufit_params()returns the same numbers without them.Added in version 1.0.0.
- Type:
- magnus.oscprob.ENGINE_FAMILIES[source]
Module-level constant
Which engines share machinery, and therefore which pairwise comparisons in
cross_check_strategies()carry information. Two engines in the same family can be wrong in the same way at the same time, so their agreement is not evidence; two in different families fail for different reasons.'adiabatic'–magnus.adiabatic.hybrid_propagator(): transport in the instantaneous eigenbasis, with Magnus patches only inside non-adiabatic windows. Its blind spots are the detector’s (a feature narrower than the probe grid, a profile the resolution test rejects).'magnus-ladder'– the general per-point path, the cumulative baseline scan, and the energy-batched separable scan. All three walk slabs withmagnus.magnus.magnus_expansion_multislab(), and the cumulative scan additionally sizes its grid from an ordinary adaptiveosc_prob()probe, so it inherits that path’s stopping rule as well. Grouping them is deliberate: the accuracy step atHYBRID_YIELDS_TO_CUMULATIVE_MIN_POINTSshows they are not interchangeable, but a quadrature that cannot see a feature will not see it on any of the three grids.'interaction-picture'– the 2-flavour exponential-profile fast path. It uses the same Magnus core, but factors the fast vacuum phase out analytically first, so what it must resolve is a different function; it is kept separate for that reason and not because the core differs.'exact'–scipy.linalg.expm, used only where it is the exact answer rather than an approximation (seecross_check_strategies()).'phase-average'–magnus.avgprob’s closed form, which answers a different question and is never compared against the others.
A known limit of the ``’magnus-ladder’`` grouping. It is right about blind spots – all three walk slabs, and all three miss a feature narrower than their grids – but it understates how differently they perform. Measured over 28 shared workloads, the cumulative scan’s worst error is 1.13e-07 against the general ladder’s 9.28e-03 (
docs/dev/adversarial_batteries/fallback_quality.py), which is what movedHYBRID_YIELDS_TO_CUMULATIVE_MIN_POINTSfrom 25 to 8. So a disagreement between them carries real information even though this grouping tellscross_check_strategies()to discount it. Erring this way is deliberate: treating them as independent would let two engines that share a blind spot vouch for each other, which is the failure this constant exists to prevent.Added in version 1.0.0.
- Type:
- magnus.oscprob.osc_prob_energy_baseline(H_func: Callable | numpy.ndarray, energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, L0: int | float | None = 0.0, nu_i: int | None = None, nu_f: int | None = None, H_func_is_function_only_of_energy: bool | None = False, t_slab_edges: list | numpy.ndarray | None = None, magnus_exp_order: int | None = 4, n_jobs: int | None = 1, integration_method: str | None = 'gl', rtol: int | float | None = 0.001, atol: int | float | None = 0.001, growth_factor_n_slabs: int | float | None = 1.5, growth_factor_n_tpts_per_slab: int | float | None = 1.5, max_num_loops: int | None = 50, min_n_slabs: int | None = 1, max_n_slabs: int | None = None, min_n_tpts_per_slab: int | None = 2, max_n_tpts_per_slab: int | None = 500, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, new_recursion_limit: int | None = 5000, verbose: int | None = 0, cumulative: bool | str | None = 'auto', symmetric_over: tuple | None = None, **kwargs) int | float | numpy.ndarray[source]
Compute and return oscillation probabilities for given arrays of neutrino energy and baseline, and an arbitrary Hamiltonian.
Sits directly above
osc_prob()in the primordial layer (see Code Architecture): given arrays ofenergyandL, builds the right energy-dependent closure overH_func, decides whether to parallelize over (energy, L) points or hand a single call straight toosc_prob(), and carries the warm start logic that seeds each point’s refinement from the previous point’s converged (n_slabs,n_tpts_per_slab). Called directly byosc_prob_vacuum(),osc_prob_matter_std_potential(),osc_prob_matter_nsi(), andosc_prob_liv().Added in version 1.0.0.
- Parameters:
H_func (Callable or np.ndarray) – The Hamiltonian: a function of energy only, of position only, of both (in that parameter order), or a constant matrix.
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
L (int, float, list, or np.ndarray) – Baseline(s). Must have the same length as
energy, or either may be a single value broadcast against the other.L0 (int or float, optional) – Initial position. Default: 0.0.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix.nu_f (int, optional) – Final flavor index; see
nu_i.H_func_is_function_only_of_energy (bool, optional) – If True and
H_funcaccepts a single argument, treat it as energy-only (returning a constant matrix per energy) rather than position-only. Default: False.t_slab_edges (list or np.ndarray, optional) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.magnus_exp_order (int) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.n_jobs (int) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.integration_method (str) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.rtol (int or float, optional) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.atol (int or float, optional) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.growth_factor_n_slabs (int or float) –
Forwarded to
osc_prob()for each (energy, L) point; see its docstring.Provenance. Swept over 1.2, 1.5, 2.0, 3.0 across 18 workloads spanning single points, baseline scans and energy scans (
docs/dev/adversarial_batteries/constants_audit2.py): worst error 4.49e-04 at every value. It sets how coarsely the ladder is sampled, not where it stops, so it trades wasted refinement against overshoot without moving the accepted answer.growth_factor_n_tpts_per_slab (int or float) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.max_num_loops (int) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.min_n_slabs (int) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.max_n_slabs (int) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.min_n_tpts_per_slab (int) –
Forwarded to
osc_prob()for each (energy, L) point; see its docstring.Provenance. Swept over 2, 4, 8 on the same 18 workloads: worst error 4.49e-04 at every value. With the default
integration_method='gl'this is expected – Gauss-Legendre pins the node count per slab and ignores it – so the sweep confirms the documented behaviour rather than calibrating anything.max_n_tpts_per_slab (int) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.validate_input (bool) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.save_log (bool) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.filename_log (str) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.file_log (TextIOWrapper, optional) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.close_file_log_upon_exit (bool) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.new_recursion_limit (int, optional) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.verbose (int) – Forwarded to
osc_prob()for each (energy, L) point; see its docstring.cumulative (bool or str, optional) –
Compute a whole baseline scan from one traversal of the profile instead of one traversal per baseline. The evolution operator is a time-ordered product, so \(U(0 \to L_2) = U(L_1 \to L_2)\,U(0 \to L_1)\): each requested answer is a prefix of the next, and recording the running product yields all of them at once. One of:
'auto'(default) – use the cumulative scan whenever the request fits it, and the ordinary per-point path otherwise. The request fits when the Hamiltonian varies with position, all the energies are equal, not_slab_edgeswere given, every baseline is at or beyondL0, and there are at leastCUMULATIVE_AUTO_MIN_POINTSof them. A position-independent Hamiltonian (vacuum, constant density) is excluded becauseosc_prob()integrates it exactly on a single slab, leaving no traversal to share.True– require it, and raise if the request does not fit. Use this when the cumulative scan is what you want and silently getting the per-point path instead would be a problem.False– never use it.
Applies to a baseline scan at a single energy. The nesting it exploits belongs to the baseline axis alone – \(P(E_1)\) shares nothing with \(P(E_2)\), since each energy needs its own propagation through the whole profile – so there is no energy-axis counterpart to this.
Not compatible with
t_slab_edges, which it would have to override: the scan builds a grid that is the union of the requested baselines, an accuracy grid, and anyt_breakpoints. The accuracy grid is sized by one ordinary adaptiveosc_prob()call at the longest baseline, so the usual tolerance machinery and its warnings apply unchanged.The default became
'auto'in 1.0.0, having beenFalse, because the cumulative scan measured more accurate at every scan size tested, not merely faster. Againstsolve_ivpon a 5 MeV solar scan to one solar radius, the per-point path it replaces returns answers outside the requested 1e-3 at several sizes – 9.7e-3 at N = 10, 5.6e-3 at N = 25, 2.6e-3 at N = 100 – where the cumulative scan stays near 5e-6 throughout. Speed follows from N ~ 25 upward (2.65x there, 84x at N = 1000); below it the cumulative scan can be ~1.3x slower in wall time, which is a few milliseconds.Because the two paths build different grids, results move – within the requested tolerance, and generally toward the truth. Pass
strategy='magnus'to reproduce pre-1.0.0 numbers exactly: it opts out of the adiabatic strategy and already impliescumulative=False.cumulative=Falseis the narrower flag and guarantees only that the cumulative scan is not used; the hybrid path is still free to answer, at any point count. It was briefly equivalent tostrategy='magnus'above the seam, but only because the hybrid dispatcher stood aside there for an engine the caller had switched off – which sent the request to the general ladder and cost 256x accuracy (1.157e-05 -> 2.966e-03 on a tagged exponential at d = 2, 10 MeV, crossing N = 7 to N = 8). Below the seam the two flags already differed. Seetests/test_engines.test_hybrid_does_not_stand_aside_for_a_disabled_engine.**kwargs – Additional arguments forwarded to
osc_prob().
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point; a single value/matrix if bothenergyandLwere floats.- Return type:
- magnus.oscprob.cross_check_strategies(entry_point: Callable, *args, engines=None, **kwargs) Dict[source]
Answer the same request with every engine that applies, and report how far apart they are.
Why this exists. Every silently-wrong result found in
docs/dev/FINDINGS_ADVERSARIAL_VALIDATION.mdcame from a method certifying itself by comparing itself with itself.magnus.adiabatic.hybrid_propagator()refines its own knobs and checks the two answers agree;osc_prob()’s slab ladder does the same. When the method has a blind spot, both sides of the comparison share it and the agreement carries no information – that is not a bug in either comparison, it is a limit of the shape of the check. This package contains genuinely different engines (seeENGINE_FAMILIES), and running two of them needs no oracle at all while detecting exactly the class that self-certification cannot.This is a diagnostic, not a safety net. It is never on by default: it multiplies the cost of a call by the number of engines that apply. A large spread is reported, never raised – what it means depends on the request, and deciding that is the caller’s job.
Acceptance. Measured by running the same comparison against the pre-fix package (a worktree at
978663a), on every construction ofFINDINGS§3 that was silently wrong and reportedcertified=Truethere – because a diagnostic validated only against code with no known defects has not been validated. Reproduce withdocs/dev/adversarial_batteries/crosscheck_acceptance.py:construction
silent error
max cross-family spread
step function, unmarked edge (§3.1)
5.395e-01
5.399e-01
ten crossings (§3.2, worst found anywhere)
3.907e-02
3.913e-02
sinusoid at span/7 (§3.2)
1.672e-02
1.687e-02
kink, \(C^0\) but not \(C^1\)
1.448e-02
1.448e-02
singularity approached, not reached
8.625e-03
8.613e-03
sub-threshold bump, w = 1e-2 span (§3.2)
7.701e-03
7.768e-03
sub-threshold bump, w = 3e-2 span (§3.2)
4.388e-03
4.594e-03
narrow bump, w = 3e-5 span (§3.3)
2.907e-02
3.5e-14 – not detected
Seven of eight, each at least four times the requested 1e-3. The last row is the honest limit, and is why this table is here rather than a claim of coverage: a feature narrower than the probe spacing is invisible to every engine that samples the profile on a grid, so they agree – correctly, given what they can see – and are wrong together. No cross-check between grid-based methods can find that; the cure is
t_breakpointsat the feature (see Adiabatic + Magnus Hybrid Strategy). Stated as a rule: this sees a wrong engine exactly when some other engine got it right.Added in version 1.0.0.
- Parameters:
entry_point (Callable) – The function to cross-check:
osc_prob_matter_std_potential(),osc_prob_matter_nsi(),osc_prob_liv(),osc_prob_sun(),osc_prob_earth(), one of their fixed-flavour wrappers, orosc_prob_energy_baseline().strategyandcumulativeare supplied by this function and dropped fromkwargsif the caller passed them, since forcing them is how each engine is reached.*args – Positional arguments for
entry_point, exactly as in an ordinary call.engines (sequence of str, optional) – Restrict the check to these engines; see
ENGINE_FAMILIESfor the labels. Default: every engine that applies.**kwargs – Keyword arguments for
entry_point, exactly as in an ordinary call.
- Returns:
'answers'{label: probabilities}for each engine that answered.'ran'The labels that answered, in the order tried.
'declined'{label: reason}for each engine that did not. Most engines decline on most requests, which is expected and not a finding.'spread'{(label_a, label_b): max |P_a - P_b|}over every pair that ran.'max_spread','max_spread_pair'The largest spread and where it was.
'max_spread_independent','max_spread_independent_pair'The same, restricted to pairs from different families (see
ENGINE_FAMILIES). This is the number to read: two engines from the same family can be wrong in the same way, so their disagreement is informative but their agreement is not.'families'{label: family}for the engines that ran.'warnings'{label: [warning class names]}raised while that engine answered.'certified'{label: bool}, currently only for'hybrid'.
- Return type:
Examples
import magnus.globaldefs as gd import magnus.matter as matter import magnus.oscprob as oscprob ne = matter.exp_density_profile(gd.NUM_DENSITY_E_SUN_CENTRAL, gd.L_SCALE_SUN) params = gd.OSC_PARAMS_PREDEFINED['OSC_PARAMS_DEFAULT'] out = oscprob.cross_check_strategies( oscprob.osc_prob_matter_std_potential, 2, ne, 10.0e6, 0.5*gd.SUN_RADIUS*gd.UNIT_KM, {'sth': params['s12'], 'Dm2': params['D21']}, L0=0.0, density_is_of_number_of_electrons=True) print('engines that ran :', sorted(out['ran'])) print('worst independent gap : %.2e' % out['max_spread_independent'])
engines that ran : ['cumulative', 'hybrid', 'ip_exp', 'magnus'] worst independent gap : 2.92e-04
See also
ENGINE_FAMILIESwhich engines share machinery, and therefore which pairs carry information.
- magnus.oscprob.osc_prob_vacuum(num_flavors: int, energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, osc_params: Dict, h_vac_energy_indep: list | numpy.ndarray = None, average: bool | None = False, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', t_slab_edges: list | numpy.ndarray | None = None, magnus_exp_order: int | None = 4, n_jobs: int | None = 1, integration_method: str | None = 'gl', rtol: int | float | None = 0.001, atol: int | float | None = 0.001, growth_factor_n_slabs: int | float | None = 1.5, growth_factor_n_tpts_per_slab: int | float | None = 1.5, max_num_loops: int | None = 50, min_n_slabs: int | None = 1, max_n_slabs: int | None = None, min_n_tpts_per_slab: int | None = 2, max_n_tpts_per_slab: int | None = 500, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Computes and returns neutrino oscillation probabilities for oscillations in vacuum
Middle (scenario) layer for the vacuum case, generic in
num_flavors: unpacksosc_params, builds the energy-independent vacuum Hamiltonian viahamiltonians.hamiltonian_{num_flavors}nu_vacuum_energy_independent, and callsosc_prob_energy_baseline(). Called byosc_prob_2nu_vacuum(),osc_prob_3nu_vacuum(),osc_prob_4nu_vacuum(), andosc_prob_5nu_vacuum().Added in version 1.0.0.
- Parameters:
num_flavors (int) – Number of neutrino flavors (2, 3, 4, or 5; or higher, if
h_vac_energy_indepis given).energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
osc_params (dict) – Oscillation parameters; see
unpack_oscillation_params_from_dict()for the required keys for eachnum_flavors.h_vac_energy_indep (list or np.ndarray, optional) – Precomputed energy-independent vacuum Hamiltonian, used instead of
osc_paramswhennum_flavorsexceedsglobaldefs.MAGNUS_MAX_PREDEFINED_NUM_FLAVORS.nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix.nu_f (int, optional) – Final flavor index; see
nu_i.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any parameter left as None in
osc_params. Default: ‘OSC_PARAMS_DEFAULT’.t_slab_edges (list or np.ndarray, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.magnus_exp_order (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.n_jobs (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.integration_method (str) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.rtol (int or float, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.atol (int or float, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.growth_factor_n_slabs (int or float) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.growth_factor_n_tpts_per_slab (int or float) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.max_num_loops (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.min_n_slabs (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.max_n_slabs (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.min_n_tpts_per_slab (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.max_n_tpts_per_slab (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.validate_input (bool) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.save_log (bool) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.filename_log (str) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.file_log (TextIOWrapper, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.close_file_log_upon_exit (bool) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.verbose (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.**kwargs – Additional arguments forwarded to
osc_prob_energy_baseline().
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_matter_std_potential(num_flavors: int, rho_func: Callable | int | float, energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, osc_params: Dict, L0: int | float | None = 0.0, h_vac_energy_indep: list | numpy.ndarray = None, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', average: bool | None = False, strategy: str | None = 'auto', strategy_info: Dict | None = None, t_slab_edges: list | numpy.ndarray | None = None, magnus_exp_order: int | None = 4, n_jobs: int | None = 1, integration_method: str | None = 'gl', rtol: int | float | None = 0.001, atol: int | float | None = 0.001, growth_factor_n_slabs: int | float | None = 1.5, growth_factor_n_tpts_per_slab: int | float | None = 1.5, max_num_loops: int | None = 50, min_n_slabs: int | None = 1, max_n_slabs: int | None = None, min_n_tpts_per_slab: int | None = 2, max_n_tpts_per_slab: int | None = 500, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, new_recursion_limit: int | None = 5000, symmetric_over: tuple | None = None, **kwargs) float | numpy.ndarray[source]
Computes and returns neutrino oscillation probabilities for standard oscillations in matter, i.e., the matter potential is only due to the coherent forward scattering of nu_e on electrons.
Middle (scenario) layer for the standard-matter case, generic in
num_flavors: unpacksosc_params, builds the vacuum + matter Hamiltonian (viahamiltonians.hamiltonian_{num_flavors}nu_vacuum_energy_independentandhamiltonian_{num_flavors}nu_matter_td, with the potential frommagnus.matter.vcc_func_from_rho_func()), and callsosc_prob_energy_baseline(). Called by everyosc_prob_{2,3,4,5}nu_matter_{constant,exp}_densityandosc_prob_{2,3,4,5}nu_earth/osc_prob_{2,3,4,5}nu_sunwrapper.Added in version 1.0.0.
- Parameters:
num_flavors (int) – Number of neutrino flavors (2, 3, 4, or 5; or higher, if
h_vac_energy_indepis given).rho_func (Callable, int, or float) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True), either as a function of position or as a constant.energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
osc_params (dict) – Oscillation parameters; see
unpack_oscillation_params_from_dict().L0 (int or float, optional) – Initial position. Default: 0.0.
h_vac_energy_indep (list or np.ndarray, optional) – Precomputed energy-independent vacuum Hamiltonian, used instead of
osc_paramswhennum_flavorsexceedsglobaldefs.MAGNUS_MAX_PREDEFINED_NUM_FLAVORS.ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos (flips the sign of the matter potential). Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix.nu_f (int, optional) – Final flavor index; see
nu_i.density_matter_is_in_g_per_cm3 (bool, optional) – If True,
rho_funcreturns the density in \(\text{g cm}^{-3}\). Default: False.density_is_of_number_of_electrons (bool, optional) – If True,
rho_funcdirectly returns the electron number density [\(\text{eV}^{3}\)]. Default: False.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any parameter left as None in
osc_params. Default: ‘OSC_PARAMS_DEFAULT’.strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’.
'magnus'uses only the traditional Magnus-expansion machinery (the closed-form two-flavor interaction-picture integrator when it applies, the energy-batched scan engine, or the general adaptive slab-refinement method) – this reproduces the exact behavior of Magνs as it was before the adiabatic strategy was added, unconditionally. It therefore also opts out of the cumulative baseline scan, which postdates that behavior: passstrategy='magnus'to reproduce older numbers exactly, on a baseline scan as well as at a single point.'hybrid'additionally triesmagnus.adiabatic.hybrid_propagator()(adiabatic transport, with a Magnus patch at any non-adiabatic window; see Adiabatic + Magnus Hybrid Strategy) for any requested (energy, L) point whererho_funcis position-dependent and not_slab_edges/breakpoints are given, and a target tolerance (rtol/atol) is requested. If it fails to self-certify for at least one point, the best-effort result is still returned, together withHybridCertificationWarning.'auto'tries the hybrid strategy first, under the same conditions, but falls back silently to the'magnus'strategies above (no warning about the hybrid attempt itself) for any point where it does not apply or fails to self-certify. It also stands aside for a baseline scan at a single energy of at leastHYBRID_YIELDS_TO_CUMULATIVE_MIN_POINTSpoints, which the cumulative scan (seecumulativeinosc_prob_energy_baseline()) answers from one traversal instead of one hybrid call per point – measured on solar profiles as tens of times faster at equal or better accuracy.
The hybrid strategy is the natural tool exactly where the plain Magnus refinement needs very many slabs (an extreme accumulated phase, e.g., low-energy solar neutrinos crossing an MSW resonance), and applies to any number of flavors and to genuinely complex Hamiltonians; see Adiabatic + Magnus Hybrid Strategy for the full derivation, validation, and performance comparison. Default: ‘auto’.
Warning
If your profile has a feature much narrower than the trajectory, say where it is. The hybrid strategy locates resonances by sampling
n_probepoints (200, refined to at most 6400), and the general Magnus path seeds its grid from an integral along the path; neither can see a feature that falls between samples, and no refinement of either finds it, because refinement never puts a point inside it. Measured on a Gaussian resonance of width \(10^{-5}\) of the trajectory, the returned probability was wrong by 2.9e-02 against a requested 1e-3 – on the hybrid path, the general path, and the cumulative scan alike.It is no longer silent:
magnus.adiabatic.find_hidden_features()scans the profile itself, once per call, and raisesHiddenFeatureWarningnaming the position and thet_breakpointsto pass. It reaches this class precisely because it looks at the profile rather than at the answers, which is what no comparison between engines can do when they are all wrong together. Detection is 68-90 % over the unresolvable band with 0 false positives on 67 smooth profiles, so it is a report – not a guarantee, and not a cure.Passing
t_breakpointsat the feature fixes it, and is tested: the same case goes to 8.8e-04 at a single point and 8.9e-04 over a 60-point scan. It is the right tool twice over, since an edge placed on a sharp feature also stops a slab straddling it from degrading the quadrature. This is the one exposure the adversarial validation (docs/dev/FINDINGS_ADVERSARIAL_VALIDATION.md) could not close in the library itself: what a fixed grid never samples, it cannot report.Added in version 1.0.0.
strategy_info (dict, optional) –
If given, filled in place with which engine actually answered, following the same out-parameter convention as
convergence_infoinosc_prob(). Understrategy='auto'the fallbacks are silent by design – that is right for ordinary calls, and wrong for anyone asking why a result moved or why a call got slow – so this is how to see them without turning the fallbacks into warnings. Keys:'engine'–'hybrid','ip_exp','separable','cumulative','magnus'or'average'.'family'– the engine’s family; seeENGINE_FAMILIES.'certified'– for'hybrid', whethermagnus.adiabatic.hybrid_propagator()self-certified.Nonefor engines that do not certify. Under'auto'an uncertified hybrid result is never returned, so this isTruewhenever the engine is'hybrid'; under'hybrid'it can beFalse, and then it means the accuracy is unverified, not that the answer is wrong.'declined'–[(engine, reason)]for the engines that stood aside first. Most requests decline most engines, which is ordinary and not a finding.'trace'– every dispatch decision in order, with per-engine detail (for the cumulative scan,'n_acc'and whether it came from a ceiling).
Costs nothing when omitted. Default: None.
Added in version 1.0.0.
t_slab_edges (list or np.ndarray, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.magnus_exp_order (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.n_jobs (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.integration_method (str) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.rtol (int or float, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.atol (int or float, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.growth_factor_n_slabs (int or float) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.growth_factor_n_tpts_per_slab (int or float) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.max_num_loops (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.min_n_slabs (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.max_n_slabs (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.min_n_tpts_per_slab (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.max_n_tpts_per_slab (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.validate_input (bool) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.save_log (bool) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.filename_log (str) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.file_log (TextIOWrapper, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.close_file_log_upon_exit (bool) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.verbose (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.new_recursion_limit (int, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.**kwargs – Additional arguments forwarded to
osc_prob_energy_baseline().
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_matter_nsi(num_flavors: int, rho_func: Callable | int | float, energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, osc_params: Dict, nsi_params: Dict, L0: int | float | None = 0.0, h_vac_energy_indep: list | numpy.ndarray = None, h_nsi: list | numpy.ndarray = None, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', average: bool | None = False, strategy: str | None = 'auto', strategy_info: Dict | None = None, t_slab_edges: list | numpy.ndarray | None = None, magnus_exp_order: int | None = 4, n_jobs: int | None = 1, integration_method: str | None = 'gl', rtol: int | float | None = 0.001, atol: int | float | None = 0.001, growth_factor_n_slabs: int | float | None = 1.5, growth_factor_n_tpts_per_slab: int | float | None = 1.5, max_num_loops: int | None = 50, min_n_slabs: int | None = 1, max_n_slabs: int | None = None, min_n_tpts_per_slab: int | None = 2, max_n_tpts_per_slab: int | None = 500, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, new_recursion_limit: int | None = 5000, symmetric_over: tuple | None = None, **kwargs) float | numpy.ndarray[source]
Computes and returns neutrino oscillation probabilities for oscillations in matter with non-standard interactions (NSI), i.e., the matter potential includes both the standard coherent-forward-scattering term and the NSI epsilon couplings.
Middle (scenario) layer for the NSI case, generic in
num_flavors: unpacksosc_paramsandnsi_params, builds the vacuum + matter + NSI Hamiltonian (viahamiltonians.hamiltonian_{num_flavors}nu_vacuum_energy_independent,hamiltonian_{num_flavors}nu_matter_td, andhamiltonian_{num_flavors}nu_nsi_td, with the potential frommagnus.matter.vcc_func_from_rho_func()), and callsosc_prob_energy_baseline(). Called by everyosc_prob_{2,3,4,5}nu_matter_nsi_{constant,exp}_densityandosc_prob_{2,3,4,5}nu_earth_nsi/osc_prob_{2,3,4,5}nu_sun_nsiwrapper.Added in version 1.0.0.
- Parameters:
num_flavors (int) – Number of neutrino flavors (2, 3, 4, or 5; or higher, if
h_vac_energy_indep/h_nsiare given).rho_func (Callable, int, or float) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True), either as a function of position or as a constant.energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
osc_params (dict) – Oscillation parameters; see
unpack_oscillation_params_from_dict().nsi_params (dict) – NSI epsilon parameters; see
unpack_nsi_params_from_dict().L0 (int or float, optional) – Initial position. Default: 0.0.
h_vac_energy_indep (list or np.ndarray, optional) – Precomputed energy-independent vacuum Hamiltonian, used instead of
osc_paramswhennum_flavorsexceedsglobaldefs.MAGNUS_MAX_PREDEFINED_NUM_FLAVORS.h_nsi (list or np.ndarray, optional) – Precomputed NSI Hamiltonian, used instead of
nsi_paramswhennum_flavorsexceedsglobaldefs.MAGNUS_MAX_PREDEFINED_NUM_FLAVORS.ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos (flips the sign of the matter potential). Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix.nu_f (int, optional) – Final flavor index; see
nu_i.density_matter_is_in_g_per_cm3 (bool, optional) – If True,
rho_funcreturns the density in \(\text{g cm}^{-3}\). Default: False.density_is_of_number_of_electrons (bool, optional) – If True,
rho_funcdirectly returns the electron number density [\(\text{eV}^{3}\)]. Default: False.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any parameter left as None in
osc_params. Default: ‘OSC_PARAMS_DEFAULT’.strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation of the'hybrid'/'auto'strategies (adiabatic transport with a Magnus patch at any non-adiabatic window, applicable to any number of flavors). Default: ‘auto’.Added in version 1.0.0.
strategy_info (dict, optional) –
If given, filled in place with which engine actually answered, following the same out-parameter convention as
convergence_infoinosc_prob(). Understrategy='auto'the fallbacks are silent by design – that is right for ordinary calls, and wrong for anyone asking why a result moved or why a call got slow – so this is how to see them without turning the fallbacks into warnings. Keys:'engine'–'hybrid','ip_exp','separable','cumulative','magnus'or'average'.'family'– the engine’s family; seeENGINE_FAMILIES.'certified'– for'hybrid', whethermagnus.adiabatic.hybrid_propagator()self-certified.Nonefor engines that do not certify. Under'auto'an uncertified hybrid result is never returned, so this isTruewhenever the engine is'hybrid'; under'hybrid'it can beFalse, and then it means the accuracy is unverified, not that the answer is wrong.'declined'–[(engine, reason)]for the engines that stood aside first. Most requests decline most engines, which is ordinary and not a finding.'trace'– every dispatch decision in order, with per-engine detail (for the cumulative scan,'n_acc'and whether it came from a ceiling).
Costs nothing when omitted. Default: None.
Added in version 1.0.0.
t_slab_edges (list or np.ndarray, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.magnus_exp_order (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.n_jobs (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.integration_method (str) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.rtol (int or float, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.atol (int or float, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.growth_factor_n_slabs (int or float) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.growth_factor_n_tpts_per_slab (int or float) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.max_num_loops (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.min_n_slabs (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.max_n_slabs (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.min_n_tpts_per_slab (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.max_n_tpts_per_slab (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.validate_input (bool) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.save_log (bool) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.filename_log (str) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.file_log (TextIOWrapper, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.close_file_log_upon_exit (bool) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.verbose (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.new_recursion_limit (int, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.**kwargs – Additional arguments forwarded to
osc_prob_energy_baseline().
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_liv(num_flavors: int, energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, osc_params: Dict, liv_params: Dict, rho_func: Callable | int | float | None = 0.0, L0: int | float | None = 0.0, h_vac_energy_indep: list | numpy.ndarray = None, h_liv_energy_indep: list | numpy.ndarray = None, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', average: bool | None = False, strategy: str | None = 'auto', strategy_info: Dict | None = None, t_slab_edges: list | numpy.ndarray | None = None, magnus_exp_order: int | None = 4, n_jobs: int | None = 1, integration_method: str | None = 'gl', rtol: int | float | None = 0.001, atol: int | float | None = 0.001, growth_factor_n_slabs: int | float | None = 1.5, growth_factor_n_tpts_per_slab: int | float | None = 1.5, max_num_loops: int | None = 50, min_n_slabs: int | None = 1, max_n_slabs: int | None = None, min_n_tpts_per_slab: int | None = 2, max_n_tpts_per_slab: int | None = 500, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, new_recursion_limit: int | None = 5000, symmetric_over: tuple | None = None, **kwargs) float | numpy.ndarray[source]
Computes and returns neutrino oscillation probabilities for oscillations under (one form of) Lorentz-invariance violation, in vacuum or in matter.
Middle (scenario) layer for the LIV case, generic in
num_flavors: unpacksosc_paramsandliv_params, builds the vacuum (+ matter, ifrho_funcis nonzero) + LIV Hamiltonian (viahamiltonians.hamiltonian_{num_flavors}nu_vacuum_energy_independent, optionallyhamiltonian_{num_flavors}nu_matter_td, andhamiltonian_{num_flavors}nu_liv_energy_independent), and callsosc_prob_energy_baseline(). Called by everyosc_prob_{2,3,4,5}nu_vacuum_liv,osc_prob_{2,3,4,5}nu_matter_liv_{constant,exp}_density, andosc_prob_{2,3,4,5}nu_earth_liv/osc_prob_{2,3,4,5}nu_sun_livwrapper.Added in version 1.0.0.
- Parameters:
num_flavors (int) – Number of neutrino flavors (2, 3, 4, or 5; or higher, if
h_vac_energy_indep/h_liv_energy_indepare given).energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
osc_params (dict) – Oscillation parameters; see
unpack_oscillation_params_from_dict().liv_params (dict) – LIV parameters; see
unpack_liv_params_from_dict().rho_func (Callable, int, or float, optional) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True). If 0.0 (default), the probability is for vacuum + LIV only, with no matter term.L0 (int or float, optional) – Initial position. Default: 0.0.
h_vac_energy_indep (list or np.ndarray, optional) – Precomputed energy-independent vacuum Hamiltonian, used instead of
osc_paramswhennum_flavorsexceedsglobaldefs.MAGNUS_MAX_PREDEFINED_NUM_FLAVORS.h_liv_energy_indep (list or np.ndarray, optional) – Precomputed energy-independent LIV Hamiltonian, used instead of
liv_paramswhennum_flavorsexceedsglobaldefs.MAGNUS_MAX_PREDEFINED_NUM_FLAVORS.ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix.nu_f (int, optional) – Final flavor index; see
nu_i.density_matter_is_in_g_per_cm3 (bool, optional) – If True,
rho_funcreturns the density in \(\text{g cm}^{-3}\). Default: False.density_is_of_number_of_electrons (bool, optional) – If True,
rho_funcdirectly returns the electron number density [\(\text{eV}^{3}\)]. Default: False.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any parameter left as None in
osc_params. Default: ‘OSC_PARAMS_DEFAULT’.strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation of the'hybrid'/'auto'strategies (adiabatic transport with a Magnus patch at any non-adiabatic window, applicable to any number of flavors). Only relevant whenrho_funcis nonzero (there is no position dependence, hence no resonance, in pure vacuum + LIV). Default: ‘auto’.Added in version 1.0.0.
strategy_info (dict, optional) –
If given, filled in place with which engine actually answered, following the same out-parameter convention as
convergence_infoinosc_prob(). Understrategy='auto'the fallbacks are silent by design – that is right for ordinary calls, and wrong for anyone asking why a result moved or why a call got slow – so this is how to see them without turning the fallbacks into warnings. Keys:'engine'–'hybrid','ip_exp','separable','cumulative','magnus'or'average'.'family'– the engine’s family; seeENGINE_FAMILIES.'certified'– for'hybrid', whethermagnus.adiabatic.hybrid_propagator()self-certified.Nonefor engines that do not certify. Under'auto'an uncertified hybrid result is never returned, so this isTruewhenever the engine is'hybrid'; under'hybrid'it can beFalse, and then it means the accuracy is unverified, not that the answer is wrong.'declined'–[(engine, reason)]for the engines that stood aside first. Most requests decline most engines, which is ordinary and not a finding.'trace'– every dispatch decision in order, with per-engine detail (for the cumulative scan,'n_acc'and whether it came from a ceiling).
Costs nothing when omitted. Default: None.
Added in version 1.0.0.
t_slab_edges (list or np.ndarray, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.magnus_exp_order (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.n_jobs (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.integration_method (str) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.rtol (int or float, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.atol (int or float, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.growth_factor_n_slabs (int or float) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.growth_factor_n_tpts_per_slab (int or float) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.max_num_loops (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.min_n_slabs (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.max_n_slabs (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.min_n_tpts_per_slab (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.max_n_tpts_per_slab (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.validate_input (bool) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.save_log (bool) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.filename_log (str) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.file_log (TextIOWrapper, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.close_file_log_upon_exit (bool) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.verbose (int) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.new_recursion_limit (int, optional) – Forwarded to
osc_prob_energy_baseline()/osc_prob(); see their docstrings.**kwargs – Additional arguments forwarded to
osc_prob_energy_baseline().
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_2nu_vacuum(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, sth: int | float, Dm2: int | float, nu_i: int | None = None, nu_f: int | None = None, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the two-neutrino oscillation probability in vacuum.
By default, returns \(2 \times 2\) probability matrices for all the oscillation channels. Each matrix has shape
np.ndarray([[Pab, Pba],[Pba,Pab]]). The matrix is symmetric, i.e.,Pba == Pab.If a single energy and baseline is given, the function returns a single matrix. If multiple energies and baselines are given, function returns an NumPy array of matrices. See examples below.
If the probability needs to be computed multiple times, it is recommended to pass the array of energies and the array of baselines to the function in a single call instead of calling the function separately for each combination of energy and baseline. The reason is that the function has an overhead that gets diluted when computing when the input energies and baselines are many.
Unlike
osc_prob_3nu_vacuum()(and alsoosc_prob_4nu_vacuum()andosc_prob_5nu_vacuum()), the oscillation parameters sth and Dm2 are not optional, but must be passed. Depending on the values passed,osc_prob_2nu_vacuum()will return probabilities for different two-neutrino systems:\(\nu_e-\nu_\mu\) if
sthis \(\sin \theta_{12}\) andDm2is \(\Delta m_{21}^2\)\(\nu_\mu-\nu_\tau\) if
sthis \(\sin \theta_{23}\) andDm2is \(\Delta m_{32}^2\)\(\nu_e-\nu_\tau\) if
sthis \(\sin \theta_{13}\) andDm2is \(\Delta m_{31}^2\).
If the initial and final flavors,
nu_iandnu_f, are specified (by setting them toNUE,NUMU, orNUTAUfrom themagnus.globaldefsmodule), the function returns instead a one-dimensional array of the probabilities computed for each value of energy and baseline requested. See examples below.Because this is a two-neutrino system, the flavor indices can only be 0 or 1. To prevent using other values, we convert the indices like this:
If
nu_i == NUE(i.e., 0) andnu_f == NUTAU(i.e., 2), we setnu_f = 1If
nu_i == NUTAU(i.e., 2) andnu_f == NUE(i.e., 0), we setnu_i = 1If
nu_i == NUMU(i.e., 1) andnu_f == NUTAU(i.e., 2), we setnu_i = 0andnu_f = 1If
nu_i == NUTAU(i.e., 2) andnu_f == NUMU(i.e., 1), we setnu_i = 1andnu_f = 0
If
validate_inputis set to True, the function validates the input arguments before calculating the probability, by calling the functionvalidate_input_battery().Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy, single value or array.
L (int, float, list, or np.ndarray) – Neutrino baseline, single value or array.
Dm2 (int or float) – Mass-squared difference \(\Delta m^2\).
nu_i (int, optional) – Initial neutrino flavor, either
NUE,NUMU, orNUTAUfrom themagnus.globaldefsmodule.nu_f (int, optional) – Final neutrino flavor, either
NUE,NUMU, orNUTAUfrom themagnus.globaldefsmodule.validate_input (bool, optional) – True to validate input (default); False not to, which is faster but riskier.
verbose (int, optional) – 0 not to print warnings and errors; 1 to print them; 2 to print progress.
- Returns:
Neutrino oscillation probability matrix or probability for a single oscillation channel, for the values of energy and L.
- Return type:
Union[float, np.ndarray]
Examples
Single energy and baseline (the code below runs when these docs are built, so the output shown is always current):
import magnus.oscprob as oscprob import magnus.globaldefs as gd sth = gd.S12_NO_BF_NUFIT_6_0 # sin(theta) [adim] Dm2 = gd.D21_NO_BF_NUFIT_6_0 # [eV^2] baseline = 10.0 * gd.UNIT_KM # 10 km in natural units [eV^-1] energy = 1.0 * gd.UNIT_MEV # [eV] oscprob.osc_prob_2nu_vacuum(energy, baseline, sth, Dm2)
array([[0.437, 0.563], [0.563, 0.437]])See also
osc_prob_3nu_vacuum()Three-flavor oscillation probabilities in vacuum.
osc_prob_4nu_vacuum()Four-flavor (3+1) oscillation probabilities in vacuum.
osc_prob_5nu_vacuum()Four-flavor (3+2) oscillation probabilities in vacuum.
- magnus.oscprob.osc_prob_3nu_vacuum(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the three-neutrino oscillation probability in vacuum.
By default, returns \(3 \times 3\) probability matrices for all the oscillation channels. Each matrix has shape
np.ndarray([[Pee, Pem,Pet],[Pme,Pmm,Pmt],[Pte,Ptm,Ptt]]). The matrix is symmetric, i.e.,Pme == Pee,Pte == Pet, andPtm == Pmt.If a single energy and baseline is given, the function returns a single matrix. If multiple energies and baselines are given, function returns an NumPy array of matrices. See examples below.
If the probability needs to be computed multiple times, it is recommended to pass the array of energies and the array of baselines to the function in a single call instead of calling the function separately for each combination of energy and baseline. The reason is that the function has an overhead that gets diluted when computing when the input energies and baselines are many.
If the initial and final flavors,
nu_iandnu_f, are specified (by setting them toNUE,NUMU, orNUTAUfrom themagnus.globaldefsmodule), the function returns instead a one-dimensional array of the probabilities computed for each value of energy and baseline requested. See examples below.If the function is called without specifying values of the standard oscillation parameters (
s12,s23,s13,dCP,D21,D31), the unspecified parameters are assigned default values taken from a predefined parameter set. The name of the default parameter set can be changed by passingdefault_osc_params_set_name.The names of the predefined parameter sets included in \(\text{Mag}\nu\text{s}\) can be seen by printing
import magnus.globaldefs as gd list(gd.OSC_PARAMS_PREDEFINED.keys())
['OSC_PARAMS_DEFAULT', 'OSC_PARAMS_NU_FIT_6_0_SK_NO', 'OSC_PARAMS_NU_FIT_6_0_SK_IO']
And the default parameter values are from the set with name
'OSC_PARAMS_DEFAULT':gd.OSC_PARAMS_PREDEFINED['OSC_PARAMS_DEFAULT']
{'name': 'OSC_PARAMS_NU_FIT_6_0_NO', 'description': 'NuFit 6.0, NO, with SK atmospheric data', 's12': np.float64(0.5549774770204643), 's23': np.float64(0.6855654600401044), 's13': np.float64(0.14882876066137216), 'dCP': 3.7000980142279785, 'D21': 7.49e-05, 'D31': 0.002513}If
validate_inputis set to True, the function validates the input arguments before calculating the probability, by calling the functionvalidate_input_battery().Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy, single value or array.
L (int, float, list, or np.ndarray) – Neutrino baseline, single value or array.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\).
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\).
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\).
dCP (int or float, optional) – CP-violation phase, \(\delta_\text{CP}\).
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\).
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\).
nubar (bool, optional) – False (default) for neutrinos; True for anti-neutrinos.
nu_i (int, optional) – Initial neutrino flavor, either
NUE,NUMU, orNUTAUfrom themagnus.globaldefsmodule.nu_f (int, optional) – Final neutrino flavor, either
NUE,NUMU, orNUTAUfrom themagnus.globaldefsmodule.default_osc_params_set_name (str, optional) – Name of the predefined set of oscillation parameters to use when assigning default values to unspecified parameters.
validate_input (bool, optional) – True to validate input (default); False not to, which is faster but riskier.
verbose (int, optional) – 0 not to print warnings and errors; 1 to print them; 2 to print progress.
- Returns:
Neutrino oscillation probability matrix or probability for a single oscillation channel, for the values of energy and L.
- Return type:
Union[float, np.ndarray]
Examples
If both
energyandLare single values, this function returns the full \(3\times 3\) probability matrix computed at those values, using the NuFit 6.0 (normal ordering) defaults for any oscillation parameter not passed explicitly:import numpy as np import magnus.oscprob as oscprob import magnus.globaldefs as gd baseline = 10.0 * gd.UNIT_KM # 10 km in natural units [eV^-1] energy = 1.0 * gd.UNIT_MEV # [eV] oscprob.osc_prob_3nu_vacuum(energy, baseline)
array([[0.445, 0.299, 0.257], [0.251, 0.639, 0.11 ], [0.304, 0.062, 0.634]])Pick one channel only, e.g., \(\nu_e \to \nu_\mu\), by passing an initial flavor,
nu_i, and a final flavor,nu_f(the flavor indicesNUE,NUMU,NUTAUare defined inmagnus.globaldefs); passnubar=Truefor the antineutrino channel \(\bar\nu_e \to \bar\nu_\mu\):print(oscprob.osc_prob_3nu_vacuum(energy, baseline, nu_i=gd.NUE, nu_f=gd.NUMU)) print(oscprob.osc_prob_3nu_vacuum(energy, baseline, nu_i=gd.NUE, nu_f=gd.NUMU, nubar=True))
0.2986723533641986 0.2510712771435615
Any standard oscillation parameter can be overridden; the rest keep defaulting to the predefined set named by
default_osc_params_set_name('OSC_PARAMS_DEFAULT'unless changed – seeglobaldefs.OSC_PARAMS_PREDEFINEDfor the values it uses):oscprob.osc_prob_3nu_vacuum(energy, baseline, s12=0.0)
array([[0.985, 0.007, 0.008], [0.007, 0.736, 0.257], [0.008, 0.257, 0.735]])If a single energy and multiple baselines are passed, the result is an array of probabilities, one per baseline (and, conversely, one per energy for a single baseline and multiple energies; or a full grid for arrays of both – paired index-by-index, not an outer product):
baselines = gd.UNIT_KM * np.array([1.0, 10.0, 100.0]) energies = gd.UNIT_MEV * np.array([1.0, 5.0, 20.0]) print(oscprob.osc_prob_3nu_vacuum(energy, baselines, nu_i=gd.NUE, nu_f=gd.NUMU)) print(oscprob.osc_prob_3nu_vacuum(energies, baseline, nu_i=gd.NUE, nu_f=gd.NUMU)) print(oscprob.osc_prob_3nu_vacuum(energies, baselines, nu_i=gd.NUE, nu_f=gd.NUMU))
[0.004 0.299 0.019] [0.299 0.015 0.035] [0.004 0.015 0.09 ]
See also
osc_prob_2nu_vacuum()Two-flavor oscillation probabilities in vacuum.
osc_prob_4nu_vacuum()Four-flavor (3+1) oscillation probabilities in vacuum.
osc_prob_5nu_vacuum()Four-flavor (3+2) oscillation probabilities in vacuum.
- magnus.oscprob.osc_prob_4nu_vacuum(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, s14: int | float | None = 0.0, s24: int | float | None = 0.0, s34: int | float | None = 0.0, d14: int | float | None = 0.0, d24: int | float | None = 0.0, D41: int | float | None = 0.0, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the four-neutrino (3+1) oscillation probability in vacuum.
By default, returns \(4 \times 4\) probability matrices for all the oscillation channels. Each matrix has shape
np.ndarray([[Pee, Pem,Pet,Pes],[Pme,Pmm,Pmt,Pms],[Pte,Ptm,Ptt,Pts], [Pse,Psm,Pst,Pss]]). The matrix is symmetric, i.e.,Pme == Pee,Pte == Pet,Pse == Pes,Ptm == Pmt,Psm == Pms, andPst == Pts.If a single energy and baseline is given, the function returns a single matrix. If multiple energies and baselines are given, function returns an NumPy array of matrices. See examples below.
If the probability needs to be computed multiple times, it is recommended to pass the array of energies and the array of baselines to the function in a single call instead of calling the function separately for each combination of energy and baseline. The reason is that the function has an overhead that gets diluted when computing when the input energies and baselines are many.
If the initial and final flavors,
nu_iandnu_f, are specified (by setting them toNUE,NUMU,NUTAU, orNUSfrom themagnus.globaldefsmodule), the function returns instead a one-dimensional array of the probabilities computed for each value of energy and baseline requested. See examples below.If the function is called without specifying values of the standard oscillation parameters (
s12,s23,s13,dCP,D21,D31), the unspecified parameters are assigned default values taken from a predefined parameter set. The name of the default parameter set can be changed by passingdefault_osc_params_set_name.The names of the predefined parameter sets included in \(\text{Mag}\nu\text{s}\) can be seen by printing
import magnus.globaldefs as gd list(gd.OSC_PARAMS_PREDEFINED.keys())
['OSC_PARAMS_DEFAULT', 'OSC_PARAMS_NU_FIT_6_0_SK_NO', 'OSC_PARAMS_NU_FIT_6_0_SK_IO']
And the default parameter values are from the set with name
'OSC_PARAMS_DEFAULT':gd.OSC_PARAMS_PREDEFINED['OSC_PARAMS_DEFAULT']
{'name': 'OSC_PARAMS_NU_FIT_6_0_NO', 'description': 'NuFit 6.0, NO, with SK atmospheric data', 's12': np.float64(0.5549774770204643), 's23': np.float64(0.6855654600401044), 's13': np.float64(0.14882876066137216), 'dCP': 3.7000980142279785, 'D21': 7.49e-05, 'D31': 0.002513}If
validate_inputis set to True, the function validates the input arguments before calculating the probability, by calling the functionvalidate_input_battery().Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy, single value or array.
L (int, float, list, or np.ndarray) – Neutrino baseline, single value or array.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\).
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\).
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\).
d14 (int or float, optional) – CP-violation phase, \(\delta_{14}\).
d24 (int or float, optional) – CP-violation phase, \(\delta_{24}\).
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\).
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\).
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\).
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\).
dCP (int or float, optional) – CP-violation phase, \(\delta_\text{CP}\).
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\).
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\).
nubar (bool, optional) – False (default) for neutrinos; True for anti-neutrinos.
nu_i (int, optional) – Initial neutrino flavor, either
NUE,NUMU,NUTAU, orNUSfrom themagnus.globaldefsmodule.nu_f (int, optional) – Final neutrino flavor, either
NUE,NUMU,NUTAU, orNUSfrom themagnus.globaldefsmodule.default_osc_params_set_name (str, optional) – Name of the predefined set of standard oscillation parameters to use when assigning default values to unspecified parameters.
validate_input (bool, optional) – True to validate input (default); False not to, which is faster but riskier.
verbose (int, optional) – 0 not to print warnings and errors; 1 to print them; 2 to print progress.
- Returns:
Neutrino oscillation probability matrix or probability for a single oscillation channel, for the values of energy and L.
- Return type:
Union[float, np.ndarray]
Examples
With the sterile-sector angles/phases given explicitly and the active-sector angles left at their NuFit 6.0 defaults:
import numpy as np import magnus.oscprob as oscprob import magnus.globaldefs as gd baseline = 10.0 * gd.UNIT_KM # 10 km in natural units [eV^-1] energy = 1.0 * gd.UNIT_MEV # [eV] s14, s24, s34 = 0.1, 0.2, 0.3 d14, d24 = np.radians(10.0), np.radians(100.0) D41 = 0.1 # [eV^2] oscprob.osc_prob_4nu_vacuum(energy, baseline, s14=s14, s24=s24, s34=s34, d14=d14, d24=d24, D41=D41)
array([[4.398e-01, 2.884e-01, 2.047e-01, 6.705e-02], [2.359e-01, 6.421e-01, 1.218e-01, 1.550e-04], [2.367e-01, 5.620e-02, 6.362e-01, 7.091e-02], [8.762e-02, 1.328e-02, 3.722e-02, 8.619e-01]])Pick one channel only, e.g., \(\nu_e \to \nu_s\), and the antineutrino channel \(\bar\nu_e \to \bar\nu_\mu\) (the flavor indices
NUE,NUMU,NUTAU,NUSare defined inmagnus.globaldefs):common = dict(s14=s14, s24=s24, s34=s34, d14=d14, d24=d24, D41=D41) print(oscprob.osc_prob_4nu_vacuum(energy, baseline, nu_i=gd.NUE, nu_f=gd.NUS, **common)) print(oscprob.osc_prob_4nu_vacuum(energy, baseline, nu_i=gd.NUE, nu_f=gd.NUMU, nubar=True, **common))
0.06704850600997674 0.2359339512135478
Any active-sector parameter can still be overridden on top of the sterile-sector values:
oscprob.osc_prob_4nu_vacuum(energy, baseline, s12=0.0, **common)
array([[0.963, 0.012, 0.004, 0.022], [0.008, 0.739, 0.231, 0.022], [0.002, 0.224, 0.75 , 0.024], [0.027, 0.026, 0.014, 0.932]])Arrays of energies and/or baselines work the same way as for
osc_prob_3nu_vacuum()(paired index-by-index for two arrays, not an outer product):baselines = gd.UNIT_KM * np.array([1.0, 10.0, 100.0]) energies = gd.UNIT_MEV * np.array([1.0, 5.0, 20.0]) print(oscprob.osc_prob_4nu_vacuum(energy, baselines, nu_i=gd.NUE, nu_f=gd.NUMU, **common)) print(oscprob.osc_prob_4nu_vacuum(energies, baseline, nu_i=gd.NUE, nu_f=gd.NUMU, **common)) print(oscprob.osc_prob_4nu_vacuum(energies, baselines, nu_i=gd.NUE, nu_f=gd.NUMU, **common))
[0.001 0.288 0.026] [0.288 0.007 0.029] [0.001 0.007 0.065]
See also
osc_prob_2nu_vacuum()Two-flavor oscillation probabilities in vacuum.
osc_prob_3nu_vacuum()Three-flavor oscillation probabilities in vacuum.
osc_prob_5nu_vacuum()Five-flavor (3+2) oscillation probabilities in vacuum.
- magnus.oscprob.osc_prob_5nu_vacuum(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, s14: int | float | None = 0.0, s15: int | float | None = 0.0, s24: int | float | None = 0.0, s25: int | float | None = 0.0, s34: int | float | None = 0.0, s35: int | float | None = 0.0, d14: int | float | None = 0.0, d15: int | float | None = 0.0, d24: int | float | None = 0.0, d35: int | float | None = 0.0, D41: int | float | None = 0.0, D51: int | float | None = 0.0, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the five-neutrino (3+2) oscillation probability in vacuum.
By default, returns \(5 \times 5\) probability matrices for all the oscillation channels. Each matrix has shape
np.ndarray([[Pee, Pem,Pet,Pes1,Pes2],[Pme,Pmm,Pmt,Pms1,Pms2],[Pte,Ptm,Ptt,Pts1,Pts2], [Ps1e,Ps1m,Ps1t,Ps1s1,Ps1s2],[Ps2e,Ps2m,Ps2t,Ps2s1,Ps2s2]]). The matrix is symmetric, i.e.,Pme == Pee,Pte == Pet,Ps1e == Pes1,Ps2e == Pes2Ptm == Pmt,Ps1m == Pms1,Ps1t == Pts1,Ps2t == Pts2, andPs2s1 == Ps1s2.If a single energy and baseline is given, the function returns a single matrix. If multiple energies and baselines are given, function returns an NumPy array of matrices. See examples below.
If the probability needs to be computed multiple times, it is recommended to pass the array of energies and the array of baselines to the function in a single call instead of calling the function separately for each combination of energy and baseline. The reason is that the function has an overhead that gets diluted when computing when the input energies and baselines are many.
If the initial and final flavors,
nu_iandnu_f, are specified (by setting them toNUE,NUMU,NUTAU,NUS1, orNUS2from themagnus.globaldefsmodule), the function returns instead a one-dimensional array of the probabilities computed for each value of energy and baseline requested. See examples below.If the function is called without specifying values of the standard oscillation parameters (
s12,s23,s13,dCP,D21,D31), the unspecified parameters are assigned default values taken from a predefined parameter set. The name of the default parameter set can be changed by passingdefault_osc_params_set_name.The names of the predefined parameter sets included in \(\text{Mag}\nu\text{s}\) can be seen by printing
import magnus.globaldefs as gd list(gd.OSC_PARAMS_PREDEFINED.keys())
['OSC_PARAMS_DEFAULT', 'OSC_PARAMS_NU_FIT_6_0_SK_NO', 'OSC_PARAMS_NU_FIT_6_0_SK_IO']
And the default parameter values are from the set with name
'OSC_PARAMS_DEFAULT':gd.OSC_PARAMS_PREDEFINED['OSC_PARAMS_DEFAULT']
{'name': 'OSC_PARAMS_NU_FIT_6_0_NO', 'description': 'NuFit 6.0, NO, with SK atmospheric data', 's12': np.float64(0.5549774770204643), 's23': np.float64(0.6855654600401044), 's13': np.float64(0.14882876066137216), 'dCP': 3.7000980142279785, 'D21': 7.49e-05, 'D31': 0.002513}If
validate_inputis set to True, the function validates the input arguments before calculating the probability, by calling the functionvalidate_input_battery().Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy, single value or array.
L (int, float, list, or np.ndarray) – Neutrino baseline, single value or array.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\).
s15 (int or float, optional) – Sine of the mixing angle \(\theta_{15}\).
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\).
s25 (int or float, optional) – Sine of the mixing angle \(\theta_{25}\).
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\).
s35 (int or float, optional) – Sine of the mixing angle \(\theta_{35}\).
d14 (int or float, optional) – CP-violation phase, \(\delta_{14}\).
d15 (int or float, optional) – CP-violation phase, \(\delta_{15}\).
d24 (int or float, optional) – CP-violation phase, \(\delta_{24}\).
d35 (int or float, optional) – CP-violation phase, \(\delta_{35}\).
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\).
D51 (int or float, optional) – Mass-squared difference \(\Delta m_{51}^2\).
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\).
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\).
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\).
dCP (int or float, optional) – CP-violation phase, \(\delta_\text{CP}\).
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\).
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\).
nubar (bool, optional) – False (default) for neutrinos; True for anti-neutrinos.
nu_i (int, optional) – Initial neutrino flavor, either
NUE,NUMU,NUTAU,NUS1, orNUS2from themagnus.globaldefsmodule.nu_f (int, optional) – Final neutrino flavor, either
NUE,NUMU,NUTAU,NUS1, orNUS2from themagnus.globaldefsmodule.default_osc_params_set_name (str, optional) – Name of the predefined set of standard oscillation parameters to use when assigning default values to unspecified parameters.
validate_input (bool, optional) – True to validate input (default); False not to, which is faster but riskier.
verbose (int, optional) – 0 not to print warnings and errors; 1 to print them; 2 to print progress.
- Returns:
Neutrino oscillation probability matrix or probability for a single oscillation channel, for the values of energy and L.
- Return type:
Union[float, np.ndarray]
Examples
With the sterile-sector angles/phases given explicitly and the active-sector angles left at their NuFit 6.0 defaults:
import numpy as np import magnus.oscprob as oscprob import magnus.globaldefs as gd baseline = 10.0 * gd.UNIT_KM # 10 km in natural units [eV^-1] energy = 1.0 * gd.UNIT_MEV # [eV] s14, s15, s24, s25, s34, s35 = 0.1, 0.1, 1.e-2, 1.e-2, 1.e-3, 1.e-3 d14, d15, d24, d35 = np.radians([10.0, 20.0, 30.0, 40.0]) D41, D51 = 0.1, 0.001 # [eV^2] common = dict(s14=s14, s15=s15, s24=s24, s25=s25, s34=s34, s35=s35, d14=d14, d15=d15, d24=d24, d35=d35, D41=D41, D51=D51) oscprob.osc_prob_5nu_vacuum(energy, baseline, **common).shape
(5, 5)
Pick one channel only – \(\nu_e \to \nu_{s_1}\), \(\nu_e \to \nu_{s_2}\), and \(\nu_{s_1} \to \nu_{s_2}\) (the flavor indices
NUE,NUMU,NUTAU,NUS1,NUS2are defined inmagnus.globaldefs); and the antineutrino channel \(\bar\nu_e \to \bar\nu_{s_1}\):print(oscprob.osc_prob_5nu_vacuum(energy, baseline, nu_i=gd.NUE, nu_f=gd.NUS1, **common)) print(oscprob.osc_prob_5nu_vacuum(energy, baseline, nu_i=gd.NUE, nu_f=gd.NUS2, **common)) print(oscprob.osc_prob_5nu_vacuum(energy, baseline, nu_i=gd.NUS1, nu_f=gd.NUS2, **common)) print(oscprob.osc_prob_5nu_vacuum(energy, baseline, nu_i=gd.NUE, nu_f=gd.NUS1, nubar=True, **common))
0.009345841501492452 0.002062071292918862 8.924541940273882e-05 0.009555786451655349
Any active-sector parameter can still be overridden on top of the sterile-sector values:
oscprob.osc_prob_5nu_vacuum(energy, baseline, s12=0.0, **common)
array([[9.630e-01, 6.619e-03, 7.532e-03, 2.251e-02, 3.463e-04], [6.455e-03, 7.362e-01, 2.572e-01, 1.396e-04, 1.043e-05], [7.526e-03, 2.571e-01, 7.350e-01, 2.016e-04, 1.492e-04], [2.269e-02, 7.777e-05, 8.470e-05, 9.769e-01, 2.320e-04], [3.391e-04, 4.159e-05, 1.261e-04, 2.312e-04, 9.993e-01]])Arrays of energies and/or baselines work the same way as for
osc_prob_3nu_vacuum()(paired index-by-index for two arrays, not an outer product):baselines = gd.UNIT_KM * np.array([1.0, 10.0, 100.0]) energies = gd.UNIT_MEV * np.array([1.0, 5.0, 20.0]) print(oscprob.osc_prob_5nu_vacuum(energy, baselines, nu_i=gd.NUE, nu_f=gd.NUMU, **common)) print(oscprob.osc_prob_5nu_vacuum(energies, baseline, nu_i=gd.NUE, nu_f=gd.NUMU, **common)) print(oscprob.osc_prob_5nu_vacuum(energies, baselines, nu_i=gd.NUE, nu_f=gd.NUMU, **common))
[0.004 0.293 0.019] [0.293 0.014 0.034] [0.004 0.014 0.087]
See also
osc_prob_2nu_vacuum()Two-flavor oscillation probabilities in vacuum.
osc_prob_3nu_vacuum()Three-flavor oscillation probabilities in vacuum.
osc_prob_4nu_vacuum()Four-flavor (3+1) oscillation probabilities in vacuum.
- magnus.oscprob.osc_prob_2nu_matter_constant_density(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, rho: int | float, sth: int | float, Dm2: int | float, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the two-neutrino oscillation probability in matter with a constant density profile.
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
rho (int or float) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True).sth (int or float) – Sine of the mixing angle \(\theta\), the single mixing angle of the two-flavor system.
Dm2 (int or float) – Mass-squared difference \(\Delta m^2\) of the two-flavor system.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_3nu_matter_constant_density(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, rho: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the three-neutrino oscillation probability in matter with a constant density profile.
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
rho (int or float) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True).s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_4nu_matter_constant_density(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, rho: int | float, s14: int | float | None = 0.0, s24: int | float | None = 0.0, s34: int | float | None = 0.0, d14: int | float | None = 0.0, d24: int | float | None = 0.0, D41: int | float | None = 0.0, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the four-neutrino oscillation probability in matter with a constant density profile.
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
rho (int or float) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True).s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_5nu_matter_constant_density(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, rho: int | float, s14: int | float | None = 0.0, s15: int | float | None = 0.0, s24: int | float | None = 0.0, s25: int | float | None = 0.0, s34: int | float | None = 0.0, s35: int | float | None = 0.0, d14: int | float | None = 0.0, d15: int | float | None = 0.0, d24: int | float | None = 0.0, d35: int | float | None = 0.0, D41: int | float | None = 0.0, D51: int | float | None = 0.0, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the five-neutrino oscillation probability in matter with a constant density profile.
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
rho (int or float) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True).s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s15 (int or float, optional) – Sine of the mixing angle \(\theta_{15}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s25 (int or float, optional) – Sine of the mixing angle \(\theta_{25}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
s35 (int or float, optional) – Sine of the mixing angle \(\theta_{35}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d15 (int or float, optional) – \(\delta_{15}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
d35 (int or float, optional) – \(\delta_{35}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
D51 (int or float, optional) – Mass-squared difference \(\Delta m_{51}^2\). Default: 0.0.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_2nu_matter_exp_density(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, rho_central: int | float, l_scale: int | float, sth: int | float, Dm2: int | float, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the two-neutrino oscillation probability in matter with an exponentially falling density profile.
Added in version 1.0.0.
Note
Dispatches to a fast, closed-form interaction-picture Magnus integrator whenever the accumulated matter phase stays small enough to certify (see
_osc_prob_ip_exp_dispatch), giving warning-free results in a fraction of a second across the realistic solar-neutrino energy range for baselines up to a few e-folds ofl_scale. Longer baselines fall back transparently to the general slab-refinement method.- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
rho_central (int or float) – Matter density (or electron number density) at the center of the exponential profile (l = 0).
l_scale (int or float) – Length scale of the exponential density decrease.
sth (int or float) – Sine of the mixing angle \(\theta\), the single mixing angle of the two-flavor system.
Dm2 (int or float) – Mass-squared difference \(\Delta m^2\) of the two-flavor system.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_3nu_matter_exp_density(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, rho_central: int | float, l_scale: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the three-neutrino oscillation probability in matter with an exponentially falling density profile.
Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
rho_central (int or float) – Matter density (or electron number density) at the center of the exponential profile (l = 0).
l_scale (int or float) – Length scale of the exponential density decrease.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_4nu_matter_exp_density(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, rho_central: int | float, l_scale: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s24: int | float | None = 0.0, s34: int | float | None = 0.0, d14: int | float | None = 0.0, d24: int | float | None = 0.0, D41: int | float | None = 0.0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the four-neutrino (3+1) oscillation probability in matter with an exponentially falling density profile.
Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
rho_central (int or float) – Matter density (or electron number density) at the center of the exponential profile (l = 0).
l_scale (int or float) – Length scale of the exponential density decrease.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_5nu_matter_exp_density(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, rho_central: int | float, l_scale: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s15: int | float | None = 0.0, s24: int | float | None = 0.0, s25: int | float | None = 0.0, s34: int | float | None = 0.0, s35: int | float | None = 0.0, d14: int | float | None = 0.0, d15: int | float | None = 0.0, d24: int | float | None = 0.0, d35: int | float | None = 0.0, D41: int | float | None = 0.0, D51: int | float | None = 0.0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the five-neutrino (3+2) oscillation probability in matter with an exponentially falling density profile.
Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
rho_central (int or float) – Matter density (or electron number density) at the center of the exponential profile (l = 0).
l_scale (int or float) – Length scale of the exponential density decrease.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s15 (int or float, optional) – Sine of the mixing angle \(\theta_{15}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s25 (int or float, optional) – Sine of the mixing angle \(\theta_{25}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
s35 (int or float, optional) – Sine of the mixing angle \(\theta_{35}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d15 (int or float, optional) – \(\delta_{15}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
d35 (int or float, optional) – \(\delta_{35}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
D51 (int or float, optional) – Mass-squared difference \(\Delta m_{51}^2\). Default: 0.0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_2nu_earth(energy: int | float | list | numpy.ndarray, sth: int | float, Dm2: int | float, costhz: int | float | None = None, loc_ini: Tuple[float, float] | list | numpy.ndarray | str | None = None, loc_fin: Tuple[float, float] | list | numpy.ndarray | str | None = None, L: float | list | numpy.ndarray | None = None, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the two-neutrino oscillation probability inside the Earth, either between two locations on the surface of the Earth, or between the surface and a point in the interior.
Assumes that the matter potential is due only to the standard charged-current coherent forward scattering of \(\\nu_e\) on electrons.
For the matter density inside the Earth, it uses the Preliminary Reference Earth Model.
If the initial location (
loc_ini) and final location (loc_fin) on the surface of the Earth are given (i.e., if they are notNone), then the neutrino travels the chord joining them through the Earth, overriding any given value of costhz given, and using the chord length as the baseline.The initial and final location can be given as a three-entry tuple of coordinates in the (degree, minute, second) format. Alternatively, any of the two locations can be given as a predefined named location. The predefined locations are in the earth.loc_coords_dms dictionary:
import magnus.earth as earth list(earth.loc_coords_dms.keys())
['baikal', 'cern', 'desy', 'ess', 'fermilab', 'gran_sasso', 'homestake', 'kamioka', 'km3net_arca', 'km3net_orca', 'north_pole', 'pyhaasalmi', 'snolab', 'south_pole', 'tokai']
print(earth.loc_coords_dms['fermilab'])
{'lat': (41, 49, 55), 'lon': (-88, 15, 26)}See the example below.
[If only a single location is given (i.e., if either
loc_iniorloc_finareNone), the function throws an exception.]If neither of the two locations is given, the function uses the given value of
costhzas direction and ofLas baseline. (AndLcan be an array of baselines.)Examples
Standard two-neutrino oscillations through the Earth, specified by the cosine of the zenith angle:
import warnings import magnus.oscprob as oscprob import magnus.globaldefs as gd from magnus.magnus import MagnusConvergenceWarning sth = gd.S12_NO_BF_NUFIT_6_0 Dm2 = gd.D21_NO_BF_NUFIT_6_0 costhz = -0.8 baseline = 2.0 * gd.EARTH_RADIUS * 0.8 * gd.UNIT_KM # chord length for this costhz energy = 1.0 * gd.UNIT_GEV # The small solar mass splitting Dm2 combined with this Earth baseline # means the adaptive refinement needs a few loops; this is the expected, # informational MagnusConvergenceWarning discussed in the package README. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_2nu_earth(energy, sth, Dm2, costhz=costhz, L=baseline) P
array([[0.944, 0.056], [0.056, 0.944]])Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
sth (int or float) – Sine of the mixing angle \(\theta\), the single mixing angle of the two-flavor system.
Dm2 (int or float) – Mass-squared difference \(\Delta m^2\) of the two-flavor system.
costhz (int or float, optional) – Cosine of the zenith angle of the neutrino. Used together with
L, as an alternative toloc_ini/loc_fin. Default: None.loc_ini (tuple, list, np.ndarray, or str, optional) – Initial location on the surface of the Earth, as (latitude, longitude) coordinates or a predefined location name (see
earth.loc_coords_dms). Must be given withloc_fin. Default: None.loc_fin (tuple, list, np.ndarray, or str, optional) – Final location, same format as
loc_ini. Must be given withloc_ini. Default: None.L (float, list, or np.ndarray, optional) – Baseline(s). Default: None.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_3nu_earth(energy: int | float | list | numpy.ndarray, costhz: int | float | None = None, loc_ini: Tuple[float, float] | list | numpy.ndarray | str | None = None, loc_fin: Tuple[float, float] | list | numpy.ndarray | str | None = None, L: float | list | numpy.ndarray | None = None, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the three-neutrino oscillation probability inside the Earth, either between two locations on the surface of the Earth, or between the surface and a point in the interior.
Assumes that the matter potential is due only to the standard charged-current coherent forward scattering of \(\\nu_e\) on electrons.
For the matter density inside the Earth, it uses the Preliminary Reference Earth Model.
If the initial location (
loc_ini) and final location (loc_fin) on the surface of the Earth are given (i.e., if they are notNone), then the neutrino travels the chord joining them through the Earth, overriding any given value of costhz given, and using the chord length as the baseline.The initial and final location can be given as a three-entry tuple of coordinates in the (degree, minute, second) format. Alternatively, any of the two locations can be given as a predefined named location. The predefined locations are in the earth.loc_coords_dms dictionary:
import magnus.earth as earth list(earth.loc_coords_dms.keys())
['baikal', 'cern', 'desy', 'ess', 'fermilab', 'gran_sasso', 'homestake', 'kamioka', 'km3net_arca', 'km3net_orca', 'north_pole', 'pyhaasalmi', 'snolab', 'south_pole', 'tokai']
print(earth.loc_coords_dms['fermilab'])
{'lat': (41, 49, 55), 'lon': (-88, 15, 26)}See the example below.
[If only a single location is given (i.e., if either
loc_iniorloc_finareNone), the function throws an exception.]If neither of the two locations is given, the function uses the given value of
costhzas direction and ofLas baseline. (AndLcan be an array of baselines.)Examples
Standard three-neutrino oscillations through the Earth, using the NuFit 6.0 defaults for the oscillation parameters:
import magnus.oscprob as oscprob import magnus.globaldefs as gd import warnings from magnus.magnus import MagnusConvergenceWarning costhz = -0.8 baseline = 2.0 * gd.EARTH_RADIUS * 0.8 * gd.UNIT_KM energy = 1.0 * gd.UNIT_GEV # The chosen baseline/energy combination needs a few adaptive-refinement # loops to converge; this is the expected, informational # MagnusConvergenceWarning discussed in the package README. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_3nu_earth(energy, costhz=costhz, L=baseline) P
array([[9.128e-01, 8.635e-02, 8.660e-04], [6.293e-02, 6.681e-01, 2.690e-01], [2.429e-02, 2.456e-01, 7.301e-01]])Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
costhz (int or float, optional) – Cosine of the zenith angle of the neutrino. Used together with
L, as an alternative toloc_ini/loc_fin. Default: None.loc_ini (tuple, list, np.ndarray, or str, optional) – Initial location on the surface of the Earth, as (latitude, longitude) coordinates or a predefined location name (see
earth.loc_coords_dms). Must be given withloc_fin. Default: None.loc_fin (tuple, list, np.ndarray, or str, optional) – Final location, same format as
loc_ini. Must be given withloc_ini. Default: None.L (float, list, or np.ndarray, optional) – Baseline(s). Default: None.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_4nu_earth(energy: int | float | list | numpy.ndarray, costhz: int | float | None = None, loc_ini: Tuple[float, float] | list | numpy.ndarray | str | None = None, loc_fin: Tuple[float, float] | list | numpy.ndarray | str | None = None, L: float | list | numpy.ndarray | None = None, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s24: int | float | None = 0.0, s34: int | float | None = 0.0, d14: int | float | None = 0.0, d24: int | float | None = 0.0, D41: int | float | None = 0.0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the four-neutrino oscillation probability inside the Earth, either between two locations on the surface of the Earth, or between the surface and a point in the interior.
Assumes that the matter potential is due only to the standard charged-current coherent forward scattering of \(\\nu_e\) on electrons.
For the matter density inside the Earth, it uses the Preliminary Reference Earth Model.
If the initial location (
loc_ini) and final location (loc_fin) on the surface of the Earth are given (i.e., if they are notNone), then the neutrino travels the chord joining them through the Earth, overriding any given value of costhz given, and using the chord length as the baseline.The initial and final location can be given as a three-entry tuple of coordinates in the (degree, minute, second) format. Alternatively, any of the two locations can be given as a predefined named location. The predefined locations are in the earth.loc_coords_dms dictionary:
import magnus.earth as earth list(earth.loc_coords_dms.keys())
['baikal', 'cern', 'desy', 'ess', 'fermilab', 'gran_sasso', 'homestake', 'kamioka', 'km3net_arca', 'km3net_orca', 'north_pole', 'pyhaasalmi', 'snolab', 'south_pole', 'tokai']
print(earth.loc_coords_dms['fermilab'])
{'lat': (41, 49, 55), 'lon': (-88, 15, 26)}See the example below.
[If only a single location is given (i.e., if either
loc_iniorloc_finareNone), the function throws an exception.]If neither of the two locations is given, the function uses the given value of
costhzas direction and ofLas baseline. (AndLcan be an array of baselines.)Examples
Four-neutrino (3+1 sterile) oscillations through the Earth, with a modest sterile mixing on top of the NuFit 6.0 active-sector defaults:
import numpy as np import magnus.oscprob as oscprob import magnus.globaldefs as gd import warnings from magnus.magnus import MagnusConvergenceWarning costhz = -0.8 baseline = 2.0 * gd.EARTH_RADIUS * 0.8 * gd.UNIT_KM energy = 1.0 * gd.UNIT_GEV # The chosen baseline/energy combination needs a few adaptive-refinement # loops to converge; this is the expected, informational # MagnusConvergenceWarning discussed in the package README. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_4nu_earth(energy, costhz=costhz, L=baseline, s14=0.1, s24=0.05, s34=0.02, d14=np.radians(10.0), d24=np.radians(20.0), D41=0.1) P
array([[8.809e-01, 7.521e-02, 1.721e-03, 4.213e-02], [5.624e-02, 6.742e-01, 2.653e-01, 4.184e-03], [2.401e-02, 2.438e-01, 7.313e-01, 8.842e-04], [3.881e-02, 6.779e-03, 1.610e-03, 9.528e-01]])Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
costhz (int or float, optional) – Cosine of the zenith angle of the neutrino. Used together with
L, as an alternative toloc_ini/loc_fin. Default: None.loc_ini (tuple, list, np.ndarray, or str, optional) – Initial location on the surface of the Earth, as (latitude, longitude) coordinates or a predefined location name (see
earth.loc_coords_dms). Must be given withloc_fin. Default: None.loc_fin (tuple, list, np.ndarray, or str, optional) – Final location, same format as
loc_ini. Must be given withloc_ini. Default: None.L (float, list, or np.ndarray, optional) – Baseline(s). Default: None.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_5nu_earth(energy: int | float | list | numpy.ndarray, costhz: int | float | None = None, loc_ini: Tuple[float, float] | list | numpy.ndarray | str | None = None, loc_fin: Tuple[float, float] | list | numpy.ndarray | str | None = None, L: float | list | numpy.ndarray | None = None, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s15: int | float | None = 0.0, s24: int | float | None = 0.0, s25: int | float | None = 0.0, s34: int | float | None = 0.0, s35: int | float | None = 0.0, d14: int | float | None = 0.0, d15: int | float | None = 0.0, d24: int | float | None = 0.0, d35: int | float | None = 0.0, D41: int | float | None = 0.0, D51: int | float | None = 0.0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the five-neutrino oscillation probability inside the Earth, either between two locations on the surface of the Earth, or between the surface and a point in the interior.
Assumes that the matter potential is due only to the standard charged-current coherent forward scattering of \(\\nu_e\) on electrons.
For the matter density inside the Earth, it uses the Preliminary Reference Earth Model.
If the initial location (
loc_ini) and final location (loc_fin) on the surface of the Earth are given (i.e., if they are notNone), then the neutrino travels the chord joining them through the Earth, overriding any given value of costhz given, and using the chord length as the baseline.The initial and final location can be given as a three-entry tuple of coordinates in the (degree, minute, second) format. Alternatively, any of the two locations can be given as a predefined named location. The predefined locations are in the earth.loc_coords_dms dictionary:
import magnus.earth as earth list(earth.loc_coords_dms.keys())
['baikal', 'cern', 'desy', 'ess', 'fermilab', 'gran_sasso', 'homestake', 'kamioka', 'km3net_arca', 'km3net_orca', 'north_pole', 'pyhaasalmi', 'snolab', 'south_pole', 'tokai']
print(earth.loc_coords_dms['fermilab'])
{'lat': (41, 49, 55), 'lon': (-88, 15, 26)}See the example below.
[If only a single location is given (i.e., if either
loc_iniorloc_finareNone), the function throws an exception.]If neither of the two locations is given, the function uses the given value of
costhzas direction and ofLas baseline. (AndLcan be an array of baselines.)Examples
Five-neutrino (3+2 sterile) oscillations through the Earth, with modest sterile mixing on top of the NuFit 6.0 active-sector defaults:
import numpy as np import magnus.oscprob as oscprob import magnus.globaldefs as gd import warnings from magnus.magnus import MagnusConvergenceWarning costhz = -0.8 baseline = 2.0 * gd.EARTH_RADIUS * 0.8 * gd.UNIT_KM energy = 1.0 * gd.UNIT_GEV # The chosen baseline/energy combination needs a few adaptive-refinement # loops to converge; this is the expected, informational # MagnusConvergenceWarning discussed in the package README. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_5nu_earth(energy, costhz=costhz, L=baseline, s14=0.1, s15=0.05, s24=0.05, s25=0.02, s34=0.02, s35=0.01, d14=np.radians(10.0), d15=np.radians(15.0), d24=np.radians(20.0), d35=np.radians(25.0), D41=0.1, D51=0.05) P
array([[8.824e-01, 7.387e-02, 1.896e-03, 4.183e-02, 3.524e-06], [5.530e-02, 6.755e-01, 2.648e-01, 4.196e-03, 1.912e-04], [2.373e-02, 2.438e-01, 7.315e-01, 8.813e-04, 9.640e-05], [3.858e-02, 6.743e-03, 1.587e-03, 9.530e-01, 1.382e-04], [2.826e-06, 6.955e-05, 2.224e-04, 1.346e-04, 9.996e-01]])Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
costhz (int or float, optional) – Cosine of the zenith angle of the neutrino. Used together with
L, as an alternative toloc_ini/loc_fin. Default: None.loc_ini (tuple, list, np.ndarray, or str, optional) – Initial location on the surface of the Earth, as (latitude, longitude) coordinates or a predefined location name (see
earth.loc_coords_dms). Must be given withloc_fin. Default: None.loc_fin (tuple, list, np.ndarray, or str, optional) – Final location, same format as
loc_ini. Must be given withloc_ini. Default: None.L (float, list, or np.ndarray, optional) – Baseline(s). Default: None.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s15 (int or float, optional) – Sine of the mixing angle \(\theta_{15}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s25 (int or float, optional) – Sine of the mixing angle \(\theta_{25}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
s35 (int or float, optional) – Sine of the mixing angle \(\theta_{35}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d15 (int or float, optional) – \(\delta_{15}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
d35 (int or float, optional) – \(\delta_{35}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
D51 (int or float, optional) – Mass-squared difference \(\Delta m_{51}^2\). Default: 0.0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_earth(H_func: Callable, energy: int | float | list | numpy.ndarray, costhz: int | float | None = None, loc_ini: Tuple[float, float] | list | numpy.ndarray | str | None = None, loc_fin: Tuple[float, float] | list | numpy.ndarray | str | None = None, L: float | list | numpy.ndarray | None = None, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, magnus_exp_order: int | None = 4, n_jobs: int | None = 1, integration_method: str | None = 'gl', rtol: int | float | None = 0.001, atol: int | float | None = 0.001, validate_input: bool | None = True, verbose: int | None = 0, strategy: str | None = 'auto', strategy_info: Dict | None = None, **kwargs) float | numpy.ndarray[source]
Compute and return the neutrino oscillation probability inside the Earth for a given arbitrary Hamiltonian.
Does not assume standard oscillations nor a given number of neutrino flavors: the user supplies their own Hamiltonian function,
H_func, and this routine takes care of the geometry of the trajectory through the Earth and of the matter density along it.H_funcmust be a function of either three arguments,H_func(energy, l, VCC), or two arguments,H_func(energy, l), returning a square complex NumPy array (the Hamiltonian in the flavor basis, in eV). In the three-argument form,VCCis the charged-current matter potential \(V_{\rm CC} = \sqrt{2} G_F N_e\) [eV] at positionlalong the chord, computed from the Preliminary Reference Earth Model; its sign is already flipped for antineutrinos (nubar=True). The user is free to use it, scale it, or ignore it (e.g., to add non-standard matter potentials that affect flavors other than \(\nu_e\)). For extra speed,H_funcmay accept an array of positionsland return a stack of Hamiltonians with the position axis leading; this is detected automatically.The trajectory can be specified either by the cosine of the zenith angle (
costhz) together with the baselineL[\(\text{eV}^{-1}\)], or by an initial and a final location on the surface of the Earth (loc_ini,loc_fin), given as (degree, minute, second) latitude/longitude tuples or as the names of predefined locations (seeearth.loc_coords_dms); in the latter case the neutrino travels the chord that joins the two locations.The slab edges used internally are aligned with the crossings of the PREM layer boundaries along the chord.
Added in version 1.0.0.
- Parameters:
H_func (Callable) – The Hamiltonian, as
H_func(energy, l, VCC)orH_func(energy, l); see above.energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
costhz (int or float, optional) – Cosine of the zenith angle of the neutrino. Used together with
L, as an alternative toloc_ini/loc_fin.loc_ini (tuple, list, np.ndarray, or str, optional) – Initial location on the surface of the Earth, as (latitude, longitude) coordinates or a predefined location name (see
earth.loc_coords_dms). Must be given withloc_fin.loc_fin (tuple, list, np.ndarray, or str, optional) – Final location, same format as
loc_ini. Must be given withloc_ini.L (float, list, or np.ndarray, optional) – Baseline(s) [\(\text{eV}^{-1}\)]. Used together with
costhz, as an alternative toloc_ini/loc_fin.nubar (bool, optional) – If True, compute the probability for antineutrinos (flips the sign of the PREM-based matter potential passed to
H_func). Default: False.nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix.nu_f (int, optional) – Final flavor index; see
nu_i.ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in Earth matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction of Earth matter. Default: 0.5.
magnus_exp_order (int, optional) – Highest order of the Magnus expansion. Default: 4.
n_jobs (int, optional) – Number of parallel joblib workers. Default: 1.
integration_method (str, optional) – ‘gl’, ‘trapezoid’, or ‘simpson’. Default: ‘gl’.
rtol (int or float, optional) – Target relative/absolute tolerance for the adaptive slab refinement. Default: 1e-3 each.
atol (int or float, optional) – Target relative/absolute tolerance for the adaptive slab refinement. Default: 1e-3 each.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
verbose (int, optional) – Verbosity level. Default: 0.
strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation. In practice,'hybrid'/'auto'rarely engage here: the PREM density profile has layer-boundary discontinuities (t_breakpoints), which this strategy does not support (see Adiabatic + Magnus Hybrid Strategy), so a real Earth-crossing trajectory almost always falls back to the'magnus'strategies regardless of what is requested. Default: ‘auto’.Added in version 1.0.0.
**kwargs – Additional arguments forwarded to
osc_prob_energy_baseline()/osc_prob()(e.g., the refinement-loop bounds).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each energy.- Return type:
float or np.ndarray
Examples
Standard three-neutrino oscillations, written by hand (the dedicated wrapper
osc_prob_3nu_earth()does this internally):import numpy as np import magnus.oscprob as oscprob import magnus.hamiltonians as hamiltonians import magnus.globaldefs as gd p = gd.OSC_PARAMS_PREDEFINED['OSC_PARAMS_DEFAULT'] s12, s23, s13, dCP, D21, D31 = p['s12'], p['s23'], p['s13'], p['dCP'], p['D21'], p['D31'] h_vac = hamiltonians.hamiltonian_3nu_vacuum_energy_independent( s12, s23, s13, dCP, D21, D31) # Written so that it accepts an array of positions: VCC[..., None, None] # turns one potential per position into a stack of matrices, which keeps # osc_prob on its vectorized path (see ScalarHamiltonianWarning). e00 = np.diag([1.0, 0.0, 0.0]) def H(energy, l, VCC): return (1 / energy) * h_vac + np.asarray(VCC)[..., None, None] * e00 oscprob.osc_prob_earth(H, energy=1.0 * gd.UNIT_GEV, loc_ini='fermilab', loc_fin='homestake')
array([[9.799e-01, 7.876e-05, 2.002e-02], [6.282e-03, 6.586e-01, 3.351e-01], [1.382e-02, 3.413e-01, 6.449e-01]])
- magnus.oscprob.osc_prob_2nu_sun(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, sth: int | float, Dm2: int | float, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, strategy: str | None = 'auto', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the two-neutrino oscillation probability for neutrinos inside the Sun.
Assumes that the matter potential is due only to the standard charged-current coherent forward scattering of \(\nu_e\) on electrons.
For the electron density inside the Sun, it assumes an exponentially falling density profile: \(N_e(r) = N_e(0) \exp(-r/r_0)\), with \(N_e(0) = 245 N_\text{Av}~\text{cm}^{-3}\) and \(r_0 = R_\odot/10.54\). See Eq. (10.62) in Fundamentals of Neutrino Physics and Astrophysics by Carlo Giunti and Chung Wook Kim.
Examples
Standard two-neutrino oscillations from the center of the Sun to 90% of its radius:
import warnings import magnus.oscprob as oscprob import magnus.globaldefs as gd from magnus.magnus import MagnusConvergenceWarning sth = gd.S12_NO_BF_NUFIT_6_0 Dm2 = gd.D21_NO_BF_NUFIT_6_0 energy = 15.0 * gd.UNIT_GEV # high enough energy for the adaptive refinement L0 = 0.0 # to converge cleanly under the default tolerance L = 0.9 * gd.SUN_RADIUS * gd.UNIT_KM # A trajectory through most of the Sun accumulates a large phase, so the # adaptive refinement needs a few loops to narrow the slabs; this is the # expected, informational MagnusConvergenceWarning discussed in the # package README, suppressed here to keep the example focused. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_2nu_sun(energy, L, L0, sth, Dm2) P
array([[0.788, 0.212], [0.212, 0.788]])Added in version 1.0.0.
Note
Dispatches to a fast, closed-form interaction-picture Magnus integrator whenever the accumulated matter phase stays small enough to certify (see
_osc_prob_ip_exp_dispatch), giving warning-free results in a fraction of a second across the realistic solar-neutrino energy range for baselines up to a few e-folds ofl_scale. Longer baselines fall back transparently to the general slab-refinement method.Note
With the default
strategy='auto', this also tries the more general adiabatic-transport-plus-Magnus-patch hybrid strategy (seemagnus.adiabatic.hybrid_propagator()and Adiabatic + Magnus Hybrid Strategy) for baselines beyond the interaction-picture integrator’s reach (e.g., low-energy neutrinos over most of the Sun’s radius), before falling back to the general slab-refinement method.- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
sth (int or float) – Sine of the mixing angle \(\theta\), the single mixing angle of the two-flavor system.
Dm2 (int or float) – Mass-squared difference \(\Delta m^2\) of the two-flavor system.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation. Default: ‘auto’.Added in version 1.0.0.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_3nu_sun(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, strategy: str | None = 'auto', default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the three-neutrino oscillation probability for neutrinos inside the Sun.
Assumes that the matter potential is due only to the standard charged-current coherent forward scattering of \(\nu_e\) on electrons.
For the electron density inside the Sun, it assumes an exponentially falling density profile: \(N_e(r) = N_e(0) \exp(-r/r_0)\), with \(N_e(0) = 245 N_\text{Av}~\text{cm}^{-3}\) and \(r_0 = R_\odot/10.54\). See Eq. (10.62) in Fundamentals of Neutrino Physics and Astrophysics by Carlo Giunti and Chung Wook Kim.
Examples
Standard three-neutrino oscillations through the Sun, using the NuFit 6.0 defaults for the oscillation parameters:
import warnings import magnus.oscprob as oscprob import magnus.globaldefs as gd from magnus.magnus import MagnusConvergenceWarning energy = 15.0 * gd.UNIT_GEV # high enough energy for the adaptive refinement L0 = 0.0 # to converge cleanly under the default tolerance L = 0.9 * gd.SUN_RADIUS * gd.UNIT_KM # A trajectory through most of the Sun accumulates a large phase, so the # adaptive refinement needs a few loops to narrow the slabs; this is the # expected, informational MagnusConvergenceWarning discussed in the # package README, suppressed here to keep the example focused. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_3nu_sun(energy, L, L0) P
array([[0.073, 0.395, 0.532], [0.063, 0.577, 0.361], [0.864, 0.028, 0.107]])Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation. Default: ‘auto’.Added in version 1.0.0.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_4nu_sun(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, s14: int | float | None = 0.0, s24: int | float | None = 0.0, s34: int | float | None = 0.0, d14: int | float | None = 0.0, d24: int | float | None = 0.0, D41: int | float | None = 0.0, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, strategy: str | None = 'auto', default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the four-neutrino (3+1) oscillation probability for neutrinos inside the Sun.
Assumes that the matter potential is due only to the standard charged-current coherent forward scattering of \(\nu_e\) on electrons.
For the electron density inside the Sun, it assumes an exponentially falling density profile: \(N_e(r) = N_e(0) \exp(-r/r_0)\), with \(N_e(0) = 245 N_\text{Av}~\text{cm}^{-3}\) and \(r_0 = R_\odot/10.54\). See Eq. (10.62) in Fundamentals of Neutrino Physics and Astrophysics by Carlo Giunti and Chung Wook Kim.
Examples
Four-neutrino (3+1 sterile) oscillations through the Sun, with a modest sterile mixing on top of the NuFit 6.0 active-sector defaults:
import warnings import numpy as np import magnus.oscprob as oscprob import magnus.globaldefs as gd from magnus.magnus import MagnusConvergenceWarning energy = 15.0 * gd.UNIT_GEV # high enough energy for the adaptive refinement L0 = 0.0 # to converge cleanly under the default tolerance L = 0.9 * gd.SUN_RADIUS * gd.UNIT_KM # A trajectory through most of the Sun accumulates a large phase, so the # adaptive refinement needs a few loops to narrow the slabs; this is the # expected, informational MagnusConvergenceWarning discussed in the # package README, suppressed here to keep the example focused. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_4nu_sun(energy, L, L0, s14=0.1, s24=0.05, s34=0.02, d14=np.radians(10.0), d24=np.radians(20.0), D41=0.1) P
array([[9.906e-03, 3.198e-03, 6.651e-04, 9.862e-01], [6.320e-02, 6.041e-01, 3.299e-01, 2.774e-03], [8.527e-01, 5.016e-02, 8.729e-02, 9.821e-03], [7.417e-02, 3.426e-01, 5.821e-01, 1.174e-03]])Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation. Default: ‘auto’.Added in version 1.0.0.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_5nu_sun(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, s14: int | float | None = 0.0, s15: int | float | None = 0.0, s24: int | float | None = 0.0, s25: int | float | None = 0.0, s34: int | float | None = 0.0, s35: int | float | None = 0.0, d14: int | float | None = 0.0, d15: int | float | None = 0.0, d24: int | float | None = 0.0, d35: int | float | None = 0.0, D41: int | float | None = 0.0, D51: int | float | None = 0.0, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, strategy: str | None = 'auto', default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the five-neutrino (3+2) oscillation probability for neutrinos inside the Sun.
Assumes that the matter potential is due only to the standard charged-current coherent forward scattering of \(\nu_e\) on electrons.
For the electron density inside the Sun, it assumes an exponentially falling density profile: \(N_e(r) = N_e(0) \exp(-r/r_0)\), with \(N_e(0) = 245 N_\text{Av}~\text{cm}^{-3}\) and \(r_0 = R_\odot/10.54\). See Eq. (10.62) in Fundamentals of Neutrino Physics and Astrophysics by Carlo Giunti and Chung Wook Kim.
Examples
Five-neutrino (3+2 sterile) oscillations through the Sun, with modest sterile mixing on top of the NuFit 6.0 active-sector defaults:
import warnings import numpy as np import magnus.oscprob as oscprob import magnus.globaldefs as gd from magnus.magnus import MagnusConvergenceWarning energy = 15.0 * gd.UNIT_GEV # high enough energy for the adaptive refinement L0 = 0.0 # to converge cleanly under the default tolerance L = 0.9 * gd.SUN_RADIUS * gd.UNIT_KM # A trajectory through most of the Sun accumulates a large phase, so the # adaptive refinement needs a few loops to narrow the slabs; this is the # expected, informational MagnusConvergenceWarning discussed in the # package README, suppressed here to keep the example focused. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_5nu_sun(energy, L, L0, s14=0.1, s15=0.05, s24=0.05, s25=0.02, s34=0.02, s35=0.01, d14=np.radians(10.0), d15=np.radians(15.0), d24=np.radians(20.0), d35=np.radians(25.0), D41=0.1, D51=0.05) P
array([[9.904e-03, 2.825e-03, 5.569e-04, 9.863e-01, 3.933e-04], [7.331e-02, 5.460e-01, 3.739e-01, 2.527e-03, 4.327e-03], [8.522e-01, 5.859e-02, 7.484e-02, 9.814e-03, 4.510e-03], [5.665e-03, 2.194e-03, 1.108e-03, 6.302e-04, 9.904e-01], [5.888e-02, 3.904e-01, 5.496e-01, 7.078e-04, 3.661e-04]])Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s15 (int or float, optional) – Sine of the mixing angle \(\theta_{15}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s25 (int or float, optional) – Sine of the mixing angle \(\theta_{25}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
s35 (int or float, optional) – Sine of the mixing angle \(\theta_{35}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d15 (int or float, optional) – \(\delta_{15}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
d35 (int or float, optional) – \(\delta_{35}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
D51 (int or float, optional) – Mass-squared difference \(\Delta m_{51}^2\). Default: 0.0.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation. Default: ‘auto’.Added in version 1.0.0.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_sun(H_func: Callable, energy: int | float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float | None = 0.0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, magnus_exp_order: int | None = 4, n_jobs: int | None = 1, integration_method: str | None = 'gl', rtol: int | float | None = 0.001, atol: int | float | None = 0.001, validate_input: bool | None = True, verbose: int | None = 0, strategy: str | None = 'auto', strategy_info: Dict | None = None, **kwargs) float | numpy.ndarray[source]
Compute and return the neutrino oscillation probability inside the Sun for a given arbitrary Hamiltonian.
Does not assume standard oscillations nor a given number of neutrino flavors: the user supplies their own Hamiltonian function,
H_func, and this routine provides the solar electron density along the (radial) trajectory.H_funcmust be a function of either three arguments,H_func(energy, l, VCC), or two arguments,H_func(energy, l), returning a square complex NumPy array (the Hamiltonian in the flavor basis, in eV). In the three-argument form,VCCis the charged-current matter potential \(V_{\rm CC} = \sqrt{2} G_F N_e\) [eV] at radial positionl; its sign is already flipped for antineutrinos (nubar=True). For extra speed,H_funcmay accept an array of positionsland return a stack of Hamiltonians with the position axis leading; this is detected automatically.The neutrino travels radially outward from
L0toL(both in \(\text{eV}^{-1}\), measured from the center of the Sun).For the electron density inside the Sun, it assumes an exponentially falling density profile: \(N_e(r) = N_e(0) \exp(-r/r_0)\), with \(N_e(0) = 245 N_\text{Av}~\text{cm}^{-3}\) and \(r_0 = R_\odot/10.54\). See Eq. (10.62) in Fundamentals of Neutrino Physics and Astrophysics by Carlo Giunti and Chung Wook Kim.
Added in version 1.0.0.
- Parameters:
H_func (Callable) – The Hamiltonian, as
H_func(energy, l, VCC)orH_func(energy, l); see above.energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
L (float, list, or np.ndarray) – Final radial position(s) [\(\text{eV}^{-1}\)], measured from the center of the Sun.
L0 (int or float, optional) – Initial radial position [\(\text{eV}^{-1}\)]. Default: 0.0.
nubar (bool, optional) – If True, compute the probability for antineutrinos (flips the sign of the solar matter potential passed to
H_func). Default: False.nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix.nu_f (int, optional) – Final flavor index; see
nu_i.magnus_exp_order (int, optional) – Highest order of the Magnus expansion. Default: 4.
n_jobs (int, optional) – Number of parallel joblib workers. Default: 1.
integration_method (str, optional) – ‘gl’, ‘trapezoid’, or ‘simpson’. Default: ‘gl’.
rtol (int or float, optional) – Target relative/absolute tolerance for the adaptive slab refinement. Default: 1e-3 each.
atol (int or float, optional) – Target relative/absolute tolerance for the adaptive slab refinement. Default: 1e-3 each.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
verbose (int, optional) – Verbosity level. Default: 0.
strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation (adiabatic transport with a Magnus patch at any non-adiabatic window, applicable to anyH_funcregardless of its internal structure). Default: ‘auto’.Added in version 1.0.0.
**kwargs – Additional arguments forwarded to
osc_prob_energy_baseline()/osc_prob()(e.g., the refinement-loop bounds).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each energy.- Return type:
float or np.ndarray
Examples
Standard two-neutrino oscillations, written by hand (the dedicated wrapper
osc_prob_2nu_sun()does this internally):import warnings import numpy as np import magnus.oscprob as oscprob import magnus.hamiltonians as hamiltonians import magnus.globaldefs as gd from magnus.magnus import MagnusConvergenceWarning sth = gd.S12_NO_BF_NUFIT_6_0 Dm2 = gd.D21_NO_BF_NUFIT_6_0 h_vac = hamiltonians.hamiltonian_2nu_vacuum_energy_independent(sth, Dm2) # Array-capable: VCC[..., None, None] broadcasts one potential per # position over a stack of matrices, keeping the vectorized path. e00 = np.diag([1.0, 0.0]) def H(energy, l, VCC): return (1 / energy) * h_vac + np.asarray(VCC)[..., None, None] * e00 # A trajectory through most of the Sun accumulates a large phase, so the # adaptive refinement needs a few loops to narrow the slabs; this is the # expected, informational MagnusConvergenceWarning discussed in the # package README, suppressed here to keep the example focused. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_sun(H, energy=1.0 * gd.UNIT_GEV, L=0.9 * gd.SUN_RADIUS * gd.UNIT_KM) P
array([[0.324, 0.676], [0.676, 0.324]])
- magnus.oscprob.osc_prob_2nu_matter_nsi_constant_density(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, rho: int | float, sth: int | float, Dm2: int | float, eps_aa: int | float | None = 0.0, eps_ab: int | float | None = 0.0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the two-neutrino oscillation probability in matter with a constant density profile, including non-standard interactions (NSI).
Added in version 1.0.0.
- Parameters:
strategy_info (dict, optional) –
If given, filled in place with which engine actually answered, exactly as in
osc_prob_matter_std_potential()– see that function for the keys. A user-supplied Hamiltonian gets the same answer to “which engine answered, and what stood aside” as a built-in scenario does. Default: None.Added in version 1.0.0.
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
rho (int or float) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True).sth (int or float) – Sine of the mixing angle \(\theta\), the single mixing angle of the two-flavor system.
Dm2 (int or float) – Mass-squared difference \(\Delta m^2\) of the two-flavor system.
eps_aa (int or float, optional) – Non-universal diagonal NSI coupling of nu_e (relative to nu_mu, whose diagonal coupling is fixed to 0 by convention); see
hamiltonians.hamiltonian_2nu_nsi. Default: 0.0.eps_ab (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_3nu_matter_nsi_constant_density(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, rho: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, eps_ee: int | float | None = 0.0, eps_em: int | float | None = 0.0, eps_et: int | float | None = 0.0, eps_mm: int | float | None = 0.0, eps_mt: int | float | None = 0.0, eps_tt: int | float | None = 0.0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the three-neutrino oscillation probability in matter with a constant density profile, including non-standard interactions (NSI).
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
rho (int or float) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True).s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
eps_ee (int or float, optional) – Diagonal NSI coupling of nu_e. Default: 0.0.
eps_em (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
eps_et (int or float, optional) – Flavor-off-diagonal (nu_e-nu_tau) NSI coupling. Default: 0.0.
eps_mm (int or float, optional) – Diagonal NSI coupling of nu_mu. Default: 0.0.
eps_mt (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_tau) NSI coupling. Default: 0.0.
eps_tt (int or float, optional) – Diagonal NSI coupling of nu_tau. Default: 0.0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_4nu_matter_nsi_constant_density(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, rho: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s24: int | float | None = 0.0, s34: int | float | None = 0.0, d14: int | float | None = 0.0, d24: int | float | None = 0.0, D41: int | float | None = 0.0, eps_ee: int | float | None = 0.0, eps_em: int | float | None = 0.0, eps_et: int | float | None = 0.0, eps_es: int | float | None = 0.0, eps_mm: int | float | None = 0.0, eps_mt: int | float | None = 0.0, eps_ms: int | float | None = 0.0, eps_tt: int | float | None = 0.0, eps_ts: int | float | None = 0.0, eps_ss: int | float | None = 0.0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the four-neutrino oscillation probability in matter with a constant density profile, including non-standard interactions (NSI).
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
rho (int or float) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True).s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
eps_ee (int or float, optional) – Diagonal NSI coupling of nu_e. Default: 0.0.
eps_em (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
eps_et (int or float, optional) – Flavor-off-diagonal (nu_e-nu_tau) NSI coupling. Default: 0.0.
eps_es (int or float, optional) – Flavor-off-diagonal (nu_e-nu_s) NSI coupling. Default: 0.0.
eps_mm (int or float, optional) – Diagonal NSI coupling of nu_mu. Default: 0.0.
eps_mt (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_tau) NSI coupling. Default: 0.0.
eps_ms (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_s) NSI coupling. Default: 0.0.
eps_tt (int or float, optional) – Diagonal NSI coupling of nu_tau. Default: 0.0.
eps_ts (int or float, optional) – Flavor-off-diagonal (nu_tau-nu_s) NSI coupling. Default: 0.0.
eps_ss (int or float, optional) – Diagonal NSI coupling of nu_s. Default: 0.0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_5nu_matter_nsi_constant_density(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, rho: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s15: int | float | None = 0.0, s24: int | float | None = 0.0, s25: int | float | None = 0.0, s34: int | float | None = 0.0, s35: int | float | None = 0.0, d14: int | float | None = 0.0, d15: int | float | None = 0.0, d24: int | float | None = 0.0, d35: int | float | None = 0.0, D41: int | float | None = 0.0, D51: int | float | None = 0.0, eps_ee: int | float | None = 0.0, eps_em: int | float | None = 0.0, eps_et: int | float | None = 0.0, eps_es1: int | float | None = 0.0, eps_es2: int | float | None = 0.0, eps_mm: int | float | None = 0.0, eps_mt: int | float | None = 0.0, eps_ms1: int | float | None = 0.0, eps_ms2: int | float | None = 0.0, eps_tt: int | float | None = 0.0, eps_ts1: int | float | None = 0.0, eps_ts2: int | float | None = 0.0, eps_s1s1: int | float | None = 0.0, eps_s1s2: int | float | None = 0.0, eps_s2s2: int | float | None = 0.0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the five-neutrino oscillation probability in matter with a constant density profile, including non-standard interactions (NSI).
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
rho (int or float) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True).s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s15 (int or float, optional) – Sine of the mixing angle \(\theta_{15}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s25 (int or float, optional) – Sine of the mixing angle \(\theta_{25}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
s35 (int or float, optional) – Sine of the mixing angle \(\theta_{35}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d15 (int or float, optional) – \(\delta_{15}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
d35 (int or float, optional) – \(\delta_{35}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
D51 (int or float, optional) – Mass-squared difference \(\Delta m_{51}^2\). Default: 0.0.
eps_ee (int or float, optional) – Diagonal NSI coupling of nu_e. Default: 0.0.
eps_em (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
eps_et (int or float, optional) – Flavor-off-diagonal (nu_e-nu_tau) NSI coupling. Default: 0.0.
eps_es1 (int or float, optional) – Flavor-off-diagonal (nu_e-nu_s1) NSI coupling. Default: 0.0.
eps_es2 (int or float, optional) – Flavor-off-diagonal (nu_e-nu_s2) NSI coupling. Default: 0.0.
eps_mm (int or float, optional) – Diagonal NSI coupling of nu_mu. Default: 0.0.
eps_mt (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_tau) NSI coupling. Default: 0.0.
eps_ms1 (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_s1) NSI coupling. Default: 0.0.
eps_ms2 (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_s2) NSI coupling. Default: 0.0.
eps_tt (int or float, optional) – Diagonal NSI coupling of nu_tau. Default: 0.0.
eps_ts1 (int or float, optional) – Flavor-off-diagonal (nu_tau-nu_s1) NSI coupling. Default: 0.0.
eps_ts2 (int or float, optional) – Flavor-off-diagonal (nu_tau-nu_s2) NSI coupling. Default: 0.0.
eps_s1s1 (int or float, optional) – Diagonal NSI coupling of nu_s1. Default: 0.0.
eps_s1s2 (int or float, optional) – Flavor-off-diagonal (nu_s1-nu_s2) NSI coupling. Default: 0.0.
eps_s2s2 (int or float, optional) – Diagonal NSI coupling of nu_s2. Default: 0.0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_2nu_matter_nsi_exp_density(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, rho_central: int | float, l_scale: int | float, sth: int | float, Dm2: int | float, eps_aa: int | float | None = 0.0, eps_ab: int | float | None = 0.0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the two-neutrino oscillation probability in matter with an exponentially falling density profile, including non-standard interactions (NSI).
Added in version 1.0.0.
Note
Dispatches to a fast, closed-form interaction-picture Magnus integrator whenever the accumulated matter phase stays small enough to certify (see
_osc_prob_ip_exp_dispatch), giving warning-free results in a fraction of a second across the realistic solar-neutrino energy range for baselines up to a few e-folds ofl_scale(the NSI couplings are folded into the same fast path). Longer baselines fall back transparently to the general slab-refinement method.- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
rho_central (int or float) – Matter density (or electron number density) at the center of the exponential profile (l = 0).
l_scale (int or float) – Length scale of the exponential density decrease.
sth (int or float) – Sine of the mixing angle \(\theta\), the single mixing angle of the two-flavor system.
Dm2 (int or float) – Mass-squared difference \(\Delta m^2\) of the two-flavor system.
eps_aa (int or float, optional) – Non-universal diagonal NSI coupling of nu_e (relative to nu_mu, whose diagonal coupling is fixed to 0 by convention); see
hamiltonians.hamiltonian_2nu_nsi. Default: 0.0.eps_ab (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_3nu_matter_nsi_exp_density(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, rho_central: int | float, l_scale: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, eps_ee: int | float | None = 0.0, eps_em: int | float | None = 0.0, eps_et: int | float | None = 0.0, eps_mm: int | float | None = 0.0, eps_mt: int | float | None = 0.0, eps_tt: int | float | None = 0.0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the three-neutrino oscillation probability in matter with an exponentially falling density profile, including non-standard interactions (NSI).
Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
rho_central (int or float) – Matter density (or electron number density) at the center of the exponential profile (l = 0).
l_scale (int or float) – Length scale of the exponential density decrease.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
eps_ee (int or float, optional) – Diagonal NSI coupling of nu_e. Default: 0.0.
eps_em (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
eps_et (int or float, optional) – Flavor-off-diagonal (nu_e-nu_tau) NSI coupling. Default: 0.0.
eps_mm (int or float, optional) – Diagonal NSI coupling of nu_mu. Default: 0.0.
eps_mt (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_tau) NSI coupling. Default: 0.0.
eps_tt (int or float, optional) – Diagonal NSI coupling of nu_tau. Default: 0.0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_4nu_matter_nsi_exp_density(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, rho_central: int | float, l_scale: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s24: int | float | None = 0.0, s34: int | float | None = 0.0, d14: int | float | None = 0.0, d24: int | float | None = 0.0, D41: int | float | None = 0.0, eps_ee: int | float | None = 0.0, eps_em: int | float | None = 0.0, eps_et: int | float | None = 0.0, eps_es: int | float | None = 0.0, eps_mm: int | float | None = 0.0, eps_mt: int | float | None = 0.0, eps_ms: int | float | None = 0.0, eps_tt: int | float | None = 0.0, eps_ts: int | float | None = 0.0, eps_ss: int | float | None = 0.0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the four-neutrino (3+1) oscillation probability in matter with an exponentially falling density profile, including non-standard interactions (NSI).
Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
rho_central (int or float) – Matter density (or electron number density) at the center of the exponential profile (l = 0).
l_scale (int or float) – Length scale of the exponential density decrease.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
eps_ee (int or float, optional) – Diagonal NSI coupling of nu_e. Default: 0.0.
eps_em (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
eps_et (int or float, optional) – Flavor-off-diagonal (nu_e-nu_tau) NSI coupling. Default: 0.0.
eps_es (int or float, optional) – Flavor-off-diagonal (nu_e-nu_s) NSI coupling. Default: 0.0.
eps_mm (int or float, optional) – Diagonal NSI coupling of nu_mu. Default: 0.0.
eps_mt (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_tau) NSI coupling. Default: 0.0.
eps_ms (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_s) NSI coupling. Default: 0.0.
eps_tt (int or float, optional) – Diagonal NSI coupling of nu_tau. Default: 0.0.
eps_ts (int or float, optional) – Flavor-off-diagonal (nu_tau-nu_s) NSI coupling. Default: 0.0.
eps_ss (int or float, optional) – Diagonal NSI coupling of nu_s. Default: 0.0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_5nu_matter_nsi_exp_density(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, rho_central: int | float, l_scale: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s15: int | float | None = 0.0, s24: int | float | None = 0.0, s25: int | float | None = 0.0, s34: int | float | None = 0.0, s35: int | float | None = 0.0, d14: int | float | None = 0.0, d15: int | float | None = 0.0, d24: int | float | None = 0.0, d35: int | float | None = 0.0, D41: int | float | None = 0.0, D51: int | float | None = 0.0, eps_ee: int | float | None = 0.0, eps_em: int | float | None = 0.0, eps_et: int | float | None = 0.0, eps_es1: int | float | None = 0.0, eps_es2: int | float | None = 0.0, eps_mm: int | float | None = 0.0, eps_mt: int | float | None = 0.0, eps_ms1: int | float | None = 0.0, eps_ms2: int | float | None = 0.0, eps_tt: int | float | None = 0.0, eps_ts1: int | float | None = 0.0, eps_ts2: int | float | None = 0.0, eps_s1s1: int | float | None = 0.0, eps_s1s2: int | float | None = 0.0, eps_s2s2: int | float | None = 0.0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the five-neutrino (3+2) oscillation probability in matter with an exponentially falling density profile, including non-standard interactions (NSI).
Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
rho_central (int or float) – Matter density (or electron number density) at the center of the exponential profile (l = 0).
l_scale (int or float) – Length scale of the exponential density decrease.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s15 (int or float, optional) – Sine of the mixing angle \(\theta_{15}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s25 (int or float, optional) – Sine of the mixing angle \(\theta_{25}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
s35 (int or float, optional) – Sine of the mixing angle \(\theta_{35}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d15 (int or float, optional) – \(\delta_{15}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
d35 (int or float, optional) – \(\delta_{35}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
D51 (int or float, optional) – Mass-squared difference \(\Delta m_{51}^2\). Default: 0.0.
eps_ee (int or float, optional) – Diagonal NSI coupling of nu_e. Default: 0.0.
eps_em (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
eps_et (int or float, optional) – Flavor-off-diagonal (nu_e-nu_tau) NSI coupling. Default: 0.0.
eps_es1 (int or float, optional) – Flavor-off-diagonal (nu_e-nu_s1) NSI coupling. Default: 0.0.
eps_es2 (int or float, optional) – Flavor-off-diagonal (nu_e-nu_s2) NSI coupling. Default: 0.0.
eps_mm (int or float, optional) – Diagonal NSI coupling of nu_mu. Default: 0.0.
eps_mt (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_tau) NSI coupling. Default: 0.0.
eps_ms1 (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_s1) NSI coupling. Default: 0.0.
eps_ms2 (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_s2) NSI coupling. Default: 0.0.
eps_tt (int or float, optional) – Diagonal NSI coupling of nu_tau. Default: 0.0.
eps_ts1 (int or float, optional) – Flavor-off-diagonal (nu_tau-nu_s1) NSI coupling. Default: 0.0.
eps_ts2 (int or float, optional) – Flavor-off-diagonal (nu_tau-nu_s2) NSI coupling. Default: 0.0.
eps_s1s1 (int or float, optional) – Diagonal NSI coupling of nu_s1. Default: 0.0.
eps_s1s2 (int or float, optional) – Flavor-off-diagonal (nu_s1-nu_s2) NSI coupling. Default: 0.0.
eps_s2s2 (int or float, optional) – Diagonal NSI coupling of nu_s2. Default: 0.0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_2nu_earth_nsi(energy: int | float | list | numpy.ndarray, sth: int | float, Dm2: int | float, eps_aa: int | float | None = 0.0, eps_ab: int | float | None = 0.0, costhz: int | float | None = None, loc_ini: Tuple[float, float] | list | numpy.ndarray | str | None = None, loc_fin: Tuple[float, float] | list | numpy.ndarray | str | None = None, L: float | list | numpy.ndarray | None = None, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the two-neutrino oscillation probability inside the Earth, either between two locations on the surface of the Earth, or between the surface and a point in the interior, including non-standard interactions (NSI).
For the matter density inside the Earth, it uses the Preliminary Reference Earth Model.
If the initial location (
loc_ini) and final location (loc_fin) on the surface of the Earth are given (i.e., if they are notNone), then the neutrino travels the chord joining them through the Earth, overriding any given value of costhz given, and using the chord length as the baseline.The initial and final location can be given as a three-entry tuple of coordinates in the (degree, minute, second) format. Alternatively, any of the two locations can be given as a predefined named location. The predefined locations are in the earth.loc_coords_dms dictionary:
import magnus.earth as earth list(earth.loc_coords_dms.keys())
['baikal', 'cern', 'desy', 'ess', 'fermilab', 'gran_sasso', 'homestake', 'kamioka', 'km3net_arca', 'km3net_orca', 'north_pole', 'pyhaasalmi', 'snolab', 'south_pole', 'tokai']
print(earth.loc_coords_dms['fermilab'])
{'lat': (41, 49, 55), 'lon': (-88, 15, 26)}See the example below.
[If only a single location is given (i.e., if either
loc_iniorloc_finareNone), the function throws an exception.]If neither of the two locations is given, the function uses the given value of
costhzas direction and ofLas baseline. (AndLcan be an array of baselines.)Examples
Two-neutrino oscillations through the Earth with non-standard interactions:
import warnings import magnus.oscprob as oscprob import magnus.globaldefs as gd from magnus.magnus import MagnusConvergenceWarning sth = gd.S12_NO_BF_NUFIT_6_0 Dm2 = gd.D21_NO_BF_NUFIT_6_0 costhz = -0.8 baseline = 2.0 * gd.EARTH_RADIUS * 0.8 * gd.UNIT_KM energy = 1.0 * gd.UNIT_GEV # The small solar mass splitting Dm2 combined with this Earth baseline # means the adaptive refinement needs a few loops; this is the expected, # informational MagnusConvergenceWarning discussed in the package README. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_2nu_earth_nsi(energy, sth, Dm2, eps_aa=0.05, eps_ab=0.02, costhz=costhz, L=baseline) P
array([[0.932, 0.068], [0.068, 0.932]])Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
sth (int or float) – Sine of the mixing angle \(\theta\), the single mixing angle of the two-flavor system.
Dm2 (int or float) – Mass-squared difference \(\Delta m^2\) of the two-flavor system.
eps_aa (int or float, optional) – Non-universal diagonal NSI coupling of nu_e (relative to nu_mu, whose diagonal coupling is fixed to 0 by convention); see
hamiltonians.hamiltonian_2nu_nsi. Default: 0.0.eps_ab (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
costhz (int or float, optional) – Cosine of the zenith angle of the neutrino. Used together with
L, as an alternative toloc_ini/loc_fin. Default: None.loc_ini (tuple, list, np.ndarray, or str, optional) – Initial location on the surface of the Earth, as (latitude, longitude) coordinates or a predefined location name (see
earth.loc_coords_dms). Must be given withloc_fin. Default: None.loc_fin (tuple, list, np.ndarray, or str, optional) – Final location, same format as
loc_ini. Must be given withloc_ini. Default: None.L (float, list, or np.ndarray, optional) – Baseline(s). Default: None.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_3nu_earth_nsi(energy: int | float | list | numpy.ndarray, costhz: int | float | None = None, loc_ini: Tuple[float, float] | list | numpy.ndarray | str | None = None, loc_fin: Tuple[float, float] | list | numpy.ndarray | str | None = None, L: float | list | numpy.ndarray | None = None, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, eps_ee: int | float | None = 0.0, eps_em: int | float | None = 0.0, eps_et: int | float | None = 0.0, eps_mm: int | float | None = 0.0, eps_mt: int | float | None = 0.0, eps_tt: int | float | None = 0.0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the three-neutrino oscillation probability inside the Earth, either between two locations on the surface of the Earth, or between the surface and a point in the interior, including non-standard interactions (NSI).
For the matter density inside the Earth, it uses the Preliminary Reference Earth Model.
If the initial location (
loc_ini) and final location (loc_fin) on the surface of the Earth are given (i.e., if they are notNone), then the neutrino travels the chord joining them through the Earth, overriding any given value of costhz given, and using the chord length as the baseline.The initial and final location can be given as a three-entry tuple of coordinates in the (degree, minute, second) format. Alternatively, any of the two locations can be given as a predefined named location. The predefined locations are in the earth.loc_coords_dms dictionary:
import magnus.earth as earth list(earth.loc_coords_dms.keys())
['baikal', 'cern', 'desy', 'ess', 'fermilab', 'gran_sasso', 'homestake', 'kamioka', 'km3net_arca', 'km3net_orca', 'north_pole', 'pyhaasalmi', 'snolab', 'south_pole', 'tokai']
print(earth.loc_coords_dms['fermilab'])
{'lat': (41, 49, 55), 'lon': (-88, 15, 26)}See the example below.
[If only a single location is given (i.e., if either
loc_iniorloc_finareNone), the function throws an exception.]If neither of the two locations is given, the function uses the given value of
costhzas direction and ofLas baseline. (AndLcan be an array of baselines.)Examples
Three-neutrino oscillations through the Earth with non-standard interactions, using the NuFit 6.0 defaults for the standard oscillation parameters:
import magnus.oscprob as oscprob import magnus.globaldefs as gd import warnings from magnus.magnus import MagnusConvergenceWarning costhz = -0.8 baseline = 2.0 * gd.EARTH_RADIUS * 0.8 * gd.UNIT_KM energy = 1.0 * gd.UNIT_GEV # The chosen baseline/energy combination needs a few adaptive-refinement # loops to converge; this is the expected, informational # MagnusConvergenceWarning discussed in the package README. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_3nu_earth_nsi(energy, costhz=costhz, L=baseline, eps_ee=0.05, eps_em=-0.03, eps_et=0.01) P
array([[0.92 , 0.078, 0.002], [0.057, 0.669, 0.274], [0.023, 0.253, 0.724]])Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
costhz (int or float, optional) – Cosine of the zenith angle of the neutrino. Used together with
L, as an alternative toloc_ini/loc_fin. Default: None.loc_ini (tuple, list, np.ndarray, or str, optional) – Initial location on the surface of the Earth, as (latitude, longitude) coordinates or a predefined location name (see
earth.loc_coords_dms). Must be given withloc_fin. Default: None.loc_fin (tuple, list, np.ndarray, or str, optional) – Final location, same format as
loc_ini. Must be given withloc_ini. Default: None.L (float, list, or np.ndarray, optional) – Baseline(s). Default: None.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
eps_ee (int or float, optional) – Diagonal NSI coupling of nu_e. Default: 0.0.
eps_em (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
eps_et (int or float, optional) – Flavor-off-diagonal (nu_e-nu_tau) NSI coupling. Default: 0.0.
eps_mm (int or float, optional) – Diagonal NSI coupling of nu_mu. Default: 0.0.
eps_mt (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_tau) NSI coupling. Default: 0.0.
eps_tt (int or float, optional) – Diagonal NSI coupling of nu_tau. Default: 0.0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_4nu_earth_nsi(energy: int | float | list | numpy.ndarray, costhz: int | float | None = None, loc_ini: Tuple[float, float] | list | numpy.ndarray | str | None = None, loc_fin: Tuple[float, float] | list | numpy.ndarray | str | None = None, L: float | list | numpy.ndarray | None = None, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s24: int | float | None = 0.0, s34: int | float | None = 0.0, d14: int | float | None = 0.0, d24: int | float | None = 0.0, D41: int | float | None = 0.0, eps_ee: int | float | None = 0.0, eps_em: int | float | None = 0.0, eps_et: int | float | None = 0.0, eps_es: int | float | None = 0.0, eps_mm: int | float | None = 0.0, eps_mt: int | float | None = 0.0, eps_ms: int | float | None = 0.0, eps_tt: int | float | None = 0.0, eps_ts: int | float | None = 0.0, eps_ss: int | float | None = 0.0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the four-neutrino oscillation probability inside the Earth, either between two locations on the surface of the Earth, or between the surface and a point in the interior, including non-standard interactions (NSI).
For the matter density inside the Earth, it uses the Preliminary Reference Earth Model.
If the initial location (
loc_ini) and final location (loc_fin) on the surface of the Earth are given (i.e., if they are notNone), then the neutrino travels the chord joining them through the Earth, overriding any given value of costhz given, and using the chord length as the baseline.The initial and final location can be given as a three-entry tuple of coordinates in the (degree, minute, second) format. Alternatively, any of the two locations can be given as a predefined named location. The predefined locations are in the earth.loc_coords_dms dictionary:
import magnus.earth as earth list(earth.loc_coords_dms.keys())
['baikal', 'cern', 'desy', 'ess', 'fermilab', 'gran_sasso', 'homestake', 'kamioka', 'km3net_arca', 'km3net_orca', 'north_pole', 'pyhaasalmi', 'snolab', 'south_pole', 'tokai']
print(earth.loc_coords_dms['fermilab'])
{'lat': (41, 49, 55), 'lon': (-88, 15, 26)}See the example below.
[If only a single location is given (i.e., if either
loc_iniorloc_finareNone), the function throws an exception.]If neither of the two locations is given, the function uses the given value of
costhzas direction and ofLas baseline. (AndLcan be an array of baselines.)Examples
Four-neutrino (3+1 sterile) oscillations through the Earth with non-standard interactions, including the sterile-flavor couplings:
import numpy as np import magnus.oscprob as oscprob import magnus.globaldefs as gd import warnings from magnus.magnus import MagnusConvergenceWarning costhz = -0.8 baseline = 2.0 * gd.EARTH_RADIUS * 0.8 * gd.UNIT_KM energy = 1.0 * gd.UNIT_GEV # The chosen baseline/energy combination needs a few adaptive-refinement # loops to converge; this is the expected, informational # MagnusConvergenceWarning discussed in the package README. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_4nu_earth_nsi( energy, costhz=costhz, L=baseline, s14=0.1, s24=0.05, s34=0.02, d14=np.radians(10.0), d24=np.radians(20.0), D41=0.1, eps_ee=0.05, eps_em=-0.03, eps_et=0.01, eps_es=0.02, eps_ms=0.01, eps_ts=0.01) P
array([[8.882e-01, 6.730e-02, 7.645e-04, 4.373e-02], [5.091e-02, 6.785e-01, 2.674e-01, 3.251e-03], [2.103e-02, 2.481e-01, 7.299e-01, 1.010e-03], [3.985e-02, 6.131e-03, 2.010e-03, 9.520e-01]])Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
costhz (int or float, optional) – Cosine of the zenith angle of the neutrino. Used together with
L, as an alternative toloc_ini/loc_fin. Default: None.loc_ini (tuple, list, np.ndarray, or str, optional) – Initial location on the surface of the Earth, as (latitude, longitude) coordinates or a predefined location name (see
earth.loc_coords_dms). Must be given withloc_fin. Default: None.loc_fin (tuple, list, np.ndarray, or str, optional) – Final location, same format as
loc_ini. Must be given withloc_ini. Default: None.L (float, list, or np.ndarray, optional) – Baseline(s). Default: None.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
eps_ee (int or float, optional) – Diagonal NSI coupling of nu_e. Default: 0.0.
eps_em (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
eps_et (int or float, optional) – Flavor-off-diagonal (nu_e-nu_tau) NSI coupling. Default: 0.0.
eps_es (int or float, optional) – Flavor-off-diagonal (nu_e-nu_s) NSI coupling. Default: 0.0.
eps_mm (int or float, optional) – Diagonal NSI coupling of nu_mu. Default: 0.0.
eps_mt (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_tau) NSI coupling. Default: 0.0.
eps_ms (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_s) NSI coupling. Default: 0.0.
eps_tt (int or float, optional) – Diagonal NSI coupling of nu_tau. Default: 0.0.
eps_ts (int or float, optional) – Flavor-off-diagonal (nu_tau-nu_s) NSI coupling. Default: 0.0.
eps_ss (int or float, optional) – Diagonal NSI coupling of nu_s. Default: 0.0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_5nu_earth_nsi(energy: int | float | list | numpy.ndarray, costhz: int | float | None = None, loc_ini: Tuple[float, float] | list | numpy.ndarray | str | None = None, loc_fin: Tuple[float, float] | list | numpy.ndarray | str | None = None, L: float | list | numpy.ndarray | None = None, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s15: int | float | None = 0.0, s24: int | float | None = 0.0, s25: int | float | None = 0.0, s34: int | float | None = 0.0, s35: int | float | None = 0.0, d14: int | float | None = 0.0, d15: int | float | None = 0.0, d24: int | float | None = 0.0, d35: int | float | None = 0.0, D41: int | float | None = 0.0, D51: int | float | None = 0.0, eps_ee: int | float | None = 0.0, eps_em: int | float | None = 0.0, eps_et: int | float | None = 0.0, eps_es1: int | float | None = 0.0, eps_es2: int | float | None = 0.0, eps_mm: int | float | None = 0.0, eps_mt: int | float | None = 0.0, eps_ms1: int | float | None = 0.0, eps_ms2: int | float | None = 0.0, eps_tt: int | float | None = 0.0, eps_ts1: int | float | None = 0.0, eps_ts2: int | float | None = 0.0, eps_s1s1: int | float | None = 0.0, eps_s1s2: int | float | None = 0.0, eps_s2s2: int | float | None = 0.0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the five-neutrino oscillation probability inside the Earth, either between two locations on the surface of the Earth, or between the surface and a point in the interior, including non-standard interactions (NSI).
For the matter density inside the Earth, it uses the Preliminary Reference Earth Model.
If the initial location (
loc_ini) and final location (loc_fin) on the surface of the Earth are given (i.e., if they are notNone), then the neutrino travels the chord joining them through the Earth, overriding any given value of costhz given, and using the chord length as the baseline.The initial and final location can be given as a three-entry tuple of coordinates in the (degree, minute, second) format. Alternatively, any of the two locations can be given as a predefined named location. The predefined locations are in the earth.loc_coords_dms dictionary:
import magnus.earth as earth list(earth.loc_coords_dms.keys())
['baikal', 'cern', 'desy', 'ess', 'fermilab', 'gran_sasso', 'homestake', 'kamioka', 'km3net_arca', 'km3net_orca', 'north_pole', 'pyhaasalmi', 'snolab', 'south_pole', 'tokai']
print(earth.loc_coords_dms['fermilab'])
{'lat': (41, 49, 55), 'lon': (-88, 15, 26)}See the example below.
[If only a single location is given (i.e., if either
loc_iniorloc_finareNone), the function throws an exception.]If neither of the two locations is given, the function uses the given value of
costhzas direction and ofLas baseline. (AndLcan be an array of baselines.)Examples
Five-neutrino (3+2 sterile) oscillations through the Earth with non-standard interactions, including the sterile-flavor couplings:
import numpy as np import magnus.oscprob as oscprob import magnus.globaldefs as gd import warnings from magnus.magnus import MagnusConvergenceWarning costhz = -0.8 baseline = 2.0 * gd.EARTH_RADIUS * 0.8 * gd.UNIT_KM energy = 1.0 * gd.UNIT_GEV # The chosen baseline/energy combination needs a few adaptive-refinement # loops to converge; this is the expected, informational # MagnusConvergenceWarning discussed in the package README. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_5nu_earth_nsi( energy, costhz=costhz, L=baseline, s14=0.1, s15=0.05, s24=0.05, s25=0.02, s34=0.02, s35=0.01, d14=np.radians(10.0), d15=np.radians(15.0), d24=np.radians(20.0), d35=np.radians(25.0), D41=0.1, D51=0.05, eps_ee=0.05, eps_em=-0.03, eps_et=0.01, eps_es1=0.02, eps_es2=0.01, eps_ms1=0.01, eps_ms2=0.01, eps_ts1=0.01, eps_ts2=0.01) P
array([[8.898e-01, 6.579e-02, 6.013e-04, 4.353e-02, 2.783e-04], [4.976e-02, 6.811e-01, 2.657e-01, 3.283e-03, 1.952e-04], [2.042e-02, 2.470e-01, 7.316e-01, 1.009e-03, 6.672e-05], [3.973e-02, 6.105e-03, 1.981e-03, 9.520e-01, 1.401e-04], [2.921e-04, 8.879e-05, 1.646e-04, 1.348e-04, 9.993e-01]])Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
costhz (int or float, optional) – Cosine of the zenith angle of the neutrino. Used together with
L, as an alternative toloc_ini/loc_fin. Default: None.loc_ini (tuple, list, np.ndarray, or str, optional) – Initial location on the surface of the Earth, as (latitude, longitude) coordinates or a predefined location name (see
earth.loc_coords_dms). Must be given withloc_fin. Default: None.loc_fin (tuple, list, np.ndarray, or str, optional) – Final location, same format as
loc_ini. Must be given withloc_ini. Default: None.L (float, list, or np.ndarray, optional) – Baseline(s). Default: None.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s15 (int or float, optional) – Sine of the mixing angle \(\theta_{15}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s25 (int or float, optional) – Sine of the mixing angle \(\theta_{25}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
s35 (int or float, optional) – Sine of the mixing angle \(\theta_{35}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d15 (int or float, optional) – \(\delta_{15}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
d35 (int or float, optional) – \(\delta_{35}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
D51 (int or float, optional) – Mass-squared difference \(\Delta m_{51}^2\). Default: 0.0.
eps_ee (int or float, optional) – Diagonal NSI coupling of nu_e. Default: 0.0.
eps_em (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
eps_et (int or float, optional) – Flavor-off-diagonal (nu_e-nu_tau) NSI coupling. Default: 0.0.
eps_es1 (int or float, optional) – Flavor-off-diagonal (nu_e-nu_s1) NSI coupling. Default: 0.0.
eps_es2 (int or float, optional) – Flavor-off-diagonal (nu_e-nu_s2) NSI coupling. Default: 0.0.
eps_mm (int or float, optional) – Diagonal NSI coupling of nu_mu. Default: 0.0.
eps_mt (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_tau) NSI coupling. Default: 0.0.
eps_ms1 (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_s1) NSI coupling. Default: 0.0.
eps_ms2 (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_s2) NSI coupling. Default: 0.0.
eps_tt (int or float, optional) – Diagonal NSI coupling of nu_tau. Default: 0.0.
eps_ts1 (int or float, optional) – Flavor-off-diagonal (nu_tau-nu_s1) NSI coupling. Default: 0.0.
eps_ts2 (int or float, optional) – Flavor-off-diagonal (nu_tau-nu_s2) NSI coupling. Default: 0.0.
eps_s1s1 (int or float, optional) – Diagonal NSI coupling of nu_s1. Default: 0.0.
eps_s1s2 (int or float, optional) – Flavor-off-diagonal (nu_s1-nu_s2) NSI coupling. Default: 0.0.
eps_s2s2 (int or float, optional) – Diagonal NSI coupling of nu_s2. Default: 0.0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_2nu_sun_nsi(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, sth: int | float, Dm2: int | float, eps_aa: int | float | None = 0.0, eps_ab: int | float | None = 0.0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, strategy: str | None = 'auto', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the two-neutrino oscillation probability for neutrinos inside the Sun, including non-standard interactions (NSI).
For the electron density inside the Sun, it assumes an exponentially falling density profile: \(N_e(r) = N_e(0) \exp(-r/r_0)\), with \(N_e(0) = 245 N_\text{Av}~\text{cm}^{-3}\) and \(r_0 = R_\odot/10.54\). See Eq. (10.62) in Fundamentals of Neutrino Physics and Astrophysics by Carlo Giunti and Chung Wook Kim.
Examples
Two-neutrino oscillations through the Sun with non-standard interactions:
import warnings import magnus.oscprob as oscprob import magnus.globaldefs as gd from magnus.magnus import MagnusConvergenceWarning sth = gd.S12_NO_BF_NUFIT_6_0 Dm2 = gd.D21_NO_BF_NUFIT_6_0 energy = 15.0 * gd.UNIT_GEV # high enough energy for the adaptive refinement L0 = 0.0 # to converge cleanly under the default tolerance L = 0.9 * gd.SUN_RADIUS * gd.UNIT_KM # A trajectory through most of the Sun accumulates a large phase, so the # adaptive refinement needs a few loops to narrow the slabs; this is the # expected, informational MagnusConvergenceWarning discussed in the # package README, suppressed here to keep the example focused. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_2nu_sun_nsi(energy, L, L0, sth, Dm2, eps_aa=0.05, eps_ab=0.02) P
array([[0.792, 0.208], [0.208, 0.792]])Added in version 1.0.0.
Note
Dispatches to a fast, closed-form interaction-picture Magnus integrator whenever the accumulated matter phase stays small enough to certify (see
_osc_prob_ip_exp_dispatch), giving warning-free results in a fraction of a second across the realistic solar-neutrino energy range for baselines up to a few e-folds ofl_scale(the NSI couplings are folded into the same fast path). Longer baselines fall back transparently to the general slab-refinement method.- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
sth (int or float) – Sine of the mixing angle \(\theta\), the single mixing angle of the two-flavor system.
Dm2 (int or float) – Mass-squared difference \(\Delta m^2\) of the two-flavor system.
eps_aa (int or float, optional) – Non-universal diagonal NSI coupling of nu_e (relative to nu_mu, whose diagonal coupling is fixed to 0 by convention); see
hamiltonians.hamiltonian_2nu_nsi. Default: 0.0.eps_ab (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation. Default: ‘auto’.Added in version 1.0.0.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_3nu_sun_nsi(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, eps_ee: int | float | None = 0.0, eps_em: int | float | None = 0.0, eps_et: int | float | None = 0.0, eps_mm: int | float | None = 0.0, eps_mt: int | float | None = 0.0, eps_tt: int | float | None = 0.0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, strategy: str | None = 'auto', default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the three-neutrino oscillation probability for neutrinos inside the Sun.
For the electron density inside the Sun, it assumes an exponentially falling density profile: \(N_e(r) = N_e(0) \exp(-r/r_0)\), with \(N_e(0) = 245 N_\text{Av}~\text{cm}^{-3}\) and \(r_0 = R_\odot/10.54\). See Eq. (10.62) in Fundamentals of Neutrino Physics and Astrophysics by Carlo Giunti and Chung Wook Kim.
Examples
Three-neutrino oscillations through the Sun with non-standard interactions, using the NuFit 6.0 defaults for the standard oscillation parameters:
import warnings import magnus.oscprob as oscprob import magnus.globaldefs as gd from magnus.magnus import MagnusConvergenceWarning energy = 15.0 * gd.UNIT_GEV # high enough energy for the adaptive refinement L0 = 0.0 # to converge cleanly under the default tolerance L = 0.9 * gd.SUN_RADIUS * gd.UNIT_KM # A trajectory through most of the Sun accumulates a large phase, so the # adaptive refinement needs a few loops to narrow the slabs; this is the # expected, informational MagnusConvergenceWarning discussed in the # package README, suppressed here to keep the example focused. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_3nu_sun_nsi(energy, L, L0, eps_ee=0.05, eps_em=-0.03, eps_et=0.01) P
array([[0.066, 0.474, 0.46 ], [0.525, 0.115, 0.36 ], [0.409, 0.411, 0.18 ]])Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
eps_ee (int or float, optional) – Diagonal NSI coupling of nu_e. Default: 0.0.
eps_em (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
eps_et (int or float, optional) – Flavor-off-diagonal (nu_e-nu_tau) NSI coupling. Default: 0.0.
eps_mm (int or float, optional) – Diagonal NSI coupling of nu_mu. Default: 0.0.
eps_mt (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_tau) NSI coupling. Default: 0.0.
eps_tt (int or float, optional) – Diagonal NSI coupling of nu_tau. Default: 0.0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation. Default: ‘auto’.Added in version 1.0.0.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_4nu_sun_nsi(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s24: int | float | None = 0.0, s34: int | float | None = 0.0, d14: int | float | None = 0.0, d24: int | float | None = 0.0, D41: int | float | None = 0.0, eps_ee: int | float | None = 0.0, eps_em: int | float | None = 0.0, eps_et: int | float | None = 0.0, eps_es: int | float | None = 0.0, eps_mm: int | float | None = 0.0, eps_mt: int | float | None = 0.0, eps_ms: int | float | None = 0.0, eps_tt: int | float | None = 0.0, eps_ts: int | float | None = 0.0, eps_ss: int | float | None = 0.0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, strategy: str | None = 'auto', default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the four-neutrino (3+1) oscillation probability for neutrinos inside the Sun.
For the electron density inside the Sun, it assumes an exponentially falling density profile: \(N_e(r) = N_e(0) \exp(-r/r_0)\), with \(N_e(0) = 245 N_\text{Av}~\text{cm}^{-3}\) and \(r_0 = R_\odot/10.54\). See Eq. (10.62) in Fundamentals of Neutrino Physics and Astrophysics by Carlo Giunti and Chung Wook Kim.
Examples
Four-neutrino (3+1 sterile) oscillations through the Sun with non-standard interactions, including the sterile-flavor couplings:
import warnings import numpy as np import magnus.oscprob as oscprob import magnus.globaldefs as gd from magnus.magnus import MagnusConvergenceWarning energy = 15.0 * gd.UNIT_GEV # high enough energy for the adaptive refinement L0 = 0.0 # to converge cleanly under the default tolerance L = 0.9 * gd.SUN_RADIUS * gd.UNIT_KM # A trajectory through most of the Sun accumulates a large phase, so the # adaptive refinement needs a few loops to narrow the slabs; this is the # expected, informational MagnusConvergenceWarning discussed in the # package README, suppressed here to keep the example focused. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_4nu_sun_nsi( energy, L, L0, s14=0.1, s24=0.05, s34=0.02, d14=np.radians(10.0), d24=np.radians(20.0), D41=0.1, eps_ee=0.05, eps_em=-0.03, eps_et=0.01, eps_es=0.02, eps_ms=0.01, eps_ts=0.01) P
array([[0.009, 0.003, 0.005, 0.983], [0.109, 0.504, 0.384, 0.003], [0.855, 0.127, 0.009, 0.01 ], [0.027, 0.366, 0.602, 0.005]])Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
eps_ee (int or float, optional) – Diagonal NSI coupling of nu_e. Default: 0.0.
eps_em (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
eps_et (int or float, optional) – Flavor-off-diagonal (nu_e-nu_tau) NSI coupling. Default: 0.0.
eps_es (int or float, optional) – Flavor-off-diagonal (nu_e-nu_s) NSI coupling. Default: 0.0.
eps_mm (int or float, optional) – Diagonal NSI coupling of nu_mu. Default: 0.0.
eps_mt (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_tau) NSI coupling. Default: 0.0.
eps_ms (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_s) NSI coupling. Default: 0.0.
eps_tt (int or float, optional) – Diagonal NSI coupling of nu_tau. Default: 0.0.
eps_ts (int or float, optional) – Flavor-off-diagonal (nu_tau-nu_s) NSI coupling. Default: 0.0.
eps_ss (int or float, optional) – Diagonal NSI coupling of nu_s. Default: 0.0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation. Default: ‘auto’.Added in version 1.0.0.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_5nu_sun_nsi(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s15: int | float | None = 0.0, s24: int | float | None = 0.0, s25: int | float | None = 0.0, s34: int | float | None = 0.0, s35: int | float | None = 0.0, d14: int | float | None = 0.0, d15: int | float | None = 0.0, d24: int | float | None = 0.0, d35: int | float | None = 0.0, D41: int | float | None = 0.0, D51: int | float | None = 0.0, eps_ee: int | float | None = 0.0, eps_em: int | float | None = 0.0, eps_et: int | float | None = 0.0, eps_es1: int | float | None = 0.0, eps_es2: int | float | None = 0.0, eps_mm: int | float | None = 0.0, eps_mt: int | float | None = 0.0, eps_ms1: int | float | None = 0.0, eps_ms2: int | float | None = 0.0, eps_tt: int | float | None = 0.0, eps_ts1: int | float | None = 0.0, eps_ts2: int | float | None = 0.0, eps_s1s1: int | float | None = 0.0, eps_s1s2: int | float | None = 0.0, eps_s2s2: int | float | None = 0.0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, strategy: str | None = 'auto', default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the five-neutrino (3+2) oscillation probability for neutrinos inside the Sun.
For the electron density inside the Sun, it assumes an exponentially falling density profile: \(N_e(r) = N_e(0) \exp(-r/r_0)\), with \(N_e(0) = 245 N_\text{Av}~\text{cm}^{-3}\) and \(r_0 = R_\odot/10.54\). See Eq. (10.62) in Fundamentals of Neutrino Physics and Astrophysics by Carlo Giunti and Chung Wook Kim.
Examples
Five-neutrino (3+2 sterile) oscillations through the Sun with non-standard interactions, including the sterile-flavor couplings:
import warnings import numpy as np import magnus.oscprob as oscprob import magnus.globaldefs as gd from magnus.magnus import MagnusConvergenceWarning energy = 15.0 * gd.UNIT_GEV # high enough energy for the adaptive refinement L0 = 0.0 # to converge cleanly under the default tolerance L = 0.9 * gd.SUN_RADIUS * gd.UNIT_KM # A trajectory through most of the Sun accumulates a large phase, so the # adaptive refinement needs a few loops to narrow the slabs; this is the # expected, informational MagnusConvergenceWarning discussed in the # package README, suppressed here to keep the example focused. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_5nu_sun_nsi( energy, L, L0, s14=0.1, s15=0.05, s24=0.05, s25=0.02, s34=0.02, s35=0.01, d14=np.radians(10.0), d15=np.radians(15.0), d24=np.radians(20.0), d35=np.radians(25.0), D41=0.1, D51=0.05, eps_ee=0.05, eps_em=-0.03, eps_et=0.01, eps_es1=0.02, eps_es2=0.01, eps_ms1=0.01, eps_ms2=0.01, eps_ts1=0.01, eps_ts2=0.01) P
array([[8.733e-03, 1.597e-03, 2.193e-03, 9.862e-01, 1.271e-03], [8.987e-02, 5.240e-01, 3.763e-01, 2.580e-04, 9.571e-03], [7.572e-01, 7.234e-02, 1.593e-01, 1.037e-02, 7.742e-04], [2.202e-03, 5.345e-03, 2.807e-03, 1.414e-03, 9.882e-01], [1.420e-01, 3.968e-01, 4.594e-01, 1.751e-03, 1.519e-04]])Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s15 (int or float, optional) – Sine of the mixing angle \(\theta_{15}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s25 (int or float, optional) – Sine of the mixing angle \(\theta_{25}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
s35 (int or float, optional) – Sine of the mixing angle \(\theta_{35}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d15 (int or float, optional) – \(\delta_{15}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
d35 (int or float, optional) – \(\delta_{35}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
D51 (int or float, optional) – Mass-squared difference \(\Delta m_{51}^2\). Default: 0.0.
eps_ee (int or float, optional) – Diagonal NSI coupling of nu_e. Default: 0.0.
eps_em (int or float, optional) – Flavor-off-diagonal (nu_e-nu_mu) NSI coupling. Default: 0.0.
eps_et (int or float, optional) – Flavor-off-diagonal (nu_e-nu_tau) NSI coupling. Default: 0.0.
eps_es1 (int or float, optional) – Flavor-off-diagonal (nu_e-nu_s1) NSI coupling. Default: 0.0.
eps_es2 (int or float, optional) – Flavor-off-diagonal (nu_e-nu_s2) NSI coupling. Default: 0.0.
eps_mm (int or float, optional) – Diagonal NSI coupling of nu_mu. Default: 0.0.
eps_mt (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_tau) NSI coupling. Default: 0.0.
eps_ms1 (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_s1) NSI coupling. Default: 0.0.
eps_ms2 (int or float, optional) – Flavor-off-diagonal (nu_mu-nu_s2) NSI coupling. Default: 0.0.
eps_tt (int or float, optional) – Diagonal NSI coupling of nu_tau. Default: 0.0.
eps_ts1 (int or float, optional) – Flavor-off-diagonal (nu_tau-nu_s1) NSI coupling. Default: 0.0.
eps_ts2 (int or float, optional) – Flavor-off-diagonal (nu_tau-nu_s2) NSI coupling. Default: 0.0.
eps_s1s1 (int or float, optional) – Diagonal NSI coupling of nu_s1. Default: 0.0.
eps_s1s2 (int or float, optional) – Flavor-off-diagonal (nu_s1-nu_s2) NSI coupling. Default: 0.0.
eps_s2s2 (int or float, optional) – Diagonal NSI coupling of nu_s2. Default: 0.0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation. Default: ‘auto’.Added in version 1.0.0.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_2nu_vacuum_liv(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, sth: int | float, Dm2: int | float, sxi: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, nu_i: int | None = None, nu_f: int | None = None, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the two-neutrino oscillation probability in vacuum under (one form of) Lorentz-invariance violation.
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
sth (int or float) – Sine of the mixing angle \(\theta\), the single mixing angle of the two-flavor system.
Dm2 (int or float) – Mass-squared difference \(\Delta m^2\) of the two-flavor system.
sxi (int or float, optional) – Sin(xi), with xi the rotation angle between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_3nu_vacuum_liv(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxiCP: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the three-neutrino oscillation probability in vacuum under (one form of) Lorentz-invariance violation.
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxiCP (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_4nu_vacuum_liv(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s24: int | float | None = 0.0, s34: int | float | None = 0.0, d14: int | float | None = 0.0, d24: int | float | None = 0.0, D41: int | float | None = 0.0, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxi13: int | float | None = 0.0, sxi14: int | float | None = 0.0, dxi14: int | float | None = 0.0, sxi24: int | float | None = 0.0, dxi24: int | float | None = 0.0, sxi34: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, b4: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the four-neutrino oscillation probability in vacuum under (one form of) Lorentz-invariance violation.
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxi13 (int or float, optional) – CP-violation phase of the LIV operator [radian] (replaces
dxiCPfor 4/5-flavor systems). Default: 0.0.sxi14 (int or float, optional) – Sin(xi_14); see
sxi12. Default: 0.0.dxi14 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi24 (int or float, optional) – Sin(xi_24); see
sxi12. Default: 0.0.dxi24 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi34 (int or float, optional) – Sin(xi_34); see
sxi12. Default: 0.0.b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
b4 (int or float, optional) – Eigenvalue b4 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_5nu_vacuum_liv(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s15: int | float | None = 0.0, s24: int | float | None = 0.0, s25: int | float | None = 0.0, s34: int | float | None = 0.0, s35: int | float | None = 0.0, d14: int | float | None = 0.0, d15: int | float | None = 0.0, d24: int | float | None = 0.0, d35: int | float | None = 0.0, D41: int | float | None = 0.0, D51: int | float | None = 0.0, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxi13: int | float | None = 0.0, sxi14: int | float | None = 0.0, dxi14: int | float | None = 0.0, sxi15: int | float | None = 0.0, dxi15: int | float | None = 0.0, sxi24: int | float | None = 0.0, dxi24: int | float | None = 0.0, sxi25: int | float | None = 0.0, sxi34: int | float | None = 0.0, sxi35: int | float | None = 0.0, dxi35: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, b4: int | float | None = 0.0, b5: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the five-neutrino oscillation probability in vacuum under (one form of) Lorentz-invariance violation.
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s15 (int or float, optional) – Sine of the mixing angle \(\theta_{15}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s25 (int or float, optional) – Sine of the mixing angle \(\theta_{25}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
s35 (int or float, optional) – Sine of the mixing angle \(\theta_{35}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d15 (int or float, optional) – \(\delta_{15}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
d35 (int or float, optional) – \(\delta_{35}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
D51 (int or float, optional) – Mass-squared difference \(\Delta m_{51}^2\). Default: 0.0.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxi13 (int or float, optional) – CP-violation phase of the LIV operator [radian] (replaces
dxiCPfor 4/5-flavor systems). Default: 0.0.sxi14 (int or float, optional) – Sin(xi_14); see
sxi12. Default: 0.0.dxi14 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi15 (int or float, optional) – Sin(xi_15); see
sxi12. Default: 0.0.dxi15 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi24 (int or float, optional) – Sin(xi_24); see
sxi12. Default: 0.0.dxi24 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi25 (int or float, optional) – Sin(xi_25); see
sxi12. Default: 0.0.sxi34 (int or float, optional) – Sin(xi_34); see
sxi12. Default: 0.0.sxi35 (int or float, optional) – Sin(xi_35); see
sxi12. Default: 0.0.dxi35 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
b4 (int or float, optional) – Eigenvalue b4 of the LIV operator. Default: 0.0.
b5 (int or float, optional) – Eigenvalue b5 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_2nu_matter_liv_constant_density(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, rho: int | float, sth: int | float, Dm2: int | float, sxi: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the two-neutrino oscillation probability in matter with a constant density profile, under (one form of) Lorentz-invariance violation.
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
rho (int or float) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True).sth (int or float) – Sine of the mixing angle \(\theta\), the single mixing angle of the two-flavor system.
Dm2 (int or float) – Mass-squared difference \(\Delta m^2\) of the two-flavor system.
sxi (int or float, optional) – Sin(xi), with xi the rotation angle between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_3nu_matter_liv_constant_density(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, rho: int | float | None, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxiCP: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the three-neutrino oscillation probability in matter with a constant density profile, under (one form of) Lorentz-invariance violation.
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
rho (int or float) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True).s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxiCP (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_4nu_matter_liv_constant_density(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, rho: int | float | None, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s24: int | float | None = 0.0, s34: int | float | None = 0.0, d14: int | float | None = 0.0, d24: int | float | None = 0.0, D41: int | float | None = 0.0, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxi13: int | float | None = 0.0, sxi14: int | float | None = 0.0, dxi14: int | float | None = 0.0, sxi24: int | float | None = 0.0, dxi24: int | float | None = 0.0, sxi34: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, b4: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the four-neutrino oscillation probability in matter with a constant density profile, under (one form of) Lorentz-invariance violation.
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
rho (int or float) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True).s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxi13 (int or float, optional) – CP-violation phase of the LIV operator [radian] (replaces
dxiCPfor 4/5-flavor systems). Default: 0.0.sxi14 (int or float, optional) – Sin(xi_14); see
sxi12. Default: 0.0.dxi14 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi24 (int or float, optional) – Sin(xi_24); see
sxi12. Default: 0.0.dxi24 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi34 (int or float, optional) – Sin(xi_34); see
sxi12. Default: 0.0.b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
b4 (int or float, optional) – Eigenvalue b4 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_5nu_matter_liv_constant_density(energy: int | float | list | numpy.ndarray, L: int | float | list | numpy.ndarray, rho: int | float | None, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s15: int | float | None = 0.0, s24: int | float | None = 0.0, s25: int | float | None = 0.0, s34: int | float | None = 0.0, s35: int | float | None = 0.0, d14: int | float | None = 0.0, d15: int | float | None = 0.0, d24: int | float | None = 0.0, d35: int | float | None = 0.0, D41: int | float | None = 0.0, D51: int | float | None = 0.0, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxi13: int | float | None = 0.0, sxi14: int | float | None = 0.0, dxi14: int | float | None = 0.0, sxi15: int | float | None = 0.0, dxi15: int | float | None = 0.0, sxi24: int | float | None = 0.0, dxi24: int | float | None = 0.0, sxi25: int | float | None = 0.0, sxi34: int | float | None = 0.0, sxi35: int | float | None = 0.0, dxi35: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, b4: int | float | None = 0.0, b5: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the five-neutrino oscillation probability in matter with a constant density profile, under (one form of) Lorentz-invariance violation.
Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
rho (int or float) – Matter density (or electron number density, if
density_is_of_number_of_electronsis True).s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s15 (int or float, optional) – Sine of the mixing angle \(\theta_{15}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s25 (int or float, optional) – Sine of the mixing angle \(\theta_{25}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
s35 (int or float, optional) – Sine of the mixing angle \(\theta_{35}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d15 (int or float, optional) – \(\delta_{15}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
d35 (int or float, optional) – \(\delta_{35}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
D51 (int or float, optional) – Mass-squared difference \(\Delta m_{51}^2\). Default: 0.0.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxi13 (int or float, optional) – CP-violation phase of the LIV operator [radian] (replaces
dxiCPfor 4/5-flavor systems). Default: 0.0.sxi14 (int or float, optional) – Sin(xi_14); see
sxi12. Default: 0.0.dxi14 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi15 (int or float, optional) – Sin(xi_15); see
sxi12. Default: 0.0.dxi15 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi24 (int or float, optional) – Sin(xi_24); see
sxi12. Default: 0.0.dxi24 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi25 (int or float, optional) – Sin(xi_25); see
sxi12. Default: 0.0.sxi34 (int or float, optional) – Sin(xi_34); see
sxi12. Default: 0.0.sxi35 (int or float, optional) – Sin(xi_35); see
sxi12. Default: 0.0.dxi35 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
b4 (int or float, optional) – Eigenvalue b4 of the LIV operator. Default: 0.0.
b5 (int or float, optional) – Eigenvalue b5 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_2nu_matter_liv_exp_density(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, rho_central: int | float, l_scale: int | float, sth: int | float, Dm2: int | float, sxi: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the two-neutrino oscillation probability in matter with an exponentially falling density profile, under (one form of) Lorentz-invariance violation.
Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
rho_central (int or float) – Matter density (or electron number density) at the center of the exponential profile (l = 0).
l_scale (int or float) – Length scale of the exponential density decrease.
sth (int or float) – Sine of the mixing angle \(\theta\), the single mixing angle of the two-flavor system.
Dm2 (int or float) – Mass-squared difference \(\Delta m^2\) of the two-flavor system.
sxi (int or float, optional) – Sin(xi), with xi the rotation angle between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_3nu_matter_liv_exp_density(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, rho_central: int | float, l_scale: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxiCP: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the three-neutrino oscillation probability in matter with an exponentially falling density profile, under (one form of) Lorentz-invariance violation.
Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
rho_central (int or float) – Matter density (or electron number density) at the center of the exponential profile (l = 0).
l_scale (int or float) – Length scale of the exponential density decrease.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxiCP (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_4nu_matter_liv_exp_density(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, rho_central: int | float, l_scale: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s24: int | float | None = 0.0, s34: int | float | None = 0.0, d14: int | float | None = 0.0, d24: int | float | None = 0.0, D41: int | float | None = 0.0, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxi13: int | float | None = 0.0, sxi14: int | float | None = 0.0, dxi14: int | float | None = 0.0, sxi24: int | float | None = 0.0, dxi24: int | float | None = 0.0, sxi34: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, b4: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the four-neutrino oscillation probability in matter with an exponentially falling density profile, under (one form of) Lorentz-invariance violation.
Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
rho_central (int or float) – Matter density (or electron number density) at the center of the exponential profile (l = 0).
l_scale (int or float) – Length scale of the exponential density decrease.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxi13 (int or float, optional) – CP-violation phase of the LIV operator [radian] (replaces
dxiCPfor 4/5-flavor systems). Default: 0.0.sxi14 (int or float, optional) – Sin(xi_14); see
sxi12. Default: 0.0.dxi14 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi24 (int or float, optional) – Sin(xi_24); see
sxi12. Default: 0.0.dxi24 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi34 (int or float, optional) – Sin(xi_34); see
sxi12. Default: 0.0.b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
b4 (int or float, optional) – Eigenvalue b4 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_5nu_matter_liv_exp_density(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, rho_central: int | float, l_scale: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s15: int | float | None = 0.0, s24: int | float | None = 0.0, s25: int | float | None = 0.0, s34: int | float | None = 0.0, s35: int | float | None = 0.0, d14: int | float | None = 0.0, d15: int | float | None = 0.0, d24: int | float | None = 0.0, d35: int | float | None = 0.0, D41: int | float | None = 0.0, D51: int | float | None = 0.0, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxi13: int | float | None = 0.0, sxi14: int | float | None = 0.0, dxi14: int | float | None = 0.0, sxi15: int | float | None = 0.0, dxi15: int | float | None = 0.0, sxi24: int | float | None = 0.0, dxi24: int | float | None = 0.0, sxi25: int | float | None = 0.0, sxi34: int | float | None = 0.0, sxi35: int | float | None = 0.0, dxi35: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, b4: int | float | None = 0.0, b5: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the five-neutrino oscillation probability in matter with an exponentially falling density profile, under (one form of) Lorentz-invariance violation.
Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
rho_central (int or float) – Matter density (or electron number density) at the center of the exponential profile (l = 0).
l_scale (int or float) – Length scale of the exponential density decrease.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s15 (int or float, optional) – Sine of the mixing angle \(\theta_{15}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s25 (int or float, optional) – Sine of the mixing angle \(\theta_{25}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
s35 (int or float, optional) – Sine of the mixing angle \(\theta_{35}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d15 (int or float, optional) – \(\delta_{15}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
d35 (int or float, optional) – \(\delta_{35}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
D51 (int or float, optional) – Mass-squared difference \(\Delta m_{51}^2\). Default: 0.0.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxi13 (int or float, optional) – CP-violation phase of the LIV operator [radian] (replaces
dxiCPfor 4/5-flavor systems). Default: 0.0.sxi14 (int or float, optional) – Sin(xi_14); see
sxi12. Default: 0.0.dxi14 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi15 (int or float, optional) – Sin(xi_15); see
sxi12. Default: 0.0.dxi15 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi24 (int or float, optional) – Sin(xi_24); see
sxi12. Default: 0.0.dxi24 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi25 (int or float, optional) – Sin(xi_25); see
sxi12. Default: 0.0.sxi34 (int or float, optional) – Sin(xi_34); see
sxi12. Default: 0.0.sxi35 (int or float, optional) – Sin(xi_35); see
sxi12. Default: 0.0.dxi35 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
b4 (int or float, optional) – Eigenvalue b4 of the LIV operator. Default: 0.0.
b5 (int or float, optional) – Eigenvalue b5 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_2nu_earth_liv(energy: int | float | list | numpy.ndarray, sth: int | float, Dm2: int | float, sxi: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, costhz: int | float | None = None, loc_ini: Tuple[float, float] | list | numpy.ndarray | str | None = None, loc_fin: Tuple[float, float] | list | numpy.ndarray | str | None = None, L: float | list | numpy.ndarray | None = None, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the two-neutrino oscillation probability inside the Earth, either between two locations on the surface of the Earth, or between the surface and a point in the interior, under (one form of) Lorentz-invariance violation.
For the matter density inside the Earth, it uses the Preliminary Reference Earth Model.
If the initial location (
loc_ini) and final location (loc_fin) on the surface of the Earth are given (i.e., if they are notNone), then the neutrino travels the chord joining them through the Earth, overriding any given value of costhz given, and using the chord length as the baseline.The initial and final location can be given as a three-entry tuple of coordinates in the (degree, minute, second) format. Alternatively, any of the two locations can be given as a predefined named location. The predefined locations are in the earth.loc_coords_dms dictionary:
import magnus.earth as earth list(earth.loc_coords_dms.keys())
['baikal', 'cern', 'desy', 'ess', 'fermilab', 'gran_sasso', 'homestake', 'kamioka', 'km3net_arca', 'km3net_orca', 'north_pole', 'pyhaasalmi', 'snolab', 'south_pole', 'tokai']
print(earth.loc_coords_dms['fermilab'])
{'lat': (41, 49, 55), 'lon': (-88, 15, 26)}See the example below.
[If only a single location is given (i.e., if either
loc_iniorloc_finareNone), the function throws an exception.]If neither of the two locations is given, the function uses the given value of
costhzas direction and ofLas baseline. (AndLcan be an array of baselines.)Examples
Two-neutrino oscillations through the Earth under Lorentz-invariance violation:
import warnings import magnus.oscprob as oscprob import magnus.globaldefs as gd from magnus.magnus import MagnusConvergenceWarning sth = gd.S12_NO_BF_NUFIT_6_0 Dm2 = gd.D21_NO_BF_NUFIT_6_0 costhz = -0.8 baseline = 2.0 * gd.EARTH_RADIUS * 0.8 * gd.UNIT_KM energy = 1.0 * gd.UNIT_GEV # The small solar mass splitting Dm2 combined with this Earth baseline # means the adaptive refinement needs a few loops; this is the expected, # informational MagnusConvergenceWarning discussed in the package README. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_2nu_earth_liv(energy, sth, Dm2, sxi=0.1, b1=1.e-13, b2=2.e-13, Lambda=1.e9, n_liv=1, costhz=costhz, L=baseline) P
array([[0.899, 0.101], [0.101, 0.899]])Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
sth (int or float) – Sine of the mixing angle \(\theta\), the single mixing angle of the two-flavor system.
Dm2 (int or float) – Mass-squared difference \(\Delta m^2\) of the two-flavor system.
sxi (int or float, optional) – Sin(xi), with xi the rotation angle between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
costhz (int or float, optional) – Cosine of the zenith angle of the neutrino. Used together with
L, as an alternative toloc_ini/loc_fin. Default: None.loc_ini (tuple, list, np.ndarray, or str, optional) – Initial location on the surface of the Earth, as (latitude, longitude) coordinates or a predefined location name (see
earth.loc_coords_dms). Must be given withloc_fin. Default: None.loc_fin (tuple, list, np.ndarray, or str, optional) – Final location, same format as
loc_ini. Must be given withloc_ini. Default: None.L (float, list, or np.ndarray, optional) – Baseline(s). Default: None.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_3nu_earth_liv(energy: int | float | list | numpy.ndarray, costhz: int | float | None = None, loc_ini: Tuple[float, float] | list | numpy.ndarray | str | None = None, loc_fin: Tuple[float, float] | list | numpy.ndarray | str | None = None, L: float | list | numpy.ndarray | None = None, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxiCP: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the three-neutrino oscillation probability inside the Earth, either between two locations on the surface of the Earth, or between the surface and a point in the interior, under (one form of) Lorentz-invariance violation.
For the matter density inside the Earth, it uses the Preliminary Reference Earth Model.
If the initial location (
loc_ini) and final location (loc_fin) on the surface of the Earth are given (i.e., if they are notNone), then the neutrino travels the chord joining them through the Earth, overriding any given value of costhz given, and using the chord length as the baseline.The initial and final location can be given as a three-entry tuple of coordinates in the (degree, minute, second) format. Alternatively, any of the two locations can be given as a predefined named location. The predefined locations are in the earth.loc_coords_dms dictionary:
import magnus.earth as earth list(earth.loc_coords_dms.keys())
['baikal', 'cern', 'desy', 'ess', 'fermilab', 'gran_sasso', 'homestake', 'kamioka', 'km3net_arca', 'km3net_orca', 'north_pole', 'pyhaasalmi', 'snolab', 'south_pole', 'tokai']
print(earth.loc_coords_dms['fermilab'])
{'lat': (41, 49, 55), 'lon': (-88, 15, 26)}See the example below.
[If only a single location is given (i.e., if either
loc_iniorloc_finareNone), the function throws an exception.]If neither of the two locations is given, the function uses the given value of
costhzas direction and ofLas baseline. (AndLcan be an array of baselines.)Examples
Three-neutrino oscillations through the Earth under Lorentz-invariance violation, using the NuFit 6.0 defaults for the standard oscillation parameters:
import magnus.oscprob as oscprob import magnus.globaldefs as gd import warnings from magnus.magnus import MagnusConvergenceWarning costhz = -0.8 baseline = 2.0 * gd.EARTH_RADIUS * 0.8 * gd.UNIT_KM energy = 1.0 * gd.UNIT_GEV # The chosen baseline/energy combination needs a few adaptive-refinement # loops to converge; this is the expected, informational # MagnusConvergenceWarning discussed in the package README. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_3nu_earth_liv( energy, costhz=costhz, L=baseline, sxi12=0.1, sxi23=0.05, sxi13=0.02, dxiCP=0.3, b1=1.e-13, b2=2.e-13, b3=3.e-13, Lambda=1.e9, n_liv=1) P
array([[0.613, 0.231, 0.156], [0.199, 0.249, 0.551], [0.188, 0.52 , 0.293]])Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
costhz (int or float, optional) – Cosine of the zenith angle of the neutrino. Used together with
L, as an alternative toloc_ini/loc_fin. Default: None.loc_ini (tuple, list, np.ndarray, or str, optional) – Initial location on the surface of the Earth, as (latitude, longitude) coordinates or a predefined location name (see
earth.loc_coords_dms). Must be given withloc_fin. Default: None.loc_fin (tuple, list, np.ndarray, or str, optional) – Final location, same format as
loc_ini. Must be given withloc_ini. Default: None.L (float, list, or np.ndarray, optional) – Baseline(s). Default: None.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxiCP (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_4nu_earth_liv(energy: int | float | list | numpy.ndarray, costhz: int | float | None = None, loc_ini: Tuple[float, float] | list | numpy.ndarray | str | None = None, loc_fin: Tuple[float, float] | list | numpy.ndarray | str | None = None, L: float | list | numpy.ndarray | None = None, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s24: int | float | None = 0.0, s34: int | float | None = 0.0, d14: int | float | None = 0.0, d24: int | float | None = 0.0, D41: int | float | None = 0.0, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxi13: int | float | None = 0.0, sxi14: int | float | None = 0.0, dxi14: int | float | None = 0.0, sxi24: int | float | None = 0.0, dxi24: int | float | None = 0.0, sxi34: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, b4: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the four-neutrino oscillation probability inside the Earth, either between two locations on the surface of the Earth, or between the surface and a point in the interior, under (one form of) Lorentz-invariance violation.
For the matter density inside the Earth, it uses the Preliminary Reference Earth Model.
If the initial location (
loc_ini) and final location (loc_fin) on the surface of the Earth are given (i.e., if they are notNone), then the neutrino travels the chord joining them through the Earth, overriding any given value of costhz given, and using the chord length as the baseline.The initial and final location can be given as a three-entry tuple of coordinates in the (degree, minute, second) format. Alternatively, any of the two locations can be given as a predefined named location. The predefined locations are in the earth.loc_coords_dms dictionary:
import magnus.earth as earth list(earth.loc_coords_dms.keys())
['baikal', 'cern', 'desy', 'ess', 'fermilab', 'gran_sasso', 'homestake', 'kamioka', 'km3net_arca', 'km3net_orca', 'north_pole', 'pyhaasalmi', 'snolab', 'south_pole', 'tokai']
print(earth.loc_coords_dms['fermilab'])
{'lat': (41, 49, 55), 'lon': (-88, 15, 26)}See the example below.
[If only a single location is given (i.e., if either
loc_iniorloc_finareNone), the function throws an exception.]If neither of the two locations is given, the function uses the given value of
costhzas direction and ofLas baseline. (AndLcan be an array of baselines.)Examples
Four-neutrino (3+1 sterile) oscillations through the Earth under Lorentz-invariance violation:
import magnus.oscprob as oscprob import magnus.globaldefs as gd import warnings from magnus.magnus import MagnusConvergenceWarning costhz = -0.8 baseline = 2.0 * gd.EARTH_RADIUS * 0.8 * gd.UNIT_KM energy = 1.0 * gd.UNIT_GEV # The chosen baseline/energy combination needs a few adaptive-refinement # loops to converge; this is the expected, informational # MagnusConvergenceWarning discussed in the package README. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_4nu_earth_liv( energy, costhz=costhz, L=baseline, sxi12=0.1, sxi23=0.05, sxi13=0.02, dxi13=0.2, sxi14=0.05, dxi14=0.4, sxi24=0.03, dxi24=0.5, sxi34=0.02, b1=1.e-13, b2=2.e-13, b3=3.e-13, b4=1.e-13, Lambda=1.e9, n_liv=1) P
array([[6.167e-01, 2.284e-01, 1.547e-01, 1.674e-04], [1.976e-01, 2.535e-01, 5.489e-01, 3.974e-06], [1.856e-01, 5.179e-01, 2.964e-01, 1.194e-04], [4.304e-05, 1.770e-04, 7.072e-05, 9.997e-01]])Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
costhz (int or float, optional) – Cosine of the zenith angle of the neutrino. Used together with
L, as an alternative toloc_ini/loc_fin. Default: None.loc_ini (tuple, list, np.ndarray, or str, optional) – Initial location on the surface of the Earth, as (latitude, longitude) coordinates or a predefined location name (see
earth.loc_coords_dms). Must be given withloc_fin. Default: None.loc_fin (tuple, list, np.ndarray, or str, optional) – Final location, same format as
loc_ini. Must be given withloc_ini. Default: None.L (float, list, or np.ndarray, optional) – Baseline(s). Default: None.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxi13 (int or float, optional) – CP-violation phase of the LIV operator [radian] (replaces
dxiCPfor 4/5-flavor systems). Default: 0.0.sxi14 (int or float, optional) – Sin(xi_14); see
sxi12. Default: 0.0.dxi14 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi24 (int or float, optional) – Sin(xi_24); see
sxi12. Default: 0.0.dxi24 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi34 (int or float, optional) – Sin(xi_34); see
sxi12. Default: 0.0.b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
b4 (int or float, optional) – Eigenvalue b4 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_5nu_earth_liv(energy: int | float | list | numpy.ndarray, costhz: int | float | None = None, loc_ini: Tuple[float, float] | list | numpy.ndarray | str | None = None, loc_fin: Tuple[float, float] | list | numpy.ndarray | str | None = None, L: float | list | numpy.ndarray | None = None, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s15: int | float | None = 0.0, s24: int | float | None = 0.0, s25: int | float | None = 0.0, s34: int | float | None = 0.0, s35: int | float | None = 0.0, d14: int | float | None = 0.0, d15: int | float | None = 0.0, d24: int | float | None = 0.0, d35: int | float | None = 0.0, D41: int | float | None = 0.0, D51: int | float | None = 0.0, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxi13: int | float | None = 0.0, sxi14: int | float | None = 0.0, dxi14: int | float | None = 0.0, sxi15: int | float | None = 0.0, dxi15: int | float | None = 0.0, sxi24: int | float | None = 0.0, dxi24: int | float | None = 0.0, sxi25: int | float | None = 0.0, sxi34: int | float | None = 0.0, sxi35: int | float | None = 0.0, dxi35: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, b4: int | float | None = 0.0, b5: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, default_osc_params_set_name: str | None = 'OSC_PARAMS_DEFAULT', validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the five-neutrino oscillation probability inside the Earth, either between two locations on the surface of the Earth, or between the surface and a point in the interior, under (one form of) Lorentz-invariance violation.
For the matter density inside the Earth, it uses the Preliminary Reference Earth Model.
If the initial location (
loc_ini) and final location (loc_fin) on the surface of the Earth are given (i.e., if they are notNone), then the neutrino travels the chord joining them through the Earth, overriding any given value of costhz given, and using the chord length as the baseline.The initial and final location can be given as a three-entry tuple of coordinates in the (degree, minute, second) format. Alternatively, any of the two locations can be given as a predefined named location. The predefined locations are in the earth.loc_coords_dms dictionary:
import magnus.earth as earth list(earth.loc_coords_dms.keys())
['baikal', 'cern', 'desy', 'ess', 'fermilab', 'gran_sasso', 'homestake', 'kamioka', 'km3net_arca', 'km3net_orca', 'north_pole', 'pyhaasalmi', 'snolab', 'south_pole', 'tokai']
print(earth.loc_coords_dms['fermilab'])
{'lat': (41, 49, 55), 'lon': (-88, 15, 26)}See the example below.
[If only a single location is given (i.e., if either
loc_iniorloc_finareNone), the function throws an exception.]If neither of the two locations is given, the function uses the given value of
costhzas direction and ofLas baseline. (AndLcan be an array of baselines.)Examples
Five-neutrino (3+2 sterile) oscillations through the Earth under Lorentz-invariance violation:
import magnus.oscprob as oscprob import magnus.globaldefs as gd import warnings from magnus.magnus import MagnusConvergenceWarning costhz = -0.8 baseline = 2.0 * gd.EARTH_RADIUS * 0.8 * gd.UNIT_KM energy = 1.0 * gd.UNIT_GEV # The chosen baseline/energy combination needs a few adaptive-refinement # loops to converge; this is the expected, informational # MagnusConvergenceWarning discussed in the package README. with warnings.catch_warnings(): warnings.simplefilter('ignore', MagnusConvergenceWarning) P = oscprob.osc_prob_5nu_earth_liv( energy, costhz=costhz, L=baseline, sxi12=0.1, sxi23=0.05, sxi13=0.02, dxi13=0.2, sxi14=0.05, dxi14=0.4, sxi15=0.02, dxi15=0.6, sxi24=0.03, dxi24=0.5, sxi25=0.01, sxi34=0.02, sxi35=0.01, dxi35=0.7, b1=1.e-13, b2=2.e-13, b3=3.e-13, b4=1.e-13, b5=1.e-13, Lambda=1.e9, n_liv=1) P
array([[6.168e-01, 2.284e-01, 1.546e-01, 1.676e-04, 9.810e-06], [1.975e-01, 2.539e-01, 5.485e-01, 3.955e-06, 5.702e-05], [1.856e-01, 5.175e-01, 2.968e-01, 1.197e-04, 3.441e-05], [4.315e-05, 1.770e-04, 7.053e-05, 9.997e-01, 1.232e-05], [1.908e-05, 1.747e-05, 6.527e-05, 1.175e-05, 9.999e-01]])Added in version 1.0.0.
- Parameters:
energy (int, float, list, or np.ndarray) – Neutrino energy/energies.
costhz (int or float, optional) – Cosine of the zenith angle of the neutrino. Used together with
L, as an alternative toloc_ini/loc_fin. Default: None.loc_ini (tuple, list, np.ndarray, or str, optional) – Initial location on the surface of the Earth, as (latitude, longitude) coordinates or a predefined location name (see
earth.loc_coords_dms). Must be given withloc_fin. Default: None.loc_fin (tuple, list, np.ndarray, or str, optional) – Final location, same format as
loc_ini. Must be given withloc_ini. Default: None.L (float, list, or np.ndarray, optional) – Baseline(s). Default: None.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s15 (int or float, optional) – Sine of the mixing angle \(\theta_{15}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s25 (int or float, optional) – Sine of the mixing angle \(\theta_{25}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
s35 (int or float, optional) – Sine of the mixing angle \(\theta_{35}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d15 (int or float, optional) – \(\delta_{15}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
d35 (int or float, optional) – \(\delta_{35}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
D51 (int or float, optional) – Mass-squared difference \(\Delta m_{51}^2\). Default: 0.0.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxi13 (int or float, optional) – CP-violation phase of the LIV operator [radian] (replaces
dxiCPfor 4/5-flavor systems). Default: 0.0.sxi14 (int or float, optional) – Sin(xi_14); see
sxi12. Default: 0.0.dxi14 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi15 (int or float, optional) – Sin(xi_15); see
sxi12. Default: 0.0.dxi15 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi24 (int or float, optional) – Sin(xi_24); see
sxi12. Default: 0.0.dxi24 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi25 (int or float, optional) – Sin(xi_25); see
sxi12. Default: 0.0.sxi34 (int or float, optional) – Sin(xi_34); see
sxi12. Default: 0.0.sxi35 (int or float, optional) – Sin(xi_35); see
sxi12. Default: 0.0.dxi35 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
b4 (int or float, optional) – Eigenvalue b4 of the LIV operator. Default: 0.0.
b5 (int or float, optional) – Eigenvalue b5 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.default_osc_params_set_name (str, optional) – Name of the predefined oscillation-parameter set used to fill in any oscillation parameter left as None (see
globaldefs.OSC_PARAMS_PREDEFINED). Default: ‘OSC_PARAMS_DEFAULT’.validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_2nu_sun_liv(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, sth: int | float, Dm2: int | float, sxi: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, strategy: str | None = 'auto', density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the two-neutrino oscillation probability for neutrinos inside the Sun, under (one form of) Lorentz-invariance violation.
For the electron density inside the Sun, it assumes an exponentially falling density profile: \(N_e(r) = N_e(0) \exp(-r/r_0)\), with \(N_e(0) = 245 N_\text{Av}~\text{cm}^{-3}\) and \(r_0 = R_\odot/10.54\). See Eq. (10.62) in Fundamentals of Neutrino Physics and Astrophysics by Carlo Giunti and Chung Wook Kim.
Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
sth (int or float) – Sine of the mixing angle \(\theta\), the single mixing angle of the two-flavor system.
Dm2 (int or float) – Mass-squared difference \(\Delta m^2\) of the two-flavor system.
sxi (int or float, optional) – Sin(xi), with xi the rotation angle between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation. Default: ‘auto’.Added in version 1.0.0.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_3nu_sun_liv(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxiCP: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, strategy: str | None = 'auto', density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the three-neutrino oscillation probability for neutrinos inside the Sun, under (one form of) Lorentz-invariance violation.
For the electron density inside the Sun, it assumes an exponentially falling density profile: \(N_e(r) = N_e(0) \exp(-r/r_0)\), with \(N_e(0) = 245 N_\text{Av}~\text{cm}^{-3}\) and \(r_0 = R_\odot/10.54\). See Eq. (10.62) in Fundamentals of Neutrino Physics and Astrophysics by Carlo Giunti and Chung Wook Kim.
Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxiCP (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation. Default: ‘auto’.Added in version 1.0.0.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_4nu_sun_liv(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s24: int | float | None = 0.0, s34: int | float | None = 0.0, d14: int | float | None = 0.0, d24: int | float | None = 0.0, D41: int | float | None = 0.0, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxi13: int | float | None = 0.0, sxi14: int | float | None = 0.0, dxi14: int | float | None = 0.0, sxi24: int | float | None = 0.0, dxi24: int | float | None = 0.0, sxi34: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, b4: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, strategy: str | None = 'auto', density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the four-neutrino oscillation probability for neutrinos inside the Sun, under (one form of) Lorentz-invariance violation.
For the electron density inside the Sun, it assumes an exponentially falling density profile: \(N_e(r) = N_e(0) \exp(-r/r_0)\), with \(N_e(0) = 245 N_\text{Av}~\text{cm}^{-3}\) and \(r_0 = R_\odot/10.54\). See Eq. (10.62) in Fundamentals of Neutrino Physics and Astrophysics by Carlo Giunti and Chung Wook Kim.
Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxi13 (int or float, optional) – CP-violation phase of the LIV operator [radian] (replaces
dxiCPfor 4/5-flavor systems). Default: 0.0.sxi14 (int or float, optional) – Sin(xi_14); see
sxi12. Default: 0.0.dxi14 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi24 (int or float, optional) – Sin(xi_24); see
sxi12. Default: 0.0.dxi24 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi34 (int or float, optional) – Sin(xi_34); see
sxi12. Default: 0.0.b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
b4 (int or float, optional) – Eigenvalue b4 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation. Default: ‘auto’.Added in version 1.0.0.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray
- magnus.oscprob.osc_prob_5nu_sun_liv(energy: float | list | numpy.ndarray, L: float | list | numpy.ndarray, L0: int | float, s12: int | float | None = None, s23: int | float | None = None, s13: int | float | None = None, dCP: int | float | None = None, D21: int | float | None = None, D31: int | float | None = None, s14: int | float | None = 0.0, s15: int | float | None = 0.0, s24: int | float | None = 0.0, s25: int | float | None = 0.0, s34: int | float | None = 0.0, s35: int | float | None = 0.0, d14: int | float | None = 0.0, d15: int | float | None = 0.0, d24: int | float | None = 0.0, d35: int | float | None = 0.0, D41: int | float | None = 0.0, D51: int | float | None = 0.0, sxi12: int | float | None = 0.0, sxi23: int | float | None = 0.0, sxi13: int | float | None = 0.0, dxi13: int | float | None = 0.0, sxi14: int | float | None = 0.0, dxi14: int | float | None = 0.0, sxi15: int | float | None = 0.0, dxi15: int | float | None = 0.0, sxi24: int | float | None = 0.0, dxi24: int | float | None = 0.0, sxi25: int | float | None = 0.0, sxi34: int | float | None = 0.0, sxi35: int | float | None = 0.0, dxi35: int | float | None = 0.0, b1: int | float | None = 0.0, b2: int | float | None = 0.0, b3: int | float | None = 0.0, b4: int | float | None = 0.0, b5: int | float | None = 0.0, Lambda: int | float | None = 1.0, n_liv: int | None = 0, ratio_number_neutrons_to_protons: int | float | None = 1.0, electron_fraction: int | float | None = 0.5, nubar: bool | None = False, nu_i: int | None = None, nu_f: int | None = None, strategy: str | None = 'auto', density_matter_is_in_g_per_cm3: bool | None = False, density_is_of_number_of_electrons: bool | None = False, validate_input: bool | None = True, save_log: bool | None = False, filename_log: str | None = './out.log', file_log: io.TextIOWrapper | None = None, close_file_log_upon_exit: bool | None = True, verbose: int | None = 0, **kwargs) float | numpy.ndarray[source]
Compute and return the five-neutrino oscillation probability for neutrinos inside the Sun, under (one form of) Lorentz-invariance violation.
For the electron density inside the Sun, it assumes an exponentially falling density profile: \(N_e(r) = N_e(0) \exp(-r/r_0)\), with \(N_e(0) = 245 N_\text{Av}~\text{cm}^{-3}\) and \(r_0 = R_\odot/10.54\). See Eq. (10.62) in Fundamentals of Neutrino Physics and Astrophysics by Carlo Giunti and Chung Wook Kim.
Added in version 1.0.0.
- Parameters:
energy (float, list, or np.ndarray) – Neutrino energy/energies.
s12 (int or float, optional) – Sine of the mixing angle \(\theta_{12}\). Default: None.
s23 (int or float, optional) – Sine of the mixing angle \(\theta_{23}\). Default: None.
s13 (int or float, optional) – Sine of the mixing angle \(\theta_{13}\). Default: None.
dCP (int or float, optional) – \(\delta_\text{CP}\) [radian]. Default: None.
D21 (int or float, optional) – Mass-squared difference \(\Delta m_{21}^2\). Default: None.
D31 (int or float, optional) – Mass-squared difference \(\Delta m_{31}^2\). Default: None.
s14 (int or float, optional) – Sine of the mixing angle \(\theta_{14}\). Default: 0.0.
s15 (int or float, optional) – Sine of the mixing angle \(\theta_{15}\). Default: 0.0.
s24 (int or float, optional) – Sine of the mixing angle \(\theta_{24}\). Default: 0.0.
s25 (int or float, optional) – Sine of the mixing angle \(\theta_{25}\). Default: 0.0.
s34 (int or float, optional) – Sine of the mixing angle \(\theta_{34}\). Default: 0.0.
s35 (int or float, optional) – Sine of the mixing angle \(\theta_{35}\). Default: 0.0.
d14 (int or float, optional) – \(\delta_{14}\) [radian]. Default: 0.0.
d15 (int or float, optional) – \(\delta_{15}\) [radian]. Default: 0.0.
d24 (int or float, optional) – \(\delta_{24}\) [radian]. Default: 0.0.
d35 (int or float, optional) – \(\delta_{35}\) [radian]. Default: 0.0.
D41 (int or float, optional) – Mass-squared difference \(\Delta m_{41}^2\). Default: 0.0.
D51 (int or float, optional) – Mass-squared difference \(\Delta m_{51}^2\). Default: 0.0.
sxi12 (int or float, optional) – Sin(xi_12), one of the mixing angles between the space of the eigenvectors of the LIV operator and the flavor states. Default: 0.0.
sxi23 (int or float, optional) – Sin(xi_23); see
sxi12. Default: 0.0.sxi13 (int or float, optional) – Sin(xi_13); see
sxi12. Default: 0.0.dxi13 (int or float, optional) – CP-violation phase of the LIV operator [radian] (replaces
dxiCPfor 4/5-flavor systems). Default: 0.0.sxi14 (int or float, optional) – Sin(xi_14); see
sxi12. Default: 0.0.dxi14 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi15 (int or float, optional) – Sin(xi_15); see
sxi12. Default: 0.0.dxi15 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi24 (int or float, optional) – Sin(xi_24); see
sxi12. Default: 0.0.dxi24 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
sxi25 (int or float, optional) – Sin(xi_25); see
sxi12. Default: 0.0.sxi34 (int or float, optional) – Sin(xi_34); see
sxi12. Default: 0.0.sxi35 (int or float, optional) – Sin(xi_35); see
sxi12. Default: 0.0.dxi35 (int or float, optional) – CP-violation phase of the LIV operator [radian]. Default: 0.0.
b1 (int or float, optional) – Eigenvalue b1 of the LIV operator. Default: 0.0.
b2 (int or float, optional) – Eigenvalue b2 of the LIV operator. Default: 0.0.
b3 (int or float, optional) – Eigenvalue b3 of the LIV operator. Default: 0.0.
b4 (int or float, optional) – Eigenvalue b4 of the LIV operator. Default: 0.0.
b5 (int or float, optional) – Eigenvalue b5 of the LIV operator. Default: 0.0.
Lambda (int or float, optional) – Energy scale of the LIV operator. Default: 1.0.
n_liv (int, optional) – Power of the energy dependence of the LIV operator (dimension of the operator minus 3). Default: 0.
ratio_number_neutrons_to_protons (int or float, optional) – Ratio of the number of neutrons to protons in matter. Default: 1.0.
electron_fraction (int or float, optional) – Electron fraction. Default: 0.5.
nubar (bool, optional) – If True, compute the probability for antineutrinos. Default: False.
nu_i (int, optional) – Initial flavor index. If given together with
nu_f, a single channel is returned instead of the full probability matrix. Default: None.nu_f (int, optional) – Final flavor index; see
nu_i. Default: None.density_matter_is_in_g_per_cm3 (bool, optional) – If True, the density is given in \(\text{g cm}^{-3}\). Default: False.
density_is_of_number_of_electrons (bool, optional) – If True, the density parameter directly gives the electron number density [\(\text{eV}^{3}\)]. Default: False.
strategy (str, optional) –
Numerical strategy used to compute the evolution operator: ‘auto’ (default), ‘hybrid’, or ‘magnus’; see the
strategyparameter ofosc_prob_matter_std_potential()for the full description and Adiabatic + Magnus Hybrid Strategy for the derivation and validation. Default: ‘auto’.Added in version 1.0.0.
validate_input (bool, optional) – If True, validate the input parameters. Default: True.
save_log (bool, optional) – If True, also write log messages to a file. Default: False.
filename_log (str, optional) – Name of the log file (used if
save_logis True and nofile_logobject is given). Default: ‘./out.log’.file_log (TextIOWrapper, optional) – Optional file object to write log messages to. Default: None.
close_file_log_upon_exit (bool, optional) – If True, close the log file before returning. Default: True.
verbose (int, optional) – Verbosity level: 0 (silent), 1 (warnings), 2 (progress of the refinement loops). Default: 0.
**kwargs – Additional arguments forwarded to the underlying middle-layer function (e.g., the standard refinement/logging kwargs; see
osc_prob()).
- Returns:
Oscillation probability matrix (or single channel, if
nu_i/nu_fare given) for each (energy, L) point.- Return type:
float or np.ndarray