How to use smelli - 10 common examples

To help you get started, we’ve selected a few smelli 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 smelli / smelli / smelli / test_ckm.py View on Github external
def test_init(self):
        gl = smelli.GlobalLikelihood()
        # with fix_ckm
        gl_fixckm = smelli.GlobalLikelihood(fix_ckm=True)
        self.assertEqual(gl.par_dict_default['Vcb'], par['Vcb'])
        VcbSM = gl.par_dict_sm['Vcb']
        VubSM = gl.par_dict_sm['Vub']
        VusSM = gl.par_dict_sm['Vus']
        deltaSM = gl.par_dict_sm['delta']
        self.assertAlmostEqual(par['Vcb'], VcbSM, delta=0.0002)
        self.assertAlmostEqual(par['Vub'], VubSM, delta=0.0005)
        self.assertAlmostEqual(par['Vus'], VusSM, delta=0.0006)
        pre = -4 * par['GF'] / sqrt(2)
        # Vcb
        w = Wilson({'lq3_1123': 0.5 * pre * VcbSM * (-0.5)}, 91.1876, 'SMEFT', 'Warsaw')
        pp = gl.parameter_point(w)
        self.assertAlmostEqual(pp.par_dict_np['Vcb'] / VcbSM,  1.5, delta=0.03)
        # with fix_ckm
github smelli / smelli / smelli / test_ckm.py View on Github external
def test_init(self):
        gl = smelli.GlobalLikelihood()
        # with fix_ckm
        gl_fixckm = smelli.GlobalLikelihood(fix_ckm=True)
        self.assertEqual(gl.par_dict_default['Vcb'], par['Vcb'])
        VcbSM = gl.par_dict_sm['Vcb']
        VubSM = gl.par_dict_sm['Vub']
        VusSM = gl.par_dict_sm['Vus']
        deltaSM = gl.par_dict_sm['delta']
        self.assertAlmostEqual(par['Vcb'], VcbSM, delta=0.0002)
        self.assertAlmostEqual(par['Vub'], VubSM, delta=0.0005)
        self.assertAlmostEqual(par['Vus'], VusSM, delta=0.0006)
        pre = -4 * par['GF'] / sqrt(2)
        # Vcb
        w = Wilson({'lq3_1123': 0.5 * pre * VcbSM * (-0.5)}, 91.1876, 'SMEFT', 'Warsaw')
        pp = gl.parameter_point(w)
        self.assertAlmostEqual(pp.par_dict_np['Vcb'] / VcbSM,  1.5, delta=0.03)
        # with fix_ckm
        pp = gl_fixckm.parameter_point(w)
        self.assertEqual(pp.par_dict_np['Vcb'] / par['Vcb'],  1)
github smelli / smelli / smelli / test_ckm.py View on Github external
def test_fast_likelihoods(self):
        scheme = ckm.CKMSchemeRmuBtaunuBxlnuDeltaM()
        ckm_central = scheme.ckm_np()
        gl = smelli.GlobalLikelihood()
        for fl in gl.fast_likelihoods.values():
            par = fl.par_obj
            self.assertAlmostEqual(par.get_central('Vus'), ckm_central[0], delta=0.00001)
            self.assertAlmostEqual(par.get_central('Vcb'), ckm_central[1], delta=0.00001)
            self.assertAlmostEqual(par.get_central('Vub'), ckm_central[2], delta=0.00001)
            self.assertAlmostEqual(par.get_central('delta'), ckm_central[3], delta=0.0001)
github smelli / smelli / smelli / test_ckm.py View on Github external
def test_fast_likelihoods(self):
        scheme = ckm.CKMSchemeRmuBtaunuBxlnuDeltaM()
        ckm_central = scheme.ckm_np()
        gl = smelli.GlobalLikelihood()
        for fl in gl.fast_likelihoods.values():
            par = fl.par_obj
            self.assertAlmostEqual(par.get_central('Vus'), ckm_central[0], delta=0.00001)
            self.assertAlmostEqual(par.get_central('Vcb'), ckm_central[1], delta=0.00001)
            self.assertAlmostEqual(par.get_central('Vub'), ckm_central[2], delta=0.00001)
            self.assertAlmostEqual(par.get_central('delta'), ckm_central[3], delta=0.0001)
github smelli / smelli / smelli / test_ckm.py View on Github external
def test_sm(self):
        scheme = ckm.CKMSchemeRmuBtaunuBxlnuDeltaM()
        scheme.ckm_covariance()
        Vus, Vcb, Vub, delta = scheme.ckm_np(None)
        self.assertAlmostEqual(Vus, 0.225, delta=0.001)
        self.assertAlmostEqual(Vcb, 0.041, delta=0.0015)
        self.assertAlmostEqual(Vub, 0.004, delta=0.0005)
        self.assertAlmostEqual(delta, 1.15, delta=0.2)
github smelli / smelli / smelli / test_ckm.py View on Github external
def test_ckm_np(self):
        scheme = ckm.CKMSchemeRmuBtaunuBxlnuDeltaM()
        w = Wilson({'lq3_1123': 0.04e-5,
                    'lq3_3313': 0.008e-5,
                    'lq3_2212': 0.5e-7,
                    'qq1_2323': 1e-12,
                    }, 91.1876, 'SMEFT', 'Warsaw')
        Vus, Vcb, Vub, delta = scheme.ckm_np(w, iterate=10)
        w.set_option('parameters', {'Vus': Vus, 'Vcb': Vcb, 'Vub': Vub, 'gamma': delta})
        _Vus, _Vcb, _Vub, _delta = scheme._ckm_np(w, Vus=Vus, Vcb=Vcb, Vub=Vub, delta=delta)
        self.assertAlmostEqual(_Vus, Vus, places=2)
        self.assertAlmostEqual(_Vcb, Vcb, places=2)
        self.assertAlmostEqual(_Vub, Vub, places=2)
        self.assertAlmostEqual(_delta, delta, places=2)
github smelli / smelli / smelli / __init__.py View on Github external
def _check_flavio_version():
    version_installed = flavio.__version__.split('.')
    version_required = __flavio__version__.split('.')
    if version_installed[:2] == version_required[:2]:
        return True
    else:
        return False
github smelli / smelli / smelli / data / cache / save_covariances.py View on Github external
parser.add_argument('-n', type=int, default=5000,
                        help='Number of evaluations (default 5000)')
    parser.add_argument('-t', type=int, default=1,
                        help='Number of threads (default 1)')
    parser.add_argument('-f', action='store_true',
                        help='Force recomputation (default false)')
    parser.add_argument('-s', type=str, default=DEFAULT_ckm_scheme,
                        help="Name of CKM scheme (default {})".format(
                        DEFAULT_ckm_scheme))
    parser.add_argument('--fix_ckm', action='store_true',
                        help='Fix CKM values to their SM values (default false)')

    args = parser.parse_args()

    from smelli import GlobalLikelihood
    gl = GlobalLikelihood(ckm_scheme=args.s, fix_ckm=args.fix_ckm)

    logging.info("Computing covariances with N={} and {} threads".format(args.n, args.t))

    gl.make_measurement(N=args.n, threads=args.t, force=args.f)
    gl.save_sm_covariances('.')
github smelli / smelli / smelli / classes.py View on Github external
def _get_yaml_path(self, name):
        """Return a path for the YAML file specified by `name`.
        If a YAML file with that name is found in the package's data
        directory, that is used. Otherwise, `name` is assumed to be a path.

        Raises `FileNotFoundError` if path does not exists.
        """
        path = get_datapath('smelli', 'data/yaml/' + name)
        if os.path.exists(path):
            return path
        path = get_datapath('smelli', 'data/yaml/' + name + '.yaml')
        if os.path.exists(path):
            return path
        if os.path.exists(name):
            return name
        if os.path.exists(name + '.yaml'):
            return name + '.yaml'
        else:
            raise FileNotFoundError("Likelihood YAML file '{}' was not found".format(name))
github smelli / smelli / smelli / classes.py View on Github external
def _get_yaml_path(self, name):
        """Return a path for the YAML file specified by `name`.
        If a YAML file with that name is found in the package's data
        directory, that is used. Otherwise, `name` is assumed to be a path.

        Raises `FileNotFoundError` if path does not exists.
        """
        path = get_datapath('smelli', 'data/yaml/' + name)
        if os.path.exists(path):
            return path
        path = get_datapath('smelli', 'data/yaml/' + name + '.yaml')
        if os.path.exists(path):
            return path
        if os.path.exists(name):
            return name
        if os.path.exists(name + '.yaml'):
            return name + '.yaml'
        else:
            raise FileNotFoundError("Likelihood YAML file '{}' was not found".format(name))

smelli

A Python package providing a global likelihood function in the space of dimension-6 Wilson coefficients of the Standard Model Effective Field Theory (SMEFT)

MIT
Latest version published 3 months ago

Package Health Score

61 / 100
Full package analysis