GolemFlavor API

Emcee hooks

Useful functions to use an MCMC for the BSM flavor ratio analysis

golemflavor.mcmc.flat_seed(paramset, nwalkers)[source]

Get gaussian seed values for the MCMC.

golemflavor.mcmc.gaussian_seed(paramset, nwalkers)[source]

Get gaussian seed values for the MCMC.

golemflavor.mcmc.mcmc(p0, ln_prob, ndim, nwalkers, burnin, nsteps, threads=1)[source]

Run the MCMC.

golemflavor.mcmc.save_chains(chains, outfile)[source]

Save the chains.

Parameters:
chains : numpy ndarray

MCMC chains to save

outfile : str

Output file location of chains

Enumerations

Define Enums for the BSM flavor ratio analysis

class golemflavor.enums.DataType[source]

An enumeration.

class golemflavor.enums.Likelihood[source]

An enumeration.

class golemflavor.enums.MCMCSeedType[source]

An enumeration.

class golemflavor.enums.ParamTag[source]

An enumeration.

class golemflavor.enums.PriorsCateg[source]

An enumeration.

class golemflavor.enums.StatCateg[source]

An enumeration.

class golemflavor.enums.SteeringCateg[source]

An enumeration.

class golemflavor.enums.Texture[source]

An enumeration.

Flavor Functions

Useful functions for the BSM flavor ratio analysis

golemflavor.fr.MASS_EIGENVALUES = [7.4e-23, 2.515e-21]

SM mass eigenvalues.

golemflavor.fr.NUFIT_U = array([[ 0.82327921+0.j , 0.54796108+0.j , -0.09913534+0.11010079j], [-0.30340559+0.06889398j, 0.59033699+0.0458547j , 0.74336952+0.j ], [ 0.47090947+0.06045075j, -0.58950774+0.04023502j, 0.65226662+0.j ]], dtype=complex256)

NuFIT mixing matrix (s_12^2, c_13^4, s_23^2, dcp)

golemflavor.fr.SCALE_BOUNDARIES = {3: (-32, -20), 4: (-40, -24), 5: (-48, -27), 6: (-56, -30), 7: (-64, -33), 8: (-72, -36)}

Boundaries to scan the NP scale for each dimension.

golemflavor.fr.angles_to_fr(src_angles)[source]

Convert angular projection of the source flavor ratio back into the flavor ratio.

Parameters:
src_angles : list, length = 2

sin(phi)^4 and cos(psi)^2

Returns:
flavor ratios (nue, numu, nutau)

Examples

>>> print(angles_to_fr((0.3, 0.4)))
(0.38340579025361626, 0.16431676725154978, 0.45227744249483393)
golemflavor.fr.angles_to_u(bsm_angles)[source]

Convert angular projection of the mixing matrix elements back into the mixing matrix elements.

Parameters:
bsm_angles : list, length = 4

sin(12)^2, cos(13)^4, sin(23)^2 and deltacp

Returns:
unitary numpy ndarray of shape (3, 3)

Examples

>>> from fr import angles_to_u
>>> print(angles_to_u((0.2, 0.3, 0.5, 1.5)))
array([[ 0.66195018+0.j        ,  0.33097509+0.j        ,  0.04757188-0.6708311j ],
       [-0.34631487-0.42427084j,  0.61741198-0.21213542j,  0.52331757+0.j        ],
       [ 0.28614067-0.42427084j, -0.64749908-0.21213542j,  0.52331757+0.j        ]])
golemflavor.fr.cardano_eqn(ham)[source]

Diagonalise the effective Hamiltonian 3x3 matrix into the form h_{eff} = UE_{eff}U^{dagger} using the procedure in PRD91, 052003 (2015).

Parameters:
ham : numpy ndarray of shape (3, 3)

sin(12)^2, cos(13)^4, sin(23)^2 and deltacp

Returns:
unitary numpy ndarray of shape (3, 3)

Examples

>>> import numpy as np
>>> from fr import cardano_eqn
>>> ham = np.array(
>>>     [[ 0.66195018+0.j        ,  0.33097509+0.j        ,  0.04757188-0.6708311j ],
>>>      [-0.34631487-0.42427084j,  0.61741198-0.21213542j,  0.52331757+0.j        ],
>>>      [ 0.28614067-0.42427084j, -0.64749908-0.21213542j,  0.52331757+0.j        ]]
>>> )
>>> print(cardano_eqn(ham))
array([[-0.11143379-0.58863683j, -0.09067747-0.48219068j, 0.34276625-0.08686465j],
       [ 0.14835519+0.47511473j, -0.18299305+0.40777481j, 0.31906300+0.82514223j],
       [-0.62298966+0.07231745j, -0.61407815-0.42709603j, 0.03660313+0.30160428j]])
golemflavor.fr.determinant(x)[source]

Calculate the determininant of a 3x3 matrix.

Parameters:
x : ndarray, shape = (3, 3)
Returns:
float determinant

Examples

>>> print(determinant(
>>>     [[-1.65238188-0.59549718j,  0.27486548-0.18437467j, -1.35524534-0.38542072j],
>>>      [-1.07480906+0.29630449j, -0.47808456-0.80316821j, -0.88609356-1.50737308j],
>>>      [-0.14924144-0.99230446j,  0.49504234+0.63639805j, 2.29258915-0.36537507j]]
>>> ))
(2.7797571563274688+3.0841795325804848j)
golemflavor.fr.flat_angles_to_u(x)[source]

Convert from angles to mixing elements.

golemflavor.fr.fr_to_angles(ratios)[source]

Convert from flavor ratio into the angular projection of the flavor ratios.

Parameters:
TODO(shivesh)
golemflavor.fr.normalize_fr(fr)[source]

Normalize an input flavor combination to a flavor ratio.

Parameters:
fr : list, length = 3

flavor combination

Returns:
numpy ndarray flavor ratio

Examples

>>> from fr import normalize_fr
>>> print(normalize_fr((1, 2, 3)))
array([ 0.16666667,  0.33333333,  0.5       ])
params_to_BSMu(bsm_angles, dim, energy, mass_eigenvalues=[7.4e-23, 2.515e-21], sm_u=array([[ 0.82327921+0.j , 0.54796108+0.j ,
-0.09913534+0.11010079j],
[-0.30340559+0.06889398j, 0.59033699+0.0458547j ,
0.74336952+0.j ],
[ 0.47090947+0.06045075j, -0.58950774+0.04023502j,
0.65226662+0.j ]], dtype=complex256), no_bsm=False, texture=<Texture.NONE: 4>, check_uni=True, epsilon=1e-07)

Construct the BSM mixing matrix from the BSM parameters.

Parameters:
bsm_angles : list, length > 3

BSM parameters

dim : int

Dimension of BSM physics

energy : float

Energy in GeV

mass_eigenvalues : list, length = 2

SM mass eigenvalues

sm_u : numpy ndarray, dimension 3

SM mixing matrix

no_bsm : bool

Turn off BSM behaviour

texture : Texture

BSM mixing texture

check_uni : bool

Check the resulting BSM mixing matrix is unitary

Returns:
unitary numpy ndarray of shape (3, 3)

Examples

>>> from fr import params_to_BSMu
>>> print(params_to_BSMu((0.2, 0.3, 0.5, 1.5, -20), dim=3, energy=1000))
array([[ 0.18658169 -6.34190523e-01j, -0.26460391 +2.01884200e-01j, 0.67247096 -9.86808417e-07j],
       [-0.50419832 +2.14420570e-01j, -0.36013768 +5.44254868e-01j, 0.03700961 +5.22039894e-01j],
       [-0.32561308 -3.95946524e-01j,  0.64294909 -2.23453580e-01j, 0.03700830 +5.22032403e-01j]])
golemflavor.fr.test_unitarity(x, prnt=False, rse=False, epsilon=None)[source]

Test the unitarity of a matrix.

Parameters:
x : numpy ndarray

Matrix to evaluate

prnt : bool

Print the result

rse : bool

Raise Assertion if matrix is not unitary

Returns:
numpy ndarray

Examples

>>> from fr import test_unitarity
>>> x = np.identity(3)
>>> print(test_unitarity(x))
array([[ 1.,  0.,  0.],
       [ 0.,  1.,  0.],
       [ 0.,  0.,  1.]])
golemflavor.fr.u_to_fr(source_fr, matrix)[source]

Compute the observed flavor ratio assuming decoherence.

Parameters:
source_fr : list, length = 3

Source flavor ratio components

matrix : numpy ndarray, dimension 3

Mixing matrix

Returns:
Measured flavor ratio

Examples

>>> from fr import params_to_BSMu, u_to_fr
>>> print(u_to_fr((1, 2, 0), params_to_BSMu((0.2, 0.3, 0.5, 1.5, -20), 3, 1000)))
    array([ 0.33740075,  0.33176584,  0.33083341])

GolemFit Hooks

Useful GolemFit wrappers for the BSM flavor ratio analysis

Likelihood

Likelihood functions for the BSM flavor ratio analysis

golemflavor.llh.GaussianBoundedRV(loc=0.0, sigma=1.0, lower=-inf, upper=inf)[source]

Normalized Gaussian bounded between lower and upper values

golemflavor.llh.lnprior(theta, paramset)[source]

Priors on theta.

golemflavor.llh.multi_gaussian(fr, fr_bf, smearing, offset=-320)[source]

Multivariate Gaussian log likelihood.

Parameters:
fr : List[float], length 3

The flavour composition to evaluate at.

fr_bf : List[float], length 3

The bestfit / injected flavour composition.

smearing : float

The amount of smearing.

offset : float, optional

An amount to offset the magnitude of the log likelihood.

Returns:
llh : float

The log likelihood evaluated at fr.

golemflavor.llh.triangle_llh(theta, args, asimov_paramset, llh_paramset)[source]

Log likelihood function for a given theta.

Miscellaneous

Misc functions for the BSM flavor ratio analysis

class golemflavor.misc.SortingHelpFormatter(prog, indent_increment=2, max_help_position=24, width=None)[source]

Sort argparse help options alphabetically.

Methods

add_arguments  
golemflavor.misc.gen_outfile_name(args)[source]

Generate a name for the output file based on the input args.

Parameters:
args : argparse

argparse object to print

golemflavor.misc.interval(arr, percentile=68.0)[source]

Returns the percentile shortest interval around the mode.

golemflavor.misc.most_likely(arr)[source]

Return the densest region given a 1D array of data.

golemflavor.misc.parse_bool(s)[source]

Parse a string to a boolean.

Parameters:
s : str

String to parse

Returns:
bool

Examples

>>> from misc import parse_bool
>>> print(parse_bool('true'))
True
golemflavor.misc.print_args(args)[source]

Print the input arguments.

Parameters:
args : argparse

argparse object to print

Parameter class

Param class and functions for the BSM flavor ratio analysis

class golemflavor.param.Param(name, value, ranges, prior=None, seed=None, std=None, tex=None, tag=None)[source]

Parameter class to store parameters.

Attributes:
prior
ranges
seed
tag
tex
class golemflavor.param.ParamSet(*args)[source]

Container class for a set of parameters.

Attributes:
labels
names
nominal_values
params
ranges
seeds
stds
tags
values

Methods

extend  
from_tag  
remove_params  
to_dict  

Visualization

Plotting functions for the BSM flavor ratio analysis

golemflavor.plot.alpha_shape(points, alpha)[source]

Compute the alpha shape (concave hull) of a set of points.

Parameters:
points: Iterable container of points.
alpha: alpha value to influence the gooeyness of the border. Smaller
numbers don’t fall inward as much as larger numbers. Too large, and you
lose everything!
golemflavor.plot.chainer_plot(infile, outfile, outformat, args, llh_paramset, fig_text=None, labels=None, ranges=None)[source]

Make the triangle plot.

golemflavor.plot.flavor_contour(frs, nbins, coverage, ax=None, smoothing=0.4, hist_smooth=0.05, plot=True, fill=False, oversample=1.0, delaunay=False, d_alpha=1.5, d_gauss=0.08, debug=False, **kwargs)[source]

Plot the flavor contour for a specified coverage.

golemflavor.plot.gen_figtext(args)[source]

Generate the figure text.

golemflavor.plot.plot_Tchain(Tchain, axes_labels, ranges, names=None)[source]

Plot the Tchain using getdist.

golemflavor.plot.plot_statistic(data, outfile, outformat, args, scale_param, label=None)[source]

Make MultiNest factor or LLH value plot.

golemflavor.plot.plot_x(data, outfile, outformat, args, normalize=False)[source]

Limit plot as a function of the source flavor ratio for each operator texture.

golemflavor.plot.project(p)[source]

Convert from flavor to cartesian.

golemflavor.plot.project_toflavor(p, nbins)[source]

Convert from cartesian to flavor space.