How to use the flavio.classes.Observable 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 / zdecays / gammaz.py View on Github external
_obs.add_taxonomy(r'Process :: $Z^0$ decays :: Flavour conserving decays :: $' + _process_tex + r"$")
flavio.classes.Prediction(_obs_name, Gammatot)

_obs_name = "sigma_had"
_obs = flavio.classes.Observable(_obs_name)
_obs.tex = r"$\sigma_\text{had}^0$"
_obs.set_description(r"$e^+e^-\to Z^0$ hadronic pole cross-section")
for _f in (_uquarks, _dquarks):
    for f, tex in _f.items():
        _process_tex = r"Z^0\to{}\bar{}".format(tex, tex)
        _obs.add_taxonomy(r'Process :: $Z^0$ decays :: Flavour conserving decays :: $' + _process_tex + r"$")
flavio.classes.Prediction(_obs_name, sigmahad)


_obs_name = "Gamma(Z->nunu)"
_obs = flavio.classes.Observable(_obs_name)
_process_tex = r"Z^0\to\nu\bar\nu"
_obs.tex = r"$\Gamma(" + _process_tex + r")$"
_obs.set_description(r"Partial width of $" + _process_tex + r"$, averaged over neutrino flavours")
_obs.add_taxonomy(r'Process :: $Z^0$ decays :: Flavour conserving decays :: $' + _process_tex + r"$")
flavio.classes.Prediction(_obs_name, GammaZnu)


_obs_name = "R_l"
_obs = flavio.classes.Observable(_obs_name)
_obs.tex = r"$R_l^0$"
_obs.set_description(r"Ratio of $Z^0$ partial widths to hadrons vs. leptons, averaged over lepton flavours")
for l in [' e', r'\mu', r'\tau']:
    _obs.add_taxonomy(r"Process :: $Z^0$ decays :: Flavour conserving decays :: $Z^0\to {}^+{}^-$".format(l, l))
flavio.classes.Prediction(_obs_name, Rl)
github flav-io / flavio / flavio / physics / kdecays / kpinunu.py View on Github external
return sum(brs)

# Observable and Prediction instances

_process_taxonomy = r'Process :: $s$ hadron decays :: FCNC decays :: $K\to \pi\nu\bar\nu$ :: '

_obs_name = "BR(K+->pinunu)"
_obs = flavio.classes.Observable(name=_obs_name)
_tex = r"K^+\to\pi^+\nu\bar\nu"
_obs.set_description(r"Branching ratio of $" + _tex + r"$")
_obs.tex = r"$\text{BR}(" + _tex + r")$"
_obs.add_taxonomy(_process_taxonomy + r'$' + _tex + r'$')
flavio.classes.Prediction(_obs_name, br_kplus_pinunu_summed)

_obs_name = "BR(KL->pinunu)"
_obs = flavio.classes.Observable(name=_obs_name)
_tex = r"K_L\to\pi^0\nu\bar\nu"
_obs.set_description(r"Branching ratio of $" + _tex + r"$")
_obs.tex = r"$\text{BR}(" + _tex + r")$"
_obs.add_taxonomy(_process_taxonomy + r'$' + _tex + r'$')
flavio.classes.Prediction(_obs_name, br_klong_pinunu_summed)
github flav-io / flavio / flavio / physics / bdecays / lambdablambdall.py View on Github external
for l in ['e', 'mu', ]: # tau requires lepton mass dependence!

    _process_tex = r"\Lambda_b\to\Lambda " +_tex[l]+r"^+"+_tex[l]+r"^-"
    _process_taxonomy = r'Process :: $b$ hadron decays :: FCNC decays :: $\Lambda_b\to \Lambda\ell^+\ell^-$ :: $' + _process_tex + r"$"

    # binned branching ratio
    _obs_name = "(Lambdab->Lambda"+l+l+")"
    _obs = Observable(name=_obs_name, arguments=['q2min', 'q2max'])
    _obs.set_description(r"Binned differential branching ratio of $" + _process_tex + r"$")
    _obs.tex = r"$\langle \frac{d\text{BR}}{dq^2} \rangle(" + _process_tex + r")$"
    _obs.add_taxonomy(_process_taxonomy)
    Prediction(_obs_name, dbrdq2_int_func(l))

    # differential branching ratio
    _obs_name = "dBR/dq2(Lambdab->Lambda"+l+l+")"
    _obs = Observable(name=_obs_name, arguments=['q2'])
    _obs.set_description(r"Differential branching ratio of $" + _process_tex + r"$")
    _obs.tex = r"$\frac{d\text{BR}}{dq^2}(" + _process_tex + r")$"
    _obs.add_taxonomy(_process_taxonomy)
    Prediction(_obs_name, dbrdq2_func(l))

    for obs in _observables:
        # binned angular observables
        _obs_name = "<" + obs + ">(Lambdab->Lambda"+l+l+")"
        _obs = Observable(name=_obs_name, arguments=['q2min', 'q2max'])
        _obs.set_description("Binned " + _observables[obs]['desc'] + r" in $" + _process_tex + r"$")
        _obs.tex = r"$\langle " + _observables[obs]['tex'] + r"\rangle(" + _process_tex + r")$"
        _obs.add_taxonomy(_process_taxonomy)
        Prediction(_obs_name, obs_int_ratio_func(_observables[obs]['func_num'], dGdq2, l))

        # differential angular observables
        _obs_name = obs + "(Lambdab->Lambda"+l+l+")"
github flav-io / flavio / flavio / physics / bdecays / bxgamma.py View on Github external
_obs_name = "BR(B->Xsgamma)"
_obs = Observable(_obs_name)
_obs.set_description(r"CP-averaged branching ratio of $B\to X_s\gamma$ for $E_\gamma>1.6$ GeV")
_obs.tex = r"$\text{BR}(B\to X_s\gamma)$"
_obs.add_taxonomy(_process_taxonomy + r"$B\to X_s\gamma$")
Prediction(_obs_name, lambda wc_obj, par: BRBXgamma(wc_obj, par, 's', 1.6))

_obs_name = "BR(B->Xdgamma)"
_obs = Observable(_obs_name)
_obs.set_description(r"CP-averaged branching ratio of $B\to X_d\gamma$ for $E_\gamma>1.6$ GeV")
_obs.tex = r"$\text{BR}(B\to X_d\gamma)$"
_obs.add_taxonomy(_process_taxonomy + r"$B\to X_d\gamma$")
Prediction(_obs_name, lambda wc_obj, par: BRBXgamma(wc_obj, par, 'd', 1.6))

_obs_name = "ACP(B->Xgamma)"
_obs = Observable(_obs_name)
_obs.set_description(r"Direct CP asymmetry in $B\to X_{s+d}\gamma$ for $E_\gamma>1.6$ GeV")
_obs.tex = r"$A_\text{CP}(B\to X_{s+d}\gamma)$"
_obs.add_taxonomy(_process_taxonomy + r"$B\to X_{s+d}\gamma$")
Prediction(_obs_name, lambda wc_obj, par: ACPBXgamma(wc_obj, par, 1.6))
github flav-io / flavio / flavio / physics / taudecays / tauvl.py View on Github external
# function returning function needed for prediction instance
def br_tauvl_fct(V, lep):
    def f(wc_obj, par):
        return br_tauvl(wc_obj, par, V, lep)
    return f

# Observable and Prediction instances

_had = {'rho0': r'\rho^0', 'phi': r'\phi'}
_shortname = {'rho0': 'rho', 'phi': 'phi'}
_lep = {'e': ' e', 'mu': r'\mu',}

for V in _had:
    for l in _lep:
        _obs_name = "BR(tau->" + _shortname[V] + l + r")"
        _obs = flavio.classes.Observable(_obs_name)
        _process_tex = r"\tau^+\to " + _had[V] + _lep[l] + r"^+"
        _process_taxonomy = r'Process :: $\tau$ lepton decays :: LFV decays :: $\tau\to V\ell$ :: $' + _process_tex + r"$"
        _obs.add_taxonomy(_process_taxonomy)
        _obs.set_description(r"Branching ratio of $" + _process_tex + r"$")
        _obs.tex = r"$\text{BR}(" + _process_tex + r")$"
        flavio.classes.Prediction(_obs_name, br_tauvl_fct(V, l))
github flav-io / flavio / flavio / physics / bdecays / bxll.py View on Github external
# differential AFB
            _obs_name = "AFB(B->X"+q+l+l+")"
            _obs = Observable(name=_obs_name, arguments=['q2'])
            _obs.set_description(r"Normalized forward-backward asymmetry of $" + _process_tex + r"$")
            _obs.tex = r"$A_\text{FB}(" + _process_tex + r")$"
            _obs.add_taxonomy(_process_taxonomy)
            Prediction(_obs_name, bxll_afb_func(q, l))


for l in [('mu','e'), ('tau','mu'),]:
    for q in ['s', 'd']:
        _process_taxonomy = r'Process :: $b$ hadron decays :: FCNC decays :: $B\to X\ell^+\ell^-$ :: $'

        # binned branching ratio
        _obs_name = "(B->X"+q+"ll)"
        _obs = Observable(name=_obs_name, arguments=['q2min', 'q2max'])
        _obs.set_description(r"Ratio of partial branching ratios of $B\to X_" + q +_tex[l[0]]+r"^+"+_tex[l[0]]+r"^-$" + " and " + r"$B\to X_" + q +_tex[l[1]]+r"^+"+_tex[l[1]]+r"^-$")
        _obs.tex = r"$\langle R_{" + _tex[l[0]] + ' ' + _tex[l[1]] + r"} \rangle(B\to X_" + q + r"\ell^+\ell^-)$"
        for  li in l:
            # add taxonomy for both lepton flavours
            _obs.add_taxonomy(_process_taxonomy + r"B\to X_" + q +_tex[li]+r"^+"+_tex[li]+r"^-$")
        Prediction(_obs_name, bxll_br_int_ratio_func(q, l[0], l[1]))
github flav-io / flavio / flavio / physics / bdecays / bplnu.py View on Github external
_obs_name = br + "("+M+l+"nu)"
            _process_tex = _hadr[M]['tex']+_tex[l]+r"^+\nu_"+_tex[l]
            _obs = Observable(_obs_name)
            _obs.set_description(_desc[br] + r" branching ratio of $" + _process_tex + r"$")
            _obs.tex = r'$' + _tex_br[br] + r"(" + _process_tex + r")$"
            _obs.arguments = _args[br]
            _obs.add_taxonomy(_process_taxonomy + _process_tex + r"$")
            Prediction(_obs_name, _func[br](_hadr[M]['B'], _hadr[M]['P'], 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 = "("+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"$")
        _obs.tex = r"$\langle R_{" + _tex[l[0]] + ' ' + _tex[l[1]] + r"} \rangle(" + _hadr_l[M]['tex'] + r"\ell^+\nu)$"
        for li in l:
            for N in _hadr_l[M]['decays']:
                # add taxonomy for both processes (e.g. B->Penu and B->Pmunu) and for charged and neutral
                _obs.add_taxonomy(_process_taxonomy + _hadr[N]['tex'] + _tex[li]+r"^+\nu_"+_tex[li]+r"$")
        Prediction(_obs_name, BR_binned_leptonflavour_function(_hadr_l[M]['B'], _hadr_l[M]['P'], l[0], l[1]))

        # ratio of total BRs
        _obs_name = "R"+l[0]+l[1]+"("+M+"lnu)"
        _obs = Observable(name=_obs_name)
        _obs.set_description(r"Ratio of total 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"$")
        _obs.tex = r"$R_{" + _tex[l[0]] + ' ' + _tex[l[1]] + r"}(" + _hadr_l[M]['tex'] + r"\ell^+\nu)$"
        for li in l:
            for N in _hadr_l[M]['decays']:
                # add taxonomy for both processes (e.g. B->Penu and B->Pmunu) and for charged and neutral
github flav-io / flavio / flavio / physics / bdecays / bpnunu.py View on Github external
_obs.tex = r"$\langle \frac{d\text{BR}}{dq^2} \rangle(" + _process_tex + r")$"
    _obs.add_taxonomy(_process_taxonomy)
    flavio.classes.Prediction(_obs_name, dbrdq2_int_summed(_hadr[M]['B'], _hadr[M]['P']))

    # differential branching ratio
    _obs_name = "dBR/dq2("+M+"nunu)"
    _obs = flavio.classes.Observable(name=_obs_name, arguments=['q2'])
    _process_tex = _hadr[M]['tex'] + r"\nu\bar\nu"
    _obs.set_description(r"Differential branching ratio of $" + _process_tex + r"$")
    _obs.tex = r"$\frac{d\text{BR}}{dq^2}(" + _process_tex + r")$"
    _obs.add_taxonomy(_process_taxonomy)
    flavio.classes.Prediction(_obs_name, dbrdq2_summed(_hadr[M]['B'], _hadr[M]['P']))

    # total branching ratio
    _obs_name = "BR("+M+"nunu)"
    _obs = flavio.classes.Observable(name=_obs_name)
    _obs.set_description(r"Branching ratio of $" + _process_tex + r")$")
    _obs.tex = r"$\text{BR}(" + _process_tex + r")$"
    _obs.add_taxonomy(_process_taxonomy)
    flavio.classes.Prediction(_obs_name, BRtot_summed(_hadr[M]['B'], _hadr[M]['P']))