pisa.stages.flux package
Submodules
pisa.stages.flux.airs module
pisa.stages.flux.astrophysical module
stage to implement getting the contribution to fluxes from astrophysical neutrino sources
- pisa.stages.flux.astrophysical.apply_sys_loop(true_energy, true_coszen, delta_index, norm, astroflux_nominal, out)[source]
- Calculation:
Start from nominal flux
Apply spectral index shift
Add contributions from MCEq-computed gradients
- Array dimensions :
true_energy : [A] true_coszen : [A] delta_index : scalar float norm : scalar float astroflux_nominal : [A,B] out : [A,B] (sys flux)
- where:
A = num events B = num flavors in flux (=3, e.g. e, mu, tau)
- class pisa.stages.flux.astrophysical.astrophysical(**std_kwargs)[source]
Bases:
Stage
Stage to apply power law astrophysical fluxes
- Parameters:
params –
Expected params are ..
astro_delta : quantity (dimensionless) astro_norm : quantity (dimensionless)
Expected container keys are ..
"true_energy" "true_coszen" "initial_weights"
TODO (flavor ratio as a parameter? Save for later.)
pisa.stages.flux.barr_simple module
Stage to implement the old PISA/oscfit flux systematics
- pisa.stages.flux.barr_simple.apply_ratio_scale(ratio_scale, sum_constant, in1, in2, out)
apply ratio scale to flux values
- Parameters:
ratio_scale (float)
sum_constant (bool) – if Ture, then the sum of the new flux will be identical to the old flux
in1 (float)
in2 (float)
out (array)
- pisa.stages.flux.barr_simple.apply_sys_kernel(true_energy, true_coszen, nu_flux_nominal, nubar_flux_nominal, nubar, nue_numu_ratio, nu_nubar_ratio, delta_index, Barr_uphor_ratio, Barr_nu_nubar_ratio, out)
- class pisa.stages.flux.barr_simple.barr_simple(**std_kwargs)[source]
Bases:
Stage
stage to apply Barr style flux uncertainties uses parameterisations of plots from Barr 2006 paper
- Parameters:
params –
Expected params are ..
nue_numu_ratio : quantity (dimensionless) nu_nubar_ratio : quantity (dimensionless) delta_index : quantity (dimensionless) Barr_uphor_ratio : quantity (dimensionless) Barr_nu_nubar_ratio : quantity (dimensionless)
Expected container keys are ..
"true_energy" "true_coszen" "nu_flux_nominal" "nubar_flux_nominal" "nubar"
- pisa.stages.flux.barr_simple.spectral_index_scale(true_energy, egy_pivot, delta_index)
calculate spectral index scale
pisa.stages.flux.daemon_flux module
Implementation of DAEMON flux (https://arxiv.org/abs/2303.00022) by Juan Pablo Yañez and Anatoli Fedynitch for use in PISA.
Maria Liubarska, J.P. Yanez 2023
- class pisa.stages.flux.daemon_flux.daemon_flux(**std_kwargs)[source]
Bases:
Stage
DAEMON flux stage
- Parameters:
params (ParamSet) –
Must have parameters: ..
daemon_K_158G : quantity (dimensionless) daemon_K_2P : quantity (dimensionless) daemon_K_31G : quantity (dimensionless) daemon_antiK_158G : quantity (dimensionless) daemon_antiK_2P : quantity (dimensionless) daemon_antiK_31G : quantity (dimensionless) daemon_n_158G : quantity (dimensionless) daemon_n_2P : quantity (dimensionless) daemon_p_158G : quantity (dimensionless) daemon_p_2P : quantity (dimensionless) daemon_pi_158G : quantity (dimensionless) daemon_pi_20T : quantity (dimensionless) daemon_pi_2P : quantity (dimensionless) daemon_pi_31G : quantity (dimensionless) daemon_antipi_158G : quantity (dimensionless) daemon_antipi_20T : quantity (dimensionless) daemon_antipi_2P : quantity (dimensionless) daemon_antipi_31G : quantity (dimensionless) daemon_GSF_1 : quantity (dimensionless) daemon_GSF_2 : quantity (dimensionless) daemon_GSF_3 : quantity (dimensionless) daemon_GSF_4 : quantity (dimensionless) daemon_GSF_5 : quantity (dimensionless) daemon_GSF_6 : quantity (dimensionless)
Expected container keys are ..
"true_energy" "true_coszen" "nubar"
- pisa.stages.flux.daemon_flux.make_2d_flux_map(flux_obj, particle='numuflux', egrid=array([1.00000000e-01, 1.02807322e-01, 1.05693455e-01, 1.08660611e-01, 1.11711065e-01, 1.14847155e-01, 1.18071285e-01, 1.21385926e-01, 1.24793621e-01, 1.28296980e-01, 1.31898690e-01, 1.35601511e-01, 1.39408283e-01, 1.43321923e-01, 1.47345431e-01, 1.51481892e-01, 1.55734477e-01, 1.60106446e-01, 1.64601150e-01, 1.69222035e-01, 1.73972643e-01, 1.78856616e-01, 1.83877698e-01, 1.89039738e-01, 1.94346693e-01, 1.99802631e-01, 2.05411735e-01, 2.11178304e-01, 2.17106760e-01, 2.23201647e-01, 2.29467637e-01, 2.35909533e-01, 2.42532274e-01, 2.49340937e-01, 2.56340741e-01, 2.63537052e-01, 2.70935387e-01, 2.78541416e-01, 2.86360972e-01, 2.94400048e-01, 3.02664806e-01, 3.11161583e-01, 3.19896892e-01, 3.28877429e-01, 3.38110078e-01, 3.47601918e-01, 3.57360225e-01, 3.67392478e-01, 3.77706369e-01, 3.88309805e-01, 3.99210913e-01, 4.10418050e-01, 4.21939808e-01, 4.33785019e-01, 4.45962763e-01, 4.58482375e-01, 4.71353453e-01, 4.84585864e-01, 4.98189752e-01, 5.12175544e-01, 5.26553963e-01, 5.41336030e-01, 5.56533078e-01, 5.72156756e-01, 5.88219040e-01, 6.04732245e-01, 6.21709029e-01, 6.39162405e-01, 6.57105755e-01, 6.75552832e-01, 6.94517777e-01, 7.14015130e-01, 7.34059837e-01, 7.54667263e-01, 7.75853206e-01, 7.97633907e-01, 8.20026062e-01, 8.43046837e-01, 8.66713880e-01, 8.91045332e-01, 9.16059848e-01, 9.41776601e-01, 9.68215306e-01, 9.95396231e-01, 1.02334021e+00, 1.05206867e+00, 1.08160363e+00, 1.11196773e+00, 1.14318425e+00, 1.17527712e+00, 1.20827094e+00, 1.24219100e+00, 1.27706330e+00, 1.31291459e+00, 1.34977233e+00, 1.38766479e+00, 1.42662102e+00, 1.46667087e+00, 1.50784505e+00, 1.55017512e+00, 1.59369353e+00, 1.63843365e+00, 1.68442976e+00, 1.73171713e+00, 1.78033202e+00, 1.83031168e+00, 1.88169442e+00, 1.93451965e+00, 1.98882786e+00, 2.04466067e+00, 2.10206088e+00, 2.16107251e+00, 2.22174078e+00, 2.28411221e+00, 2.34823460e+00, 2.41415712e+00, 2.48193029e+00, 2.55160607e+00, 2.62323788e+00, 2.69688063e+00, 2.77259076e+00, 2.85042632e+00, 2.93044698e+00, 3.01271407e+00, 3.09729067e+00, 3.18424160e+00, 3.27363353e+00, 3.36553498e+00, 3.46001639e+00, 3.55715021e+00, 3.65701088e+00, 3.75967497e+00, 3.86522116e+00, 3.97373038e+00, 4.08528580e+00, 4.19997295e+00, 4.31787973e+00, 4.43909653e+00, 4.56371628e+00, 4.69183451e+00, 4.82354943e+00, 4.95896201e+00, 5.09817606e+00, 5.24129830e+00, 5.38843844e+00, 5.53970928e+00, 5.69522678e+00, 5.85511016e+00, 6.01948197e+00, 6.18846824e+00, 6.36219849e+00, 6.54080591e+00, 6.72442742e+00, 6.91320378e+00, 7.10727970e+00, 7.30680395e+00, 7.51192949e+00, 7.72281357e+00, 7.93961785e+00, 8.16250851e+00, 8.39165644e+00, 8.62723729e+00, 8.86943166e+00, 9.11842520e+00, 9.37440879e+00, 9.63757866e+00, 9.90813657e+00, 1.01862899e+01, 1.04722519e+01, 1.07662418e+01, 1.10684849e+01, 1.13792129e+01, 1.16986641e+01, 1.20270833e+01, 1.23647224e+01, 1.27118400e+01, 1.30687023e+01, 1.34355829e+01, 1.38127630e+01, 1.42005318e+01, 1.45991865e+01, 1.50090328e+01, 1.54303847e+01, 1.58635653e+01, 1.63089068e+01, 1.67667503e+01, 1.72374471e+01, 1.77213578e+01, 1.82188534e+01, 1.87303154e+01, 1.92561357e+01, 1.97967175e+01, 2.03524752e+01, 2.09238348e+01, 2.15112343e+01, 2.21151240e+01, 2.27359668e+01, 2.33742387e+01, 2.40304289e+01, 2.47050406e+01, 2.53985907e+01, 2.61116110e+01, 2.68446481e+01, 2.75982639e+01, 2.83730362e+01, 2.91695588e+01, 2.99884423e+01, 3.08303146e+01, 3.16958209e+01, 3.25856248e+01, 3.35004083e+01, 3.44408728e+01, 3.54077391e+01, 3.64017485e+01, 3.74236629e+01, 3.84742658e+01, 3.95543624e+01, 4.06647809e+01, 4.18063724e+01, 4.29800121e+01, 4.41865996e+01, 4.54270599e+01, 4.67023439e+01, 4.80134292e+01, 4.93613210e+01, 5.07470524e+01, 5.21716858e+01, 5.36363132e+01, 5.51420574e+01, 5.66900727e+01, 5.82815458e+01, 5.99176967e+01, 6.15997796e+01, 6.33290840e+01, 6.51069356e+01, 6.69346971e+01, 6.88137699e+01, 7.07455942e+01, 7.27316511e+01, 7.47734631e+01, 7.68725952e+01, 7.90306568e+01, 8.12493021e+01, 8.35302320e+01, 8.58751948e+01, 8.82859884e+01, 9.07644607e+01, 9.33125118e+01, 9.59320948e+01, 9.86252179e+01, 1.01393946e+02, 1.04240401e+02, 1.07166765e+02, 1.10175281e+02, 1.13268257e+02, 1.16448062e+02, 1.19717134e+02, 1.23077980e+02, 1.26533176e+02, 1.30085370e+02, 1.33737286e+02, 1.37491723e+02, 1.41351558e+02, 1.45319752e+02, 1.49399346e+02, 1.53593468e+02, 1.57905331e+02, 1.62338243e+02, 1.66895601e+02, 1.71580899e+02, 1.76397728e+02, 1.81349780e+02, 1.86440853e+02, 1.91674849e+02, 1.97055780e+02, 2.02587771e+02, 2.08275063e+02, 2.14122015e+02, 2.20133111e+02, 2.26312957e+02, 2.32666291e+02, 2.39197984e+02, 2.45913043e+02, 2.52816614e+02, 2.59913992e+02, 2.67210616e+02, 2.74712079e+02, 2.82424133e+02, 2.90352688e+02, 2.98503825e+02, 3.06883789e+02, 3.15499006e+02, 3.24356081e+02, 3.33461802e+02, 3.42823149e+02, 3.52447300e+02, 3.62341632e+02, 3.72513730e+02, 3.82971391e+02, 3.93722633e+02, 4.04775697e+02, 4.16139055e+02, 4.27821420e+02, 4.39831747e+02, 4.52179242e+02, 4.64873371e+02, 4.77923865e+02, 4.91340729e+02, 5.05134247e+02, 5.19314994e+02, 5.33893840e+02, 5.48881961e+02, 5.64290847e+02, 5.80132310e+02, 5.96418495e+02, 6.13161884e+02, 6.30375315e+02, 6.48071983e+02, 6.66265452e+02, 6.84969672e+02, 7.04198979e+02, 7.23968114e+02, 7.44292233e+02, 7.65186915e+02, 7.86668179e+02, 8.08752491e+02, 8.31456781e+02, 8.54798453e+02, 8.78795401e+02, 9.03466021e+02, 9.28829225e+02, 9.54904456e+02, 9.81711702e+02, 1.00927151e+03, 1.03760502e+03, 1.06673394e+03, 1.09668060e+03, 1.12746796e+03, 1.15911962e+03, 1.19165984e+03, 1.22511358e+03, 1.25950646e+03, 1.29486487e+03, 1.33121590e+03, 1.36858742e+03, 1.40700809e+03, 1.44650734e+03, 1.48711546e+03, 1.52886359e+03, 1.57178372e+03, 1.61590875e+03, 1.66127252e+03, 1.70790980e+03, 1.75585633e+03, 1.80514888e+03, 1.85582523e+03, 1.90792422e+03, 1.96148581e+03, 2.01655104e+03, 2.07316213e+03, 2.13136247e+03, 2.19119669e+03, 2.25271064e+03, 2.31595149e+03, 2.38096772e+03, 2.44780916e+03, 2.51652705e+03, 2.58717408e+03, 2.65980440e+03, 2.73447368e+03, 2.81123917e+03, 2.89015972e+03, 2.97129582e+03, 3.05470967e+03, 3.14046522e+03, 3.22862820e+03, 3.31926620e+03, 3.41244871e+03, 3.50824714e+03, 3.60673495e+03, 3.70798763e+03, 3.81208280e+03, 3.91910025e+03, 4.02912203e+03, 4.14223247e+03, 4.25851829e+03, 4.37806863e+03, 4.50097513e+03, 4.62733201e+03, 4.75723614e+03, 4.89078709e+03, 5.02808725e+03, 5.16924187e+03, 5.31435916e+03, 5.46355035e+03, 5.61692982e+03, 5.77461515e+03, 5.93672722e+03, 6.10339029e+03, 6.27473213e+03, 6.45088409e+03, 6.63198120e+03, 6.81816229e+03, 7.00957009e+03, 7.20635132e+03, 7.40865683e+03, 7.61664172e+03, 7.83046540e+03, 8.05029181e+03, 8.27628946e+03, 8.50863158e+03, 8.74749630e+03, 8.99306672e+03, 9.24553110e+03, 9.50508296e+03, 9.77192128e+03, 1.00462506e+04, 1.03282813e+04, 1.06182294e+04, 1.09163173e+04, 1.12227736e+04, 1.15378330e+04, 1.18617372e+04, 1.21947344e+04, 1.25370799e+04, 1.28890361e+04, 1.32508729e+04, 1.36228676e+04, 1.40053055e+04, 1.43984795e+04, 1.48026913e+04, 1.52182505e+04, 1.56454759e+04, 1.60846948e+04, 1.65362441e+04, 1.70004698e+04, 1.74777277e+04, 1.79683839e+04, 1.84728144e+04, 1.89914058e+04, 1.95245558e+04, 2.00726730e+04, 2.06361777e+04, 2.12155017e+04, 2.18110892e+04, 2.24233968e+04, 2.30528939e+04, 2.37000629e+04, 2.43654001e+04, 2.50494154e+04, 2.57526333e+04, 2.64755927e+04, 2.72188479e+04, 2.79829688e+04, 2.87685409e+04, 2.95761666e+04, 3.04064649e+04, 3.12600724e+04, 3.21376434e+04, 3.30398507e+04, 3.39673858e+04, 3.49209598e+04, 3.59013038e+04, 3.69091691e+04, 3.79453285e+04, 3.90105762e+04, 4.01057288e+04, 4.12316259e+04, 4.23891306e+04, 4.35791301e+04, 4.48025368e+04, 4.60602884e+04, 4.73533492e+04, 4.86827104e+04, 5.00493910e+04, 5.14544388e+04, 5.28989308e+04, 5.43839743e+04, 5.59107078e+04, 5.74803016e+04, 5.90939590e+04, 6.07529169e+04, 6.24584471e+04, 6.42118571e+04, 6.60144909e+04, 6.78677305e+04, 6.97729965e+04, 7.17317494e+04, 7.37454909e+04, 7.58157646e+04, 7.79441575e+04, 8.01323013e+04, 8.23818733e+04, 8.46945981e+04, 8.70722485e+04, 8.95166472e+04, 9.20296681e+04, 9.46132376e+04, 9.72693362e+04, 1.00000000e+05]), params={})[source]
pisa.stages.flux.hillasg module
Stage to evaluate the Hillas-Gaisser expectations from precalculated fluxes
pisa.stages.flux.honda_ip module
Stage to evaluate the Honda flux tables using IP splines
pisa.stages.flux.mceq_barr module
Stage to implement the inclusive neutrino flux as calculated with MCEq, and the systematic flux variations based on the Barr scheme.
It requires spline tables created by the pisa/scripts/create_barr_sys_tables_mceq.py Pre-generated tables can be found at `fridge/analysis/common/data/flux/
Tom Stuttard, Ida Storehaug, Philipp Eller, Summer Blot
- pisa.stages.flux.mceq_barr.apply_sys_loop(true_energy, true_coszen, delta_index, energy_pivot, nu_flux_nominal, gradients, gradient_params, out)
- Calculation:
Start from nominal flux
Apply spectral index shift
Add contributions from MCEq-computed gradients
- Array dimensions :
true_energy : [A] true_coszen : [A] nubar : scalar integer delta_index : scalar float energy_pivot : scalar float nu_flux_nominal : [A,B] gradients : [A,B,C] gradient_params : [C] out : [A,B] (sys flux)
- where:
A = num events B = num flavors in flux (=3, e.g. e, mu, tau) C = num gradients
- class pisa.stages.flux.mceq_barr.mceq_barr(table_file, include_nutau_flux=False, use_honda_nominal_flux=True, **std_kwargs)[source]
Bases:
Stage
Stage that uses gradients calculated with MCEq to handle flux uncertainties. This stage calculates flux variations relative to a nominal flux that must be calculated ahead of time.
- Parameters:
table_file (pickle file containing pre-generated tables from MCEq)
params (ParamSet) –
Must exclusively have parameters: ..
delta_index : quantity (dimensionless) Shift in the spectral index of the neutrino flux. Prior with a mean of 0. energy_pivot : quantity (GeV) The spectral index is shifting around a pivot point barr_*_Pi : quantity (dimensionless) * from a to i Uncertainty on pi+ production in a region of phase space *, further defined in Barr 2006 pion_ratio : quantity (dimensionless) The uncertainty on pi- production is assumed to be correlated to the pi+ production uncertainty, as the pi+/pi- ratio is measured. Thus the uncertainty on pi- production is defined by pion_ratio and barr_*_pi barr_*_K : quantity (dimensionless) * from w to z Uncertainty on K+ production in a region of phase space *, further defined in Barr 2006 barr_*_antiK : quantity (dimensionless) * from w to z Uncertainty on K- and K+ production is assumed to be uncorrelated as the ratio is badly determined.
Expected container keys are ..
"true_energy" "true_coszen" "nubar_flux_nominal" "nubar"
Notes
The nominal flux is calculated ahead of time using MCEq, then multiplied with a shift in spectral index, and then modifications due to meson production (barr variables) are added.
The MCEq-table has 2 solutions of the cascade equation per Barr variable (12) - one solution for meson and one solution for the antimeson production uncertainty.
Each solution consists of 8 splines: “numu”, “numubar”, “nue”, and “nuebar” is the nominal flux. “dnumu”, “dnumubar”, “dnue”, and “dnuebar” is the gradient of the Barr modification
- antipion_production(barr_var, pion_ratio)[source]
Combine pi+ barr param and pi+/pi- ratio to get pi- barr param Definitions:
pion ratio = (1 + barr_var+) / (1 + barr_var-) delta pion ratio = pion ratio - 1 (e.g. deviation from nominal ratio value, which is 1)
Note that the pion_ratio param really represents the “delta pion ratio”, so is defined similarly to the barr variables themselves .
- pisa.stages.flux.mceq_barr.spectral_index_scale(true_energy, energy_pivot, delta_index)
Calculate spectral index scale. Adjusts the weights for events in an energy dependent way according to a shift in spectral index, applied about a user-defined energy pivot.
pisa.stages.flux.mceq_barr_red module
Stage to implement the inclusive neutrino flux as calculated with MCEq, and the systematic flux variations based on the Barr scheme.
It requires spline tables created by the pisa/scripts/create_barr_sys_tables_mceq.py Pre-generated tables can be found at `fridge/analysis/common/data/flux/
Tom Stuttard, Ida Storehaug, Philipp Eller, Summer Blot
- pisa.stages.flux.mceq_barr_red.apply_sys_loop(true_energy, true_coszen, delta_index, energy_pivot, nu_flux_nominal, gradients, gradient_params, out)[source]
- Calculation:
Start from nominal flux
Apply spectral index shift
Add contributions from MCEq-computed gradients
- Array dimensions :
true_energy : [A] true_coszen : [A] nubar : scalar integer delta_index : scalar float energy_pivot : scalar float nu_flux_nominal : [A,B] gradients : [A,B,C] gradient_params : [C] out : [A,B] (sys flux)
- where:
A = num events B = num flavors in flux (=3, e.g. e, mu, tau) C = num gradients
Not that first dimension (of length A) is vectorized out
- class pisa.stages.flux.mceq_barr_red.mceq_barr_red(table_file, **std_kwargs)[source]
Bases:
Stage
Stage that uses gradients calculated with MCEq to handle flux uncertainties. This stage calculates flux variations relative to a nominal flux that must be calculated ahead of time. Parameters to control pion and kaon production are reduced from the full Barr scheme, by forcing many of them to scale in a fully correlated way.
- Parameters:
table_file (pickle file containing pre-generated tables from MCEq)
params (ParamSet) –
Must exclusively have parameters: ..
delta_index : quantity (dimensionless) Shift in the spectral index of the neutrino flux. Prior with a mean of 0. energy_pivot : quantity (GeV) The spectral index is shifting around a pivot point barr_*_Pi : quantity (dimensionless) * from a to i Uncertainty on pi+ production in a region of phase space *, further defined in Barr 2006 pion_ratio : quantity (dimensionless) The uncertainty on pi- production is assumed to be correlated to the pi+ production uncertainty, as the pi+/pi- ratio is measured. Thus the uncertainty on pi- production is defined by pion_ratio and barr_*_pi barr_*_K : quantity (dimensionless) * from w to z Uncertainty on K+ production in a region of phase space *, further defined in Barr 2006 barr_*_antiK : quantity (dimensionless) * from w to z Uncertainty on K- and K+ production is assumed to be uncorrelated as the ratio is badly determined.
Expected container keys are ..
"true_energy" "true_coszen" "nu_flux_nominal" "nubar_flux_nominal" "nubar"
Notes
The nominal flux is calculated ahead of time using the honda_ip stage, then multiplied with a shift in spectral index, and then modifications due to meson production (barr variables) are added.
The MCEq-table has 2 solutions of the cascade equation per Barr variable (12) - one solution for meson and one solution for the antimeson production uncertainty.
Each solution consists of 4 splines: “dnumu”, “dnumubar”, “dnue”, and “dnuebar”. These are the gradients that govern how the neutrino fluxes vary depending on modifications to the Barr params.