How to use the flavio.default_parameters.get_central_all function in flavio

To help you get started, we’ve selected a few flavio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flav-io / flavio / flavio / physics / bdecays / test_wc.py View on Github external
def test_clnu(self):
        par_dict = flavio.default_parameters.get_central_all()
        par_dict['alpha_s'] = 0.1184
        par_dict['alpha_e'] = 1/127.925
        par_dict['s2w']  = 0.2315
        par_dict['m_t']  = 173.3
        cl = wilsoncoefficients.CL_SM(par_dict)
        # comparing the central value of X_t to (4.2) of 1009.0947
        self.assertAlmostEqual(-cl*par_dict['s2w']/1.469, 1, delta=0.01)
github flav-io / flavio / flavio / physics / bdecays / test_bxlnu.py View on Github external
import unittest
import numpy as np
import flavio
from flavio.physics.bdecays.bxlnu import g, gLR, gVS, gVSp

par = flavio.default_parameters.get_central_all()
wc_obj = flavio.WilsonCoefficients()
par['Vcb'] = 0.04221 # inclusive Vcb: see 1411.6560

class TestBXlnu(unittest.TestCase):
    def test_bxclnu(self):
        # check that the NLO and NNLO functions reproduce the correct numbers
        self.assertAlmostEqual(
            flavio.physics.bdecays.bxlnu.pc1(r=(0.986/4.6)**2, mb=4.6),
            -1.65019, delta=0.001)
        self.assertAlmostEqual(
            flavio.physics.bdecays.bxlnu.pc2(r=(0.986/4.6)**2, mb=4.6),
            -1.91556 -0.4519 * 9 , delta=0.001)
        # check that the total BR roughly agrees with the experimental value
        self.assertAlmostEqual(
            flavio.sm_prediction('BR(B->Xcenu)'),
            0.1065,
github flav-io / flavio / flavio / physics / taudecays / test_taulnunu.py View on Github external
import unittest
import flavio
from flavio.physics.taudecays import taulnunu
from wilson import Wilson
from math import sqrt


par = flavio.default_parameters.get_central_all()
wc_obj = flavio.WilsonCoefficients()


class TestTaulnunu(unittest.TestCase):
    def test_taulnunu_exp(self):
        # compare to the experimental values
        # cf. eq. (95) of 1705.00929
        self.assertAlmostEqual(flavio.sm_prediction('BR(tau->mununu)') / 0.1739,
                               1 / 1.0060, delta=0.0003)
        self.assertAlmostEqual(flavio.sm_prediction('BR(tau->enunu)') / 0.1782,
                               1 / 1.0022, delta=0.0003)

    def test_taulnunu_wrongflavor(self):
        self.assertEqual(taulnunu.BR_taulnunu(wc_obj, par, 'e', 'mu', 'e'), 0)

    def test_taulnunu_np(self):
github flav-io / flavio / flavio / physics / edms / test_neutronedm.py View on Github external
import unittest
import flavio
from wilson import wcxf
from math import sqrt


par = flavio.default_parameters.get_central_all()


class TestNeutronEDM(unittest.TestCase):
    def test_nedm_sm(self):
        self.assertEqual(flavio.sm_prediction('d_n'), 0)

    def test_nedm_jms_G(self):
        wc = wcxf.WC('WET', 'JMS', 160, {'Gtilde': 1e-6})
        wcf = flavio.WilsonCoefficients()
        wcf.set_initial_wcxf(wc)
        wcd = wcf.get_wc('dF=0', scale=2, par=par, eft='WET-3', basis='flavio')
        self.assertEqual(wcd['CG'], 0)
        self.assertAlmostEqual(wcd['CGtilde'], 0.007, delta=0.001)
        par_G = par.copy()
        par_G['gT_d'] = 0
        par_G['nEDM ~rho_d'] = 0
github flav-io / flavio / flavio / physics / taudecays / test_taulgamma.py View on Github external
def compare_BR(wc_wilson, l1, l2):
    scale = flavio.config['renormalization scale'][l1+'decays']
    ll = wcxf_sector_names[l1, l2]
    par = flavio.default_parameters.get_central_all()
    wc_obj = flavio.WilsonCoefficients.from_wilson(wc_wilson, par)
    par = flavio.parameters.default_parameters.get_central_all()
    wc = wc_obj.get_wc(ll, scale, par, nf_out=4)
    alpha = flavio.physics.running.running.get_alpha_e(par, scale, nf_out=4)
    e = sqrt(4 * pi * alpha)
    ml = par['m_' + l1]
    # cf. (18) of hep-ph/0404211
    pre = 48 * pi**3 * alpha / par['GF']**2
    DL = 2 / (e * ml) * wc['Cgamma_' + l1 + l2]
    DR = 2 / (e * ml) * wc['Cgamma_' + l2 + l1].conjugate()
    if l1 == 'tau':
        BR_SL = par['BR(tau->{}nunu)'.format(l2)]
    else:
        BR_SL = 1  # BR(mu->enunu) = 1
    return pre * (abs(DL)**2 + abs(DR)**2) * BR_SL
github flav-io / flavio / flavio / physics / running / test_running.py View on Github external
def test_mb1S(self):
        par = flavio.default_parameters.get_central_all()
        par['m_b'] = 4.18
        par['alpha_s'] = 0.1185
        alpha_s = get_alpha(par, par['m_b'], nf_out=5)['alpha_s']
        mb1S = get_mb_1S(par, nl=3)
        self.assertAlmostEqual(mb1S, 4.67, delta=0.005)
github flav-io / flavio / flavio / functions.py View on Github external
def get_dependent_parameters_sm(obs_name, *args, **kwargs):
    """Get the set of parameters the SM prediction of the observable depends on."""
    obs = flavio.classes.Observable[obs_name]
    wc_sm = flavio.physics.eft._wc_sm
    par_central = flavio.default_parameters.get_central_all()
    apar_central = AwareDict(par_central)
    obs.prediction_par(apar_central, wc_sm, *args, **kwargs)
    # return all observed keys except the ones that don't actually correspond
    # to existing parameter names (this might happen by user functions modifying
    # the dictionaries)
    return {p for p in apar_central.akeys
            if p in flavio.Parameter.instances.keys()}
github flav-io / flavio / flavio / io / flha.py View on Github external
Input
    -----

    - `filename`: the path to the file as a string

    Returns an instance of `flavio.WilsonCoefficients` that can be used for
    `flavio.np_prediction`, for instance.
    """
    warnings.warn("The FLHA interface will be removed in the near future. Please use the WCxf format instead.",
                  FutureWarning)
    if not os.path.exists(filename):
        raise ValueError("File " + filename + " not found.")
    card = flavio.io.slha.read(filename)
    wc_flha = card.matrices['fwcoef']
    scale = wc_flha.scale
    par_dict = flavio.default_parameters.get_central_all()
    prefac = _prefactors_bsll(par_dict, scale)
    wc_dict = {}
    for k, v in wc_flha.dict().items():
        if k[-1] != 1: # only look at NP-only Wilson coefficients
            continue
        if k[:2] not in _flha_dict:
            log.warning('Wilson coefficient ' + str(k[:2]) + ' unknown to flavio; ignored.')
            continue
        wc_name = _flha_dict[k[:2]]
        if wc_name not in prefac:
            wc_dict[wc_name] = v
        else:
            wc_dict[wc_name] = v / prefac[wc_name]
    wc_obj =  flavio.WilsonCoefficients()
    wc_obj.set_initial(wc_dict, scale=scale)
    return wc_obj