Skip to content

Commit

Permalink
Merge 7056f71 into 011236d
Browse files Browse the repository at this point in the history
  • Loading branch information
MJKirk committed Feb 19, 2021
2 parents 011236d + 7056f71 commit 3c7790d
Show file tree
Hide file tree
Showing 43 changed files with 342 additions and 3 deletions.
3 changes: 3 additions & 0 deletions flavio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
from . import classes
from .classes import Measurement, Parameter, ParameterConstraints, Observable, NamedInstanceClass
from .config import config
#from .citations_module import citations, CitationScope
from . import citations
#from flavio.citations import CitationScope
from flavio.physics.eft import WilsonCoefficients
from flavio.parameters import default_parameters
from flavio.functions import sm_prediction, sm_uncertainty, np_uncertainty, sm_error_budget, np_prediction, sm_covariance, combine_measurements
68 changes: 68 additions & 0 deletions flavio/citations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Inspired by pybamm.citations
# https://github.com/pybamm-team/PyBaMM

from multiprocessing import Array
import flavio
import sys
from itertools import compress
import ctypes
import yaml
import pkgutil


class CitationScope:

def __enter__(self):
self._citations_global = flavio.citations
flavio.citations = Citations()
return flavio.citations

def __exit__(self, type, value, traceback):
flavio.citations = self._citations_global


class Citations:

collect = CitationScope
__all_citations = set(yaml.safe_load(
pkgutil.get_data('flavio', 'data/citations.yml')
))

def __init__(self, initial_citations=[]):
self._initial_citations = set(initial_citations)
self._all_citations = {
k:i for i,k in
enumerate(sorted(self.__all_citations | self._initial_citations))
}
self._array = Array(ctypes.c_bool, len(self._all_citations))
for inspire_key in self._initial_citations:
self.register(inspire_key)

def __iter__(self):
for citation in self.set:
yield citation

def __str__(self):
return ",".join(self.set)

@property
def set(self):
return set(compress(sorted(self._all_citations.keys()), self._array))

@property
def string(self):
return str(self)

def register(self, inspire_key):
self._array[self._all_citations[inspire_key]] = True

def clear(self):
self._array[:] = [False]*len(self._array)

def reset(self):
self.clear()
for inspire_key in self._initial_citations:
self.register(inspire_key)


sys.modules[__name__] = Citations(["Straub:2018kue"])
11 changes: 11 additions & 0 deletions flavio/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,17 @@ def get_measurements(self):
break
return ms

def theory_citations(self, *args, **kwargs):
"""Return a set of theory papers (in the form of INSPIRE texkeys) to
cite for the theory prediction for an observable.
Arguments are passed to the observable and are necessary,
depending on the observable (e.g. $q^2$-dependent observables).
"""
with flavio.citations.collect() as citations:
flavio.sm_prediction(self.name, *args, **kwargs)
return citations.set



class AuxiliaryQuantity(NamedInstanceClass):
Expand Down
42 changes: 42 additions & 0 deletions flavio/data/citations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
- Antonelli:2010yf
- Asatrian:2003vq
- Awramik:2003rn
- Beneke:2001at
- Beneke:2003az
- Beneke:2004dp
- Benson:2003kp
- Bernard:2009zm
- Bjorn:2016zlr
- Bobeth:2013uxa
- Boer:2014kda
- Bourrely:2008za
- Brignole:2004ah
- Brivio:2017vri
- Brod:2010hi
- Buras:2006gb
- Buras:2015yba
- Caprini:1997mu
- Chobanova:2017rkj
- Cirigliano:2007ga
- Descotes-Genon:2015hea
- Falkowski:2019hvp
- Freitas:2014hra
- Gambino:2011cq
- Gonzalez-Alonso:2018omy
- Gorbahn:2006bm
- Greub:2008cy
- Guadagnoli:2016erb
- Gubernari:2018wyi
- Huber:2015sra
- Inami:1980fz
- Kitano:2002mt
- Kozachuk:2017mdk
- Kruger:2002gf
- Kuno:1999jp
- Melikhov:2004mk
- Misiak:2006ab
- Misiak:2015xwa
- Pich:2013lsa
- Seidel:2004jh
- Straub:2015ica
- fakename:2020abc
25 changes: 25 additions & 0 deletions flavio/data/update_citations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#! /usr/bin/env python3

"""Standalone helper script to update the list of citations referenced in the
flavio source code."""

import argparse
import logging
import sys
import yaml
import pkgutil
logging.basicConfig(level=logging.INFO)

def main(argv):
parser = argparse.ArgumentParser(description='Update the list of citations referenced in the flavio source code.')
args = parser.parse_args()

from flavio.util import get_datapath, extract_citations

filename = get_datapath('flavio', 'data/citations.yml')
with open(filename, 'w') as f:
f.write(yaml.dump(sorted(extract_citations())))
logging.info(f"Saved updated citations to {filename}")

if __name__ == '__main__':
main(sys.argv)
14 changes: 13 additions & 1 deletion flavio/physics/bdecays/bllgamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def getfft(s, par, B, ff, ff0, lep, wc):

#Add light meson resonances
resonances = {'Bs': ['phi'], 'B0': ['rho0', 'omega']}
fVtofVemfactors = {'phi': -1/3, 'rho0': 1/sqrt(2), 'omega': 1/(3*sqrt(2))}
flavio.citations.register("Kozachuk:2017mdk")
fVtofVemfactors = {'phi': -1/3, 'rho0': 1/sqrt(2), 'omega': 1/(3*sqrt(2))} # Given in Sec. 8.A.3 of 1712.07926
#We use the general B->rho and B->omega parameters, hence the isotopic factors
resgV = {('Bs','phi'): -par['Bs->phi BSZ a0_T1'],
('B0','rho0'): 1/sqrt(2)*par['B->rho BSZ a0_T1'],
Expand All @@ -66,6 +67,7 @@ def getfft(s, par, B, ff, ff0, lep, wc):
return (fftv, ffta)

def getF1(s, par, B, ff, ff0, lep, wc):
flavio.citations.register("Melikhov:2004mk")
scale = config['renormalization scale']['bllgamma']
mb = running.get_mb(par, scale, nf_out=5)
mbh = mb/par['m_'+B]
Expand All @@ -75,6 +77,7 @@ def getF1(s, par, B, ff, ff0, lep, wc):
return (abs(wc['C9_'+label])**2 + abs(wc['C10_'+label])**2)*ff['v']**2 + 4*mbh**2/s**2*abs(wc['C7_'+bq]*fftv)**2 + 4*mbh/s*ff['v']*_Re(wc['C7_'+bq]*ffta*_Co(wc['C9_'+label]))

def getF2(s, par, B, ff, ff0, lep, wc):
flavio.citations.register("Melikhov:2004mk")
scale = config['renormalization scale']['bllgamma']
mb = running.get_mb(par, scale, nf_out=5)
mbh = mb/par['m_'+B]
Expand All @@ -85,6 +88,8 @@ def getF2(s, par, B, ff, ff0, lep, wc):


def B10(s, par, B, ff, ff0, lep, wc):
flavio.citations.register("Melikhov:2004mk")
flavio.citations.register("Guadagnoli:2016erb")
F1 = getF1(s, par, B, ff, ff0, lep, wc)
F2 = getF2(s, par, B, ff, ff0, lep, wc)
mlh = par['m_'+lep]/par['m_'+B]
Expand All @@ -94,11 +99,15 @@ def B10(s, par, B, ff, ff0, lep, wc):
# B11 vanishes for the BR estimation

def B12(s, par, B, ff, ff0, lep, wc):
flavio.citations.register("Melikhov:2004mk")
flavio.citations.register("Guadagnoli:2016erb")
F1 = getF1(s, par, B, ff, ff0, lep, wc)
F2 = getF2(s, par, B, ff, ff0, lep, wc)
return s*(F1+F2)

def B120(s, par, B, ff, ff0, lep, wc):
flavio.citations.register("Melikhov:2004mk")
flavio.citations.register("Guadagnoli:2016erb")
scale = config['renormalization scale']['bllgamma']
mb = running.get_mb(par, scale, nf_out=5)
mbh = mb/par['m_'+B]
Expand All @@ -110,18 +119,21 @@ def B120(s, par, B, ff, ff0, lep, wc):


def dG1dsMN(s, par, B, ff, ff0, lep, wc):
flavio.citations.register("Melikhov:2004mk")
mlh = par['m_'+lep]/par['m_'+B]
pref = prefactor(s, par, B, ff, lep, wc)*(1-s)**3*sqrt(1-4*mlh**2/s)
return pref*(B10(s, par, B, ff, ff0, lep, wc) + (s - 4*mlh**2)/(3*s)*B12(s, par, B, ff, ff0, lep, wc))

def dG2dsMN(s, par, B, ff, ff0, lep, wc):
flavio.citations.register("Melikhov:2004mk")
mlh = par['m_'+lep]/par['m_'+B]
bq = meson_quark[B]
label = bq+lep+lep
pref = 16*prefactor(s, par, B, ff, lep, wc)*(par['f_'+B]/par['m_'+B]*abs(wc['C10_'+label])*mlh)**2/(1-s)
return pref*(-8*sqrt(s-4*mlh**2)*sqrt(s)+4*atanh(sqrt(1-4*mlh**2/s))*(1+s-mlh**2*(1-s)**2))

def dG12dsMN(s, par, B, ff, ff0, lep, wc):
flavio.citations.register("Melikhov:2004mk")
mlh = par['m_'+lep]/par['m_'+B]
pref = 4*prefactor(s, par, B, ff, lep, wc)*par['f_'+B]/par['m_'+B]*(1-s)
return pref*atanh(sqrt(1-4*mlh**2/s))*B120(s, par, B, ff, ff0, lep, wc)
Expand Down
2 changes: 2 additions & 0 deletions flavio/physics/bdecays/bvll/observables_bs.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def bsvll_obs(function, q2, wc_obj, par, B, V, lep):

def S_theory_num_Bs(y, J, J_bar, J_h, i):
# (42) of 1502.05509
flavio.citations.register("Descotes-Genon:2015hea")
return 1/(1-y**2) * (J[i] + J_bar[i]) - y/(1-y**2) * J_h[i]

def S_experiment_num_Bs(y, J, J_bar, J_h, i):
Expand All @@ -51,6 +52,7 @@ def S_experiment_Bs(y, J, J_bar, J_h, i):

def dGdq2_ave_Bs(y, J, J_bar, J_h):
# (48) of 1502.05509
flavio.citations.register("Descotes-Genon:2015hea")
return (1/(1-y**2) * (observables.dGdq2(J) + observables.dGdq2(J_bar))
- y/(1-y**2) * observables.dGdq2(J_h))/2.

Expand Down
15 changes: 14 additions & 1 deletion flavio/physics/bdecays/bvll/qcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def get_input(par, B, V, scale):
# see eqs. (18), (50), (79) of hep-ph/0106067v2
# and eqs. (47), (48) of hep-ph/0412400
def Cq34(q2, par, wc, B, V, scale):
flavio.citations.register("Beneke:2001at")
flavio.citations.register("Beneke:2004dp")
# this is -C_q^12 (for q=u) or C_q^34 - eps_u * C_q^12 (for q=d,s) of hep-ph/0412400
mB, mb, mc, alpha_s, q, eq, ed, eu, eps_u, qiqj = get_input(par, B, V, scale)
T_t = wc['C3_'+qiqj] + 4/3.*(wc['C4_'+qiqj] + 12*wc['C5_'+qiqj] + 16*wc['C6_'+qiqj])
Expand All @@ -63,16 +65,18 @@ def T_para_minus_WA(q2, par, wc, B, V, scale):
return -eq * 4*mB/mb * Cq34(q2, par, wc, B, V, scale)


# B->V, weak annihaltion at O(1/mb)
# B->V, weak annihilation at O(1/mb)

# (51) of hep-ph/0412400

def T_perp_WA_PowC_1(q2, par, wc, B, V, scale):
flavio.citations.register("Beneke:2004dp")
mB, mb, mc, alpha_s, q, eq, ed, eu, eps_u, qiqj = get_input(par, B, V, scale)
# NB, the remaining prefactors are added below in the function T_perp
return -eq * 4/mb * (wc['C3_'+qiqj] + 4/3.*(wc['C4_'+qiqj] + 3*wc['C5_'+qiqj] + 4*wc['C6_'+qiqj]))

def T_perp_WA_PowC_2(q2, par, wc, B, V, scale):
flavio.citations.register("Beneke:2004dp")
mB, mb, mc, alpha_s, q, eq, ed, eu, eps_u, qiqj = get_input(par, B, V, scale)
# NB, the remaining prefactors are added below in the function T_perp
return eq * 2/mb * Cq34(q2, par, wc, B, V, scale)
Expand All @@ -84,11 +88,13 @@ def T_perp_WA_PowC_2(q2, par, wc, B, V, scale):

# chromomagnetic dipole contribution
def T_perp_plus_O8(q2, par, wc, B, V, u, scale):
flavio.citations.register("Beneke:2001at")
mB, mb, mc, alpha_s, q, eq, ed, eu, eps_u, qiqj = get_input(par, B, V, scale)
ubar = 1 - u
return - (alpha_s/(3*pi)) * 4*ed*wc['C8eff_'+qiqj]/(u + ubar*q2/mB**2)

def T_para_minus_O8(q2, par, wc, B, V, u, scale):
flavio.citations.register("Beneke:2001at")
mB, mb, mc, alpha_s, q, eq, ed, eu, eps_u, qiqj = get_input(par, B, V, scale)
ubar = 1 - u
return (alpha_s/(3*pi)) * eq * 8 * wc['C8eff_'+qiqj]/(ubar + u*q2/mB**2)
Expand Down Expand Up @@ -148,6 +154,7 @@ def En_V(mB, mV, q2):

# (27) of hep-ph/0106067v2
def t_perp(q2, u, mq, par, B, V):
flavio.citations.register("Beneke:2001at")
mB = par['m_'+B]
mV = par['m_'+V]
EV = En_V(mB, mV, q2)
Expand All @@ -162,6 +169,7 @@ def t_perp(q2, u, mq, par, B, V):

# (28) of hep-ph/0106067v2
def t_para(q2, u, mq, par, B, V):
flavio.citations.register("Beneke:2001at")
mB = par['m_'+B]
mV = par['m_'+V]
EV = En_V(mB, mV, q2)
Expand All @@ -177,6 +185,7 @@ def B0diffBFS(q2, u, mq, mB):

# (29) of hep-ph/0106067v2
def B0(s, mq):
flavio.citations.register("Beneke:2001at")
if s==0.:
return -2.
if 4*mq**2/s == 1.:
Expand All @@ -188,6 +197,7 @@ def B0(s, mq):

# (30), (31) of hep-ph/0106067v2
def i1_bfs(q2, u, mq, mB):
flavio.citations.register("Beneke:2001at")
ubar = 1 - u
iepsilon = 1e-8j
mq2 = mq**2 - iepsilon
Expand All @@ -201,6 +211,7 @@ def i1_bfs(q2, u, mq, mB):

# (32) of hep-ph/0106067v2
def L1(x):
flavio.citations.register("Beneke:2001at")
if x == 0.:
return -(pi**2/6.)
elif x == 1.:
Expand All @@ -219,12 +230,14 @@ def phiV(u, a1, a2):
# moments of the B meson light-cone distribution amplitude as in
# eq. (54) and surroundings of hep-ph/0106067v2
def lB_minus(q2, par, B):
flavio.citations.register("Beneke:2001at")
mB = par['m_'+B]
mb = running.get_mb_pole(par)
LambdaBar = mB - mb
w0 = 2*LambdaBar/3
return 1/(exp(-q2/mB/w0)/w0 * (-ei(q2/mB/w0) + 1j*pi))
def lB_plus(par, B):
flavio.citations.register("Beneke:2001at")
mB = par['m_'+B]
mb = running.get_mb_pole(par)
LambdaBar = mB - mb
Expand Down
2 changes: 2 additions & 0 deletions flavio/physics/bdecays/bxgamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def BRBXgamma(wc_obj, par, q, E0):
cutoff $E_0$ in GeV
(currently works only for `E0=1.6`).
See arXiv:1503.01789 and references therein."""
flavio.citations.register("Misiak:2015xwa")
scale = flavio.config['renormalization scale']['bxgamma']
alphaem = 1/137.035999139 # this is alpha_e(0), a constant for our purposes
bq = 'b' + q
Expand All @@ -55,6 +56,7 @@ def BRBXgamma(wc_obj, par, q, E0):
# central value of non-perturbative correction (M. Misiak, private communication)
P_nonpert = 0.00381745
# eq. (2.1) of hep-ph/0609241
flavio.citations.register("Misiak:2006ab")
return BRSL * abs(xi_t)**2/abs(Vcb)**2 * 6*alphaem/pi/C * (PE0 + P_nonpert + P_uncertainty)

def PE0_BR_BXgamma(wc, par, q, E0):
Expand Down
2 changes: 2 additions & 0 deletions flavio/physics/bdecays/bxll.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ def Phill_logqed(I, sh, mb, ml, alpha_s, alpha_e, wc, q, lep, mc):
# Note the different powers of ast (\tilde\alpha_s) and k (\kappa) due to
# the different normalisation of 1) C9 and C10 and 2) the overall
# normalisation of phi_ll
flavio.citations.register("Huber:2015sra")
e = np.zeros((11, 11), dtype=complex) # from 0 to 10
if I == 'T' or I == 'L' or I == 'BR':
e[7,7] = 8 * ast * k * sigmaij_I(I, 7, 7, sh)*wem(I, 7, 7, sh, mb, ml, scale, mc)
Expand Down Expand Up @@ -360,6 +361,7 @@ def f_u(alpha_e, alpha_s, alpha_s_mu0, mb, l1, l2):
# contribution to the branching ratio, as C9 and C10 are formally of
# O(\tilde \alpha_s \kappa). This is a numerically relevant choice (around
# 15% change of the low-q^2 BR).
flavio.citations.register("Huber:2015sra")
ast = alpha_s/4./pi
k = alpha_e/alpha_s
eta = alpha_s_mu0/alpha_s
Expand Down

0 comments on commit 3c7790d

Please sign in to comment.