Exemple #1
0
 def test_functions(self):
     o = Observable('test_obs')
     o.arguments = ['x']
     def f(wc_obj, par_dict, x):
         return x
     pr  = Prediction('test_obs', f )
     wc_obj = None
     self.assertEqual(flavio.sm_prediction('test_obs', 7), 7)
     self.assertEqual(flavio.np_prediction('test_obs', x=7, wc_obj=wc_obj), 7)
     self.assertEqual(flavio.sm_uncertainty('test_obs', 7), 0)
     self.assertEqual(flavio.np_uncertainty('test_obs', x=7, wc_obj=wc_obj), 0)
     self.assertEqual(flavio.sm_uncertainty('test_obs', 7, threads=2), 0)
     self.assertEqual(flavio.np_uncertainty('test_obs', x=7, wc_obj=wc_obj, threads=2), 0)
     # delete dummy instance
     Observable.del_instance('test_obs')
Exemple #2
0
 def test_exp_combo(self):
     o = Observable('test_obs')
     o.arguments = ['x']
     m = Measurement('test_obs measurement 1')
     m.add_constraint([('test_obs', 1)], MultivariateNormalDistribution([1, 2], np.eye(2)))
     # error: no measurement
     with self.assertRaises(ValueError):
         flavio.combine_measurements('test_obs', x=1, include_measurements=['bla'])
     m.add_constraint([('test_obs', 1)], NormalDistribution(2, 3))
     combo = flavio.combine_measurements('test_obs', x=1)
     self.assertEqual(combo.central_value, 2)
     self.assertEqual(combo.standard_deviation, 3)
     m2 = Measurement('test_obs measurement 2')
     m2.add_constraint([('test_obs', 1)], NormalDistribution(3, 3))
     combo = flavio.combine_measurements('test_obs', x=1)
     self.assertAlmostEqual(combo.central_value, 2.5)
     self.assertAlmostEqual(combo.standard_deviation, sqrt(9 / 2))
     Observable.del_instance('test_obs')
Exemple #3
0
        'decays': ['Bs->K*'],
    },
}

_process_taxonomy = r'Process :: $b$ hadron decays :: Semi-leptonic tree-level decays :: $B\to V\ell\nu$ :: $'

for l in ['e', 'mu', 'tau', 'l']:
    for br in ['dBR/dq2', 'BR', '<BR>']:
        for M in _hadr.keys():
            _process_tex = _hadr[M]['tex'] + _tex[l] + r"^+\nu_" + _tex[l]
            _obs_name = br + "(" + M + l + "nu)"
            _obs = Observable(_obs_name)
            _obs.set_description(_desc[br] + r" branching ratio of $" +
                                 _process_tex + "$")
            _obs.tex = r'$' + _tex_br[br] + r"(" + _process_tex + ")$"
            _obs.arguments = _args[br]
            _obs.add_taxonomy(_process_taxonomy + _process_tex + r'$')
            Prediction(_obs_name, _func[br](_hadr[M]['B'], _hadr[M]['V'], l))

# Lepton flavour ratios
for l in [('mu', 'e'), ('tau', 'mu'), ('tau', 'l')]:
    for M in _hadr_l.keys():

        # binned ratio of BRs
        _obs_name = "<R" + l[0] + l[1] + ">(" + M + "lnu)"
        _obs = Observable(name=_obs_name, arguments=['q2min', 'q2max'])
        _obs.set_description(r"Ratio of partial branching ratios of $" +
                             _hadr_l[M]['tex'] + _tex[l[0]] + r"^+ \nu_" +
                             _tex[l[0]] + r"$" + " and " + r"$" +
                             _hadr_l[M]['tex'] + _tex[l[1]] + r"^+ \nu_" +
                             _tex[l[1]] + r"$")
Exemple #4
0
_tex = {'emu': r'e^+\mu^-', 'mue': r'\mu^+e^-',
    'taue': r'\tau^+e^-', 'etau': r'e^+\tau^-',
    'taumu': r'\tau^+\mu^-', 'mutau': r'\mu^+\tau^-'}
_tex_lsum = {'emu': r'e^\pm\mu^\mp',  'etau': r'e^\pm\tau^\mp', 'mutau': r'\mu^\pm\tau^\mp'}
_func = {'BR': BR_tot_function, }
_desc = { 'BR': 'Total', }
_tex_br = {'BR': r'\text{BR}', }
_args = {'BR': None, }
_hadr = {
'B0->K*': {'tex': r"\bar B^0\to \bar K^{*0}", 'B': 'B0', 'V': 'K*0', },
'B+->K*': {'tex': r"B^-\to K^{*-}", 'B': 'B+', 'V': 'K*+', },
'B+->rho': {'tex': r"B^-\to \rho^{-}", 'B': 'B+', 'V': 'rho+', },
'B0->rho': {'tex': r"\bar B^0\to \rho^{0}", 'B': 'B0', 'V': 'rho0', },
'Bs->phi': {'tex': r"\bar B_s\to \phi", 'B': 'Bs', 'V': 'phi', },
}

for ll in [('e','mu'), ('mu','e'), ('e','tau'), ('tau','e'), ('mu','tau'), ('tau','mu')]:
    for M in _hadr.keys():

        _process_tex = _hadr[M]['tex']+' '+_tex[''.join(ll)]
        _process_taxonomy = r'Process :: $b$ hadron decays :: FCNC decays :: $B\to V\ell^+\ell^-$ :: $' + _process_tex + r"$"

        for br in ['BR',]:
            _obs_name = br + "("+M+''.join(ll)+")"
            _obs = Observable(_obs_name)
            _obs.set_description(_desc[br] + r" branching ratio of $"+_process_tex+r"$")
            _obs.tex = r'$' + _tex_br[br] + "(" + _process_tex+r")$"
            _obs.arguments = _args[br]
            _obs.add_taxonomy(_process_taxonomy)
            Prediction(_obs_name, _func[br](_hadr[M]['B'], _hadr[M]['V'], ll[0], ll[1]))