Custom physics model
By default, each experiment configures its own physics modules. You can override this to use custom oscillation models, inverted ordering, or BSM physics.
Modifying the neutrino physics model
For this example, we want to configure a model that uses the inverted neutrino mass ordering and the standard matter interactions:
using Newtrinos
#modify the neutrino oscillation model
osc_cfg = Newtrinos.osc.OscillationConfig(
flavour = Newtrinos.osc.ThreeFlavour(ordering=:IO), #Inverted ordering
propagation = Newtrinos.osc.Basic(),
states = Newtrinos.osc.All(),
interaction = Newtrinos.osc.SI(), #Standard matter interactions
)
osc = Newtrinos.osc.configure(osc_cfg) #oscillation configuration
#Atmospheric experiments need oscillations, fluxes, Earth density, and cross-sections:
atm_flux = Newtrinos.atm_flux.configure()
earth_layers = Newtrinos.earth_layers.configure()
xsec = Newtrinos.xsec.configure()
physics = (; osc, atm_flux, earth_layers, xsec) #full modified physics modelEach experiment extracts whatever physics modules it needs. Reactor experiments (Daya Bay, KamLAND) only use osc; atmospheric experiments use all four.
The physics model modified above can now be easily passed to an experiment of our choice to do e.g. a likelihood profile scan.
Passing physics to experiments
Since we are looking at standard matter effects, we need a long baseline to see effects so we could pass the model to the IceCube deepcore experiment:
experiments = (
deepcore = Newtrinos.deepcore.configure(physics),
)
params = Newtrinos.get_params(experiments)
priors = Newtrinos.get_priors(experiments)
likelihood = Newtrinos.generate_likelihood(experiments)Likelihood profile scan
We now want to do a profile likelihood scan for e.g. different values of $\theta_{23}$. To keep it simple and make it not too time consuming, we evaluate (only) 20 scan grid points with different $\delta_{CP}$-values. We furthermore fix $\theta_{12}$, $\theta_{13}$, and $\Delta m_{12}^2$ to their default values and assume a CP-conserving case with $\delta_{CP} = 0$.
This takes a few minutes since we are optimizing over $\sim 20$ parameters to maximise the likelihood at each grid point. It may be useful to use julias multithreading for profile scans in order to accelerate the execution.
using BAT #for combining the priors into a product of prior distributions with distprod
#combine the priors into a product of prior distributions
priors_d = distprod(;priors...)
#find MLE to use it as starting point for the optimization
llh, log_posterior, mle_result = Newtrinos.find_mle(likelihood, priors_d, params)using DataStructures #for assigning the dictionaries for conditional_vars and vars_to_scan
# Fix some parameters
conditional_vars = Dict(
:θ₁₂ => params.θ₁₂,
:θ₁₃ => params.θ₁₃,
:Δm²₂₁ => params.Δm²₂₁,
:δCP => 0.0,
)
priors = Newtrinos.condition(priors, conditional_vars, params)
vars_to_scan = OrderedDict(:θ₂₃ => 20) # 20 scanpoints
result = Newtrinos.profile(likelihood, priors, vars_to_scan, mle_result)NewtrinosResult((θ₂₃ = [0.5235987755982988, 0.5511566058929461, 0.5787144361875934, 0.6062722664822408, 0.6338300967768881, 0.6613879270715354, 0.6889457573661826, 0.7165035876608299, 0.7440614179554772, 0.7716192482501245, 0.7991770785447718, 0.8267349088394191, 0.8542927391340664, 0.8818505694287138, 0.9094083997233611, 0.9369662300180084, 0.9645240603126557, 0.992081890607303, 1.0196397209019503, 1.0471975511965976],), (atm_flux_delta_spectral_index = [-0.025077999048289192, -0.024663092298413555, -0.02430806606706913, -0.024084961539911222, -0.023936862249641283, -0.023897504294658242, -0.023871452938065, -0.023852041588892172, -0.023748478953505892, -0.02353922992656654, -0.023225639065403852, -0.022745484308733327, -0.02213632135147406, -0.02143109859388509, -0.02077036871745936, -0.020127883127640273, -0.019581974886726628, -0.019158871442967927, -0.018873378067078943, -0.01871622246446694], atm_flux_nuenuebar_sigma = [0.4882735212997325, 0.4818218049763845, 0.4753506651801274, 0.4697760540199962, 0.4646772856781133, 0.4599521675739502, 0.45889406911916475, 0.4554040769273768, 0.4526699709011897, 0.45107935962317597, 0.4501205229257103, 0.4518618974094772, 0.4534487811390649, 0.45519311039220833, 0.45600536497481264, 0.45812095086385723, 0.4617295141676934, 0.4652731113840314, 0.46948477696037927, 0.47430883191603407], atm_flux_nuenumu_sigma = [-0.20645623039623898, -0.22057877172551194, -0.23301877735592352, -0.24403011491701834, -0.25348367493776064, -0.26072958194732393, -0.26913097251498697, -0.2725032873601087, -0.27459900535596116, -0.27562815916971534, -0.27563320080968035, -0.27548625348661643, -0.2738066864009727, -0.2704386356747698, -0.26402857225045534, -0.256046905460628, -0.24733447215391266, -0.23623594229809716, -0.2241275102667719, -0.21067768519091334], atm_flux_numunumubar_sigma = [0.025434205351406596, 0.014466975228757928, 0.005959710579465076, -0.000924812101881809, -0.0064073566451999745, -0.010225280591096163, -0.015210978869032929, -0.016583468147324063, -0.017449729738805164, -0.01806810542892873, -0.018454042966305723, -0.01887637962840493, -0.019351295674089317, -0.01957243483334669, -0.01895135390431208, -0.018594038889410382, -0.018736190416692028, -0.018359560685796042, -0.017786781329990328, -0.01654802441835136], atm_flux_updown_sigma = [-0.019750272317215496, -0.018697994045766896, -0.01763517596514451, -0.0166227266173806, -0.015666136379660654, -0.014810941794085064, -0.014176643737256071, -0.013608556184541508, -0.013171352795593306, -0.012901785734181272, -0.012733298312328632, -0.01286850984322001, -0.013036121622287351, -0.013297794774177198, -0.013641003057191401, -0.014195717683283147, -0.01489567030575349, -0.015664452303202937, -0.016475344925034652, -0.017313801837036447], atm_flux_uphorizonzal_sigma = [2.6842169049922533, 2.4610642673383696, 2.2468706226843316, 2.055553020727061, 1.885464485934472, 1.742523117658203, 1.6246756558246132, 1.5376642192131145, 1.4784522708632604, 1.447316147629444, 1.4455071110606124, 1.4700190897837317, 1.52389273001936, 1.6052548766551247, 1.715141184094928, 1.8532740187956365, 2.0151585323991283, 2.2014577438268432, 2.405881842198691, 2.6254260210409694], deepcore_atm_muon_scale = [1.0259258358475816, 1.0138961308172776, 1.003003673518161, 0.9938833263304374, 0.9862532662171801, 0.9801917394959984, 0.975427210688943, 0.9719564299880754, 0.9695014546772766, 0.9681660910202883, 0.9674707335401753, 0.9679316575614023, 0.9691730161299947, 0.9713364781118803, 0.9749824560833247, 0.9797885419281964, 0.9862827076735944, 0.9942568518639726, 1.003755963260613, 1.0148513815221614], deepcore_ice_absorption = [1.0309897335933005, 1.0291158572913288, 1.0272292846653164, 1.0253211930421864, 1.0235661504041622, 1.0218961167849203, 1.020536503184847, 1.01943383811224, 1.018662849651971, 1.0181773629078155, 1.0181220675063039, 1.0183331156133941, 1.0189897687586933, 1.0199784047900597, 1.0212565811013112, 1.0227011953755196, 1.0244472704627976, 1.026243274331019, 1.0281274704711088, 1.029977516170411], deepcore_ice_scattering = [0.9654193581897113, 0.9668638108839783, 0.9683772917667925, 0.9698589090117036, 0.9713106864178624, 0.9726965742339987, 0.9739383757147888, 0.9749767828134696, 0.9757256221121507, 0.9761582751031517, 0.9762810786022649, 0.9760234335601061, 0.9754126270713802, 0.9745672903772633, 0.9735318923224815, 0.9723153546412883, 0.9710054727062938, 0.969667929379759, 0.9683581550146281, 0.9670690334711262], deepcore_lifetime = [2.047540751143318, 2.0820064064273653, 2.1141761523753817, 2.1433411598344336, 2.1689821959556266, 2.1905464118452453, 2.2080159898808307, 2.221249458221809, 2.2303817997121915, 2.2356237329027016, 2.236575197556553, 2.2340054004691963, 2.227526529511026, 2.217014994218221, 2.202151637572897, 2.1832031161231353, 2.1601664668196654, 2.133556903281775, 2.1036571321507003, 2.0712254018871272], deepcore_opt_eff_headon = [-2.619349738577498, -2.426442853676978, -2.248110547419102, -2.084628195395717, -1.939709728013383, -1.8156692627567788, -1.714472019035595, -1.639310019712227, -1.589626909243119, -1.5665786622353748, -1.5687462648500734, -1.5975876308986665, -1.651118963484099, -1.7307741083759685, -1.833427945796295, -1.9589983424859136, -2.105306317128189, -2.2689117477347938, -2.447061013065813, -2.636902481782812], deepcore_opt_eff_lateral = [0.005192579007676329, -0.028813902132144784, -0.06268602099304099, -0.0938612325933429, -0.12191626679380434, -0.14632556486194273, -0.16659166891436572, -0.18293475735235112, -0.19361129029489738, -0.19969494195571397, -0.1999704941468574, -0.1943369202634934, -0.18234080988870277, -0.16643678009208723, -0.14557101479923623, -0.12037446902511055, -0.09220854402799844, -0.06090442871912375, -0.02770632029277121, 0.006663160555640588], deepcore_opt_eff_overall = [1.0709487481121753, 1.0672808118829165, 1.0641861359524831, 1.0615191680631024, 1.0593570742057588, 1.0576789454455078, 1.0564431746589529, 1.055439979857017, 1.0546896464073947, 1.0540652428444834, 1.0537635042164177, 1.0533724245845433, 1.0531649360080395, 1.0531932704404896, 1.0535247869149729, 1.0542622655240805, 1.0555097083909233, 1.0572274891202886, 1.0595712917055142, 1.0624479750165183], nc_norm = [1.334381131919278, 1.3192579394052038, 1.3051274325867588, 1.292488563609352, 1.2812995850613857, 1.2717876835121342, 1.263897218602144, 1.2581033702043707, 1.254188592054865, 1.2520848770842785, 1.2517936797281157, 1.2540287912692067, 1.2576384545446166, 1.2632118839801425, 1.2709052911588223, 1.2802736035270532, 1.2910897510654225, 1.3033514294176016, 1.316889046118293, 1.3315701169343983], nutau_cc_norm = [0.898018080574598, 0.8926276202641271, 0.8910095522282426, 0.8924877918701732, 0.8971353406988007, 0.9039698220484202, 0.9112727401896586, 0.9188747323330313, 0.9249244524251573, 0.9282590124803468, 0.9284424647004906, 0.9251604113841293, 0.9193248762319388, 0.9119194950599028, 0.9041114499255637, 0.8969118719471156, 0.8916863763444292, 0.8892337172995688, 0.8899415897171811, 0.8938096195523542], Δm²₂₁ = [7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5, 7.53e-5], Δm²₃₁ = [-0.002258176056834268, -0.002256965882650716, -0.002254265055524374, -0.002250441878424626, -0.002245920152286726, -0.002240975839361196, -0.002236439558633227, -0.002233039616605865, -0.0022314467689240345, -0.00223190205943304, -0.002234442320744611, -0.0022398422330607718, -0.0022477826293537473, -0.002257957290790402, -0.002269614614810704, -0.0022825842289207823, -0.0022963471553855736, -0.002310567850526162, -0.0023249576080338202, -0.0023395570432391006], δCP = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], θ₁₂ = [0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223, 0.5872523687443223], θ₁₃ = [0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693, 0.1454258194533693], θ₂₃ = [0.5235987755982988, 0.5511566058929461, 0.5787144361875934, 0.6062722664822408, 0.6338300967768881, 0.6613879270715354, 0.6889457573661826, 0.7165035876608299, 0.7440614179554772, 0.7716192482501245, 0.7991770785447718, 0.8267349088394191, 0.8542927391340664, 0.8818505694287138, 0.9094083997233611, 0.9369662300180084, 0.9645240603126557, 0.992081890607303, 1.0196397209019503, 1.0471975511965976], llh = [-556.9698591033649, -552.0638838965226, -548.1071412683244, -545.0514098233127, -542.838524131379, -541.3432749453401, -540.4198796957414, -539.9046703971239, -539.6520029269329, -539.5472482978028, -539.5249026807384, -539.5836043706762, -539.7858083956487, -540.2406773651333, -541.0903189732935, -542.4909248804186, -544.5947780282904, -547.5132486727581, -551.3226435143748, -556.0424309046555], log_posterior = [-557.252879417979, -551.6264989208763, -547.0293821487996, -543.439176735216, -540.7796746419505, -538.9277581444965, -537.7279070784808, -537.0128463331396, -536.6276610961407, -536.4528680994861, -536.4226200074925, -536.5346368198293, -536.8501632602405, -537.4840022202523, -538.5864886322064, -540.3206759762496, -542.8387837235158, -546.2618078627883, -550.6651703457218, -556.0715759690194]), Dict{String, Any}("repo_clean" => false, "exec_time" => 644.3880000114441, "username" => "David", "repo" => "c:\\Users\\David\\IceCube_project\\Newtrinos.jl", "cache_dir" => nothing, "hostname" => "DESKTOP-QSI7DD1", "params" => (atm_flux_delta_spectral_index = -0.01995848356331308, atm_flux_nuenuebar_sigma = 0.45611538424627973, atm_flux_nuenumu_sigma = -0.2731605796782007, atm_flux_numunumubar_sigma = -0.02218201826587442, atm_flux_updown_sigma = -0.013662592434151051, atm_flux_uphorizonzal_sigma = 1.4195390770309602, deepcore_atm_muon_scale = 0.9630291765743404, deepcore_ice_absorption = 1.0173697701430782, deepcore_ice_scattering = 0.9767661016138234, deepcore_lifetime = 2.248836119050105, deepcore_opt_eff_headon = -1.6022507712065126, deepcore_opt_eff_lateral = -0.20164211539203167, deepcore_opt_eff_overall = 1.049075359290189, nc_norm = 1.2507431766555224, nutau_cc_norm = 0.9293917503089849, Δm²₂₁ = 8.1900120249521e-5, Δm²₃₁ = -0.002306463521749395, δCP = 3.1528511825212964, θ₁₂ = 0.785223530815266, θ₁₃ = 0.2, θ₂₃ = 0.8060455174291175), "date" => "2026-06-23 23:54:32", "task" => "profile", "vars_to_scan" => OrderedDict(:θ₂₃ => 20)…))We can also briefly plot the Likelihood profile and the $1\sigma, 2\sigma,$ and $3\sigma$ lines:
using CairoMakie
fig = Figure()
ax = Axis(fig[1,1], xlabel= "θ₂₃", ylabel = "2Δllh")
plot!(ax, result)
fig 