From 21ba0b0d627a1930967ca8bdf2f692795703315f Mon Sep 17 00:00:00 2001 From: Peter Stangl Date: Fri, 19 Feb 2021 16:26:18 +0100 Subject: [PATCH] use multiprocessing.Array --- flavio/__init__.py | 2 +- flavio/citations.py | 110 +++++++----------- flavio/classes.py | 11 +- flavio/data/citations.yml | 42 +++++++ flavio/data/update_citations.py | 25 ++++ flavio/physics/bdecays/bllgamma.py | 24 ++-- flavio/physics/bdecays/bvll/observables_bs.py | 4 +- flavio/physics/bdecays/bvll/qcdf.py | 26 ++--- flavio/physics/bdecays/bxgamma.py | 4 +- flavio/physics/bdecays/bxll.py | 4 +- flavio/physics/bdecays/bxll_qed.py | 2 +- flavio/physics/bdecays/bxlnu.py | 2 +- .../bdecays/formfactors/b_gamma/bgamma.py | 2 +- flavio/physics/bdecays/formfactors/b_p/bcl.py | 4 +- flavio/physics/bdecays/formfactors/b_p/bsz.py | 2 +- flavio/physics/bdecays/formfactors/b_p/cln.py | 2 +- flavio/physics/bdecays/formfactors/b_v/bsz.py | 2 +- flavio/physics/bdecays/lambdablambdall.py | 2 +- flavio/physics/bdecays/matrixelements.py | 20 ++-- flavio/physics/bdecays/wilsoncoefficients.py | 4 +- flavio/physics/betadecays/common.py | 2 +- flavio/physics/betadecays/ft.py | 6 +- flavio/physics/ddecays/formfactors/bcl.py | 2 +- flavio/physics/ddecays/formfactors/bsz.py | 2 +- flavio/physics/higgs/decay.py | 18 +-- flavio/physics/higgs/production.py | 10 +- flavio/physics/kdecays/formfactors.py | 8 +- flavio/physics/kdecays/kll.py | 2 +- flavio/physics/kdecays/klnu.py | 2 +- flavio/physics/kdecays/kpinunu.py | 2 +- flavio/physics/kdecays/kpipi.py | 4 +- flavio/physics/kdecays/wilsoncoefficients.py | 6 +- flavio/physics/mesonmixing/amplitude.py | 2 +- .../physics/mesonmixing/wilsoncoefficient.py | 2 +- flavio/physics/mudecays/mueconversion.py | 2 +- flavio/physics/running/masses.py | 6 +- flavio/physics/taudecays/tau3l.py | 6 +- flavio/physics/taudecays/taulnunu.py | 2 +- flavio/physics/wdecays/mw.py | 4 +- flavio/physics/zdecays/gammazsm.py | 2 +- flavio/physics/zdecays/smeftew.py | 28 ++--- flavio/test_citations.py | 14 +-- flavio/util.py | 40 +++++++ 43 files changed, 275 insertions(+), 191 deletions(-) create mode 100644 flavio/data/citations.yml create mode 100755 flavio/data/update_citations.py create mode 100644 flavio/util.py diff --git a/flavio/__init__.py b/flavio/__init__.py index 47adc9c0..69fcf225 100644 --- a/flavio/__init__.py +++ b/flavio/__init__.py @@ -7,7 +7,7 @@ from . import classes from .classes import Measurement, Parameter, ParameterConstraints, Observable, NamedInstanceClass from .config import config -from .citations import Citations, default_citations, register_citation +from . import citations 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 diff --git a/flavio/citations.py b/flavio/citations.py index a1c3b76a..f87baf57 100644 --- a/flavio/citations.py +++ b/flavio/citations.py @@ -1,88 +1,68 @@ -"""Citation class for handling theory calculation citations""" -# citations.py is based on code from the PyBaMM project +# Inspired by pybamm.citations +# https://github.com/pybamm-team/PyBaMM -# Copyright (c) 2018-2020, the PyBaMM team. -# All rights reserved. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: +from multiprocessing import Array +import flavio +import sys +from itertools import compress +import ctypes +import yaml +import pkgutil -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. +class CitationScope: -# * Neither the name of the copyright holder nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. + def __enter__(self): + self._citations_global = flavio.citations + flavio.citations = Citations() + return flavio.citations -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import flavio + def __exit__(self, type, value, traceback): + flavio.citations = self._citations_global class Citations: - """Entry point to citations management. - This object may be used to register a citation is relevant for a particular - implementation. It can then also then print out a list of papers to be cited. - - Examples - -------- - >>> import flavio - >>> flavio.sm_prediction("DeltaM_s") - >>> print(flavio.default_citations) - """ - - def __init__(self): - self._reset() + 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._papers_to_cite: + for citation in self.set: yield citation def __str__(self): - return ",".join(self._papers_to_cite) - - def _reset(self): - "Reset citations to empty" - self._papers_to_cite = set() + return ",".join(self.set) @property - def tostring(self): - return str(self) + def set(self): + return set(compress(sorted(self._all_citations.keys()), self._array)) @property - def toset(self): - return self._papers_to_cite - - def register(self, key): - """Register a paper to be cited. The intended use is that this method - should be called only when the referenced functionality is actually being used. + def string(self): + return str(self) - Parameters - ---------- - key : str - The INSPIRE texkey for the paper to be cited - """ - self._papers_to_cite.add(key) + 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) -default_citations = Citations() -# Register the flavio paper -default_citations.register("Straub:2018kue") -def register_citation(inspire_key): - flavio.default_citations.register(inspire_key) +sys.modules[__name__] = Citations(["Straub:2018kue"]) diff --git a/flavio/classes.py b/flavio/classes.py index f01e8794..f2632f03 100644 --- a/flavio/classes.py +++ b/flavio/classes.py @@ -700,16 +700,13 @@ def get_measurements(self): 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). """ - old_citations = flavio.default_citations - flavio.default_citations = flavio.Citations() - flavio.sm_prediction(self.name, *args, **kwargs) - SM_citations = flavio.default_citations.toset - flavio.default_citations = old_citations - return SM_citations + with flavio.citations.collect() as citations: + flavio.sm_prediction(self.name, *args, **kwargs) + return citations.set diff --git a/flavio/data/citations.yml b/flavio/data/citations.yml new file mode 100644 index 00000000..7ee24d62 --- /dev/null +++ b/flavio/data/citations.yml @@ -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 diff --git a/flavio/data/update_citations.py b/flavio/data/update_citations.py new file mode 100755 index 00000000..d77b5796 --- /dev/null +++ b/flavio/data/update_citations.py @@ -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) diff --git a/flavio/physics/bdecays/bllgamma.py b/flavio/physics/bdecays/bllgamma.py index 72656800..c21f9f2a 100644 --- a/flavio/physics/bdecays/bllgamma.py +++ b/flavio/physics/bdecays/bllgamma.py @@ -52,7 +52,7 @@ def getfft(s, par, B, ff, ff0, lep, wc): #Add light meson resonances resonances = {'Bs': ['phi'], 'B0': ['rho0', 'omega']} - flavio.register_citation("Kozachuk:2017mdk") + 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'], @@ -67,7 +67,7 @@ def getfft(s, par, B, ff, ff0, lep, wc): return (fftv, ffta) def getF1(s, par, B, ff, ff0, lep, wc): - flavio.register_citation("Melikhov:2004mk") + flavio.citations.register("Melikhov:2004mk") scale = config['renormalization scale']['bllgamma'] mb = running.get_mb(par, scale, nf_out=5) mbh = mb/par['m_'+B] @@ -77,7 +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.register_citation("Melikhov:2004mk") + flavio.citations.register("Melikhov:2004mk") scale = config['renormalization scale']['bllgamma'] mb = running.get_mb(par, scale, nf_out=5) mbh = mb/par['m_'+B] @@ -88,8 +88,8 @@ def getF2(s, par, B, ff, ff0, lep, wc): def B10(s, par, B, ff, ff0, lep, wc): - flavio.register_citation("Melikhov:2004mk") - flavio.register_citation("Guadagnoli:2016erb") + 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] @@ -99,15 +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.register_citation("Melikhov:2004mk") - flavio.register_citation("Guadagnoli:2016erb") + 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.register_citation("Melikhov:2004mk") - flavio.register_citation("Guadagnoli:2016erb") + 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] @@ -119,13 +119,13 @@ def B120(s, par, B, ff, ff0, lep, wc): def dG1dsMN(s, par, B, ff, ff0, lep, wc): - flavio.register_citation("Melikhov:2004mk") + 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.register_citation("Melikhov:2004mk") + flavio.citations.register("Melikhov:2004mk") mlh = par['m_'+lep]/par['m_'+B] bq = meson_quark[B] label = bq+lep+lep @@ -133,7 +133,7 @@ def dG2dsMN(s, par, B, ff, ff0, lep, wc): 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.register_citation("Melikhov:2004mk") + 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) diff --git a/flavio/physics/bdecays/bvll/observables_bs.py b/flavio/physics/bdecays/bvll/observables_bs.py index be482fe3..6a709613 100644 --- a/flavio/physics/bdecays/bvll/observables_bs.py +++ b/flavio/physics/bdecays/bvll/observables_bs.py @@ -34,7 +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.register_citation("Descotes-Genon:2015hea") + 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): @@ -52,7 +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.register_citation("Descotes-Genon:2015hea") + 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. diff --git a/flavio/physics/bdecays/bvll/qcdf.py b/flavio/physics/bdecays/bvll/qcdf.py index 280ee99f..eb7539f3 100644 --- a/flavio/physics/bdecays/bvll/qcdf.py +++ b/flavio/physics/bdecays/bvll/qcdf.py @@ -37,8 +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.register_citation("Beneke:2001at") - flavio.register_citation("Beneke:2004dp") + 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]) @@ -70,13 +70,13 @@ def T_para_minus_WA(q2, par, wc, B, V, scale): # (51) of hep-ph/0412400 def T_perp_WA_PowC_1(q2, par, wc, B, V, scale): - flavio.register_citation("Beneke:2004dp") + 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.register_citation("Beneke:2004dp") + 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) @@ -88,13 +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.register_citation("Beneke:2001at") + 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.register_citation("Beneke:2001at") + 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) @@ -154,7 +154,7 @@ def En_V(mB, mV, q2): # (27) of hep-ph/0106067v2 def t_perp(q2, u, mq, par, B, V): - flavio.register_citation("Beneke:2001at") + flavio.citations.register("Beneke:2001at") mB = par['m_'+B] mV = par['m_'+V] EV = En_V(mB, mV, q2) @@ -169,7 +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.register_citation("Beneke:2001at") + flavio.citations.register("Beneke:2001at") mB = par['m_'+B] mV = par['m_'+V] EV = En_V(mB, mV, q2) @@ -185,7 +185,7 @@ def B0diffBFS(q2, u, mq, mB): # (29) of hep-ph/0106067v2 def B0(s, mq): - flavio.register_citation("Beneke:2001at") + flavio.citations.register("Beneke:2001at") if s==0.: return -2. if 4*mq**2/s == 1.: @@ -197,7 +197,7 @@ def B0(s, mq): # (30), (31) of hep-ph/0106067v2 def i1_bfs(q2, u, mq, mB): - flavio.register_citation("Beneke:2001at") + flavio.citations.register("Beneke:2001at") ubar = 1 - u iepsilon = 1e-8j mq2 = mq**2 - iepsilon @@ -211,7 +211,7 @@ def i1_bfs(q2, u, mq, mB): # (32) of hep-ph/0106067v2 def L1(x): - flavio.register_citation("Beneke:2001at") + flavio.citations.register("Beneke:2001at") if x == 0.: return -(pi**2/6.) elif x == 1.: @@ -230,14 +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.register_citation("Beneke:2001at") + 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.register_citation("Beneke:2001at") + flavio.citations.register("Beneke:2001at") mB = par['m_'+B] mb = running.get_mb_pole(par) LambdaBar = mB - mb diff --git a/flavio/physics/bdecays/bxgamma.py b/flavio/physics/bdecays/bxgamma.py index 73a749a1..f11bb2b3 100644 --- a/flavio/physics/bdecays/bxgamma.py +++ b/flavio/physics/bdecays/bxgamma.py @@ -40,7 +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.register_citation("Misiak:2015xwa") + 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 @@ -56,7 +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.register_citation("Misiak:2006ab") + 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): diff --git a/flavio/physics/bdecays/bxll.py b/flavio/physics/bdecays/bxll.py index 1cedb9b6..7de7a427 100644 --- a/flavio/physics/bdecays/bxll.py +++ b/flavio/physics/bdecays/bxll.py @@ -287,7 +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.register_citation("Huber:2015sra") + 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) @@ -361,7 +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.register_citation("Huber:2015sra") + flavio.citations.register("Huber:2015sra") ast = alpha_s/4./pi k = alpha_e/alpha_s eta = alpha_s_mu0/alpha_s diff --git a/flavio/physics/bdecays/bxll_qed.py b/flavio/physics/bdecays/bxll_qed.py index afb10741..f2acb859 100644 --- a/flavio/physics/bdecays/bxll_qed.py +++ b/flavio/physics/bdecays/bxll_qed.py @@ -368,7 +368,7 @@ def wem_79_low(sh, mb, ml, scale, mc): wem_dict_high['BR', 9, 9] = wem_99_high def wem(I, i, j, sh, mb, ml, scale, mc): - flavio.register_citation("Huber:2015sra") + flavio.citations.register("Huber:2015sra") if sh < 0.5: return wem_dict_low[I, i, j](sh, mb, ml, scale, mc) else: diff --git a/flavio/physics/bdecays/bxlnu.py b/flavio/physics/bdecays/bxlnu.py index ff2e9972..963b10ca 100644 --- a/flavio/physics/bdecays/bxlnu.py +++ b/flavio/physics/bdecays/bxlnu.py @@ -50,7 +50,7 @@ def _BR_BXclnu(par, wc_obj, lep, nu): + 12*gVS(xc, xl) * (wc['VR']*wc['T']).real ) # eq. (26) of arXiv:1107.3100 + corrections (P. Gambino, private communication) - flavio.register_citation("Gambino:2011cq") + flavio.citations.register("Gambino:2011cq") r_BLO = ( 1 # NLO QCD + alpha_s/pi * pc1(xc, mb) diff --git a/flavio/physics/bdecays/formfactors/b_gamma/bgamma.py b/flavio/physics/bdecays/formfactors/b_gamma/bgamma.py index a2e795e7..7e63346d 100644 --- a/flavio/physics/bdecays/formfactors/b_gamma/bgamma.py +++ b/flavio/physics/bdecays/formfactors/b_gamma/bgamma.py @@ -8,7 +8,7 @@ def ff(q2, par, B): See hep-ph/0208256.pdf. """ - flavio.register_citation("Kruger:2002gf") + flavio.citations.register("Kruger:2002gf") fB = par['f_'+B] mB = par['m_'+B] name = 'B->gamma KM ' diff --git a/flavio/physics/bdecays/formfactors/b_p/bcl.py b/flavio/physics/bdecays/formfactors/b_p/bcl.py index 802807cd..a7dfa4d9 100644 --- a/flavio/physics/bdecays/formfactors/b_p/bcl.py +++ b/flavio/physics/bdecays/formfactors/b_p/bcl.py @@ -36,7 +36,7 @@ def ff(process, q2, par, n=3, t0=None): The standard convention defines the form factors $f_+$, $f_0$, and $f_T$. """ - flavio.register_citation("Bourrely:2008za") + flavio.citations.register("Bourrely:2008za") pd = process_dict[process] mpl = par[process + ' BCL m+'] m0 = par[process + ' BCL m0'] @@ -64,7 +64,7 @@ def ff_isgurwise(process, q2, par, scale, n=3, t0=None): and BCL parametrization (arXiv:0807.2722) for $f_0$ and $f_+$, but using an improved Isgur-Wise relation in the heavy quark limit for $f_T$. """ - flavio.register_citation("Bourrely:2008za") + flavio.citations.register("Bourrely:2008za") pd = process_dict[process] mpl = par[process + ' BCL m+'] m0 = par[process + ' BCL m0'] diff --git a/flavio/physics/bdecays/formfactors/b_p/bsz.py b/flavio/physics/bdecays/formfactors/b_p/bsz.py index 23c334f7..9d4f45cd 100644 --- a/flavio/physics/bdecays/formfactors/b_p/bsz.py +++ b/flavio/physics/bdecays/formfactors/b_p/bsz.py @@ -34,7 +34,7 @@ def ff(process, q2, par, n=3, t0=None): The standard convention defines the form factors $f_+$, $f_0$, and $f_T$. """ - flavio.register_citation("Gubernari:2018wyi") + flavio.citations.register("Gubernari:2018wyi") pd = process_dict[process] mpl = par[process + ' BCL m+'] m0 = par[process + ' BCL m0'] diff --git a/flavio/physics/bdecays/formfactors/b_p/cln.py b/flavio/physics/bdecays/formfactors/b_p/cln.py index 39c95714..873ca83d 100644 --- a/flavio/physics/bdecays/formfactors/b_p/cln.py +++ b/flavio/physics/bdecays/formfactors/b_p/cln.py @@ -26,7 +26,7 @@ def ff(process, q2, par, scale, order_z=3, order_z_slp=2, order_z_sslp=1): See arXiv:hep-ph/9712417 and arXiv:1703.05330. """ - flavio.register_citation("Caprini:1997mu") + flavio.citations.register("Caprini:1997mu") pd = process_dict[process] mB = par['m_' + pd['B']] mP = par['m_' + pd['P']] diff --git a/flavio/physics/bdecays/formfactors/b_v/bsz.py b/flavio/physics/bdecays/formfactors/b_v/bsz.py index b39c75a1..db3b30d1 100644 --- a/flavio/physics/bdecays/formfactors/b_v/bsz.py +++ b/flavio/physics/bdecays/formfactors/b_v/bsz.py @@ -48,7 +48,7 @@ def ff(process, q2, par, n=2, omit_A='A0'): ff = {} # setting a0_A0 and a0_T2 according to the exact kinematical relations, # cf. eq. (16) of arXiv:1503.05534 - flavio.register_citation("Straub:2015ica") + flavio.citations.register("Straub:2015ica") par_prefix = process + ' BSZ' par[par_prefix + ' a0_A12'] = par[par_prefix + ' a0_A0'] / (8*mB*mV / (mB**2-mV**2)) par[par_prefix + ' a0_T2'] = par[par_prefix + ' a0_T1'] diff --git a/flavio/physics/bdecays/lambdablambdall.py b/flavio/physics/bdecays/lambdablambdall.py index 9d791226..519dec30 100644 --- a/flavio/physics/bdecays/lambdablambdall.py +++ b/flavio/physics/bdecays/lambdablambdall.py @@ -65,7 +65,7 @@ def angular_coefficients(ta, alpha): transversity amplitudes and decay parameter $\alpha$. See (3.29)-(3.32) of arXiv:1410.2115.""" - flavio.register_citation("Boer:2014kda") + flavio.citations.register("Boer:2014kda") K = {} K['1ss'] = 1/4.*( abs(ta['perp1', 'R'])**2 + abs(ta['perp1', 'L'])**2 + abs(ta['para1', 'R'])**2 + abs(ta['para1', 'L'])**2 diff --git a/flavio/physics/bdecays/matrixelements.py b/flavio/physics/bdecays/matrixelements.py index 9fa2dfde..350df0a7 100644 --- a/flavio/physics/bdecays/matrixelements.py +++ b/flavio/physics/bdecays/matrixelements.py @@ -46,7 +46,7 @@ def Y(q2, wc, par, scale, qiqj): # eq. (43) of hep-ph/0412400v1 def Yu(q2, wc, par, scale, qiqj): - flavio.register_citation("Beneke:2004dp") + flavio.citations.register("Beneke:2004dp") mc = running.get_mc_pole(par) return ( (4/3.*wc['C1_'+qiqj] + wc['C2_'+qiqj]) * ( h(s=q2, mq=mc, mu=scale) - h(s=q2, mq=0, mu=scale) )) @@ -78,7 +78,7 @@ def F_17(muh, z, sh): - `z` is $z=m_c^2/m_b^2$, - `sh` is $\hat s=q^2/m_b^2$. """ - flavio.register_citation("Greub:2008cy") + flavio.citations.register("Greub:2008cy") return _F_17([muh, z, sh])[0] @lru_cache(maxsize=config['settings']['cache size']) @@ -90,7 +90,7 @@ def F_19(muh, z, sh): - `z` is $z=m_c^2/m_b^2$, - `sh` is $\hat s=q^2/m_b^2$. """ - flavio.register_citation("Greub:2008cy") + flavio.citations.register("Greub:2008cy") if sh == 0: return 0 return _sh_F_19([muh, z, sh])[0] / sh @@ -104,7 +104,7 @@ def F_27(muh, z, sh): - `z` is $z=m_c^2/m_b^2$, - `sh` is $\hat s=q^2/m_b^2$. """ - flavio.register_citation("Greub:2008cy") + flavio.citations.register("Greub:2008cy") return _F_27([muh, z, sh])[0] @lru_cache(maxsize=config['settings']['cache size']) @@ -116,7 +116,7 @@ def F_29(muh, z, sh): - `z` is $z=m_c^2/m_b^2$, - `sh` is $\hat s=q^2/m_b^2$. """ - flavio.register_citation("Greub:2008cy") + flavio.citations.register("Greub:2008cy") if sh == 0: return 0 return _sh_F_29([muh, z, sh])[0] / sh @@ -129,7 +129,7 @@ def F_89(Ls, sh): - `sh` is $\hat s=q^2/m_b^2$, - `Ls` is $\ln(\hat s)$. """ - flavio.register_citation("Asatrian:2003vq") + flavio.citations.register("Asatrian:2003vq") return (104/9. - 32/27. * pi**2 + (1184/27. - 40/9. * pi**2) * sh + (14212/135. - 32/3 * pi**2) * sh**2 + (193444/945. - 560/27. * pi**2) * sh**3 + 16/9. * Ls * (1 + sh + sh**2 + sh**3)) @@ -140,7 +140,7 @@ def F_87(Lmu, sh): - `sh` is $\hat s=q^2/m_b^2$, """ - flavio.register_citation("Asatrian:2003vq") + flavio.citations.register("Asatrian:2003vq") if sh==0.: return (-4*(33 + 24*Lmu + 6j*pi - 2*pi**2))/27. return (-32/9. * Lmu + 8/27. * pi**2 - 44/9. - 8/9. * 1j * pi @@ -159,7 +159,7 @@ def acot(x): def SeidelA(q2, mb, mu): """Function $A(s\equiv q^2)$ defined in eq. (29) of hep-ph/0403185v2. """ - flavio.register_citation("Seidel:2004jh") + flavio.citations.register("Seidel:2004jh") if q2==0: return 1/729. * (833 + 120j*pi - 312 * log(mb**2/mu**2)) sh = min(q2/mb**2, 0.999) @@ -177,7 +177,7 @@ def SeidelA(q2, mb, mu): def SeidelB(q2, mb, mu): """Function $A(s\equiv q^2)$ defined in eq. (30) of hep-ph/0403185v2. """ - flavio.register_citation("Seidel:2004jh") + flavio.citations.register("Seidel:2004jh") sh = min(q2/mb**2, 0.999) z = 4 / sh x1 = 1/2 + 1j/2 * sqrt(z - 1) @@ -205,7 +205,7 @@ def SeidelB(q2, mb, mu): def SeidelC(q2, mb, mu): """Function $A(s\equiv q^2)$ defined in eq. (31) of hep-ph/0403185v2. """ - flavio.register_citation("Seidel:2004jh") + flavio.citations.register("Seidel:2004jh") return (-(16)/(81) * log((q2)/(mu**2)) + (428)/(243) - (64)/(27) * zeta(3) + (16)/(81) * pi * 1j) diff --git a/flavio/physics/bdecays/wilsoncoefficients.py b/flavio/physics/bdecays/wilsoncoefficients.py index 38c1f307..4a3515fc 100644 --- a/flavio/physics/bdecays/wilsoncoefficients.py +++ b/flavio/physics/bdecays/wilsoncoefficients.py @@ -42,7 +42,7 @@ def CL_SM(par): Xt0 = Xt0_165 * (1 + 1.14064 * (mt/165. - 1)) # LO Xt1 = Xt0_165 * (-0.031435 - 0.139303 * (mt/165. - 1)) # QCD NLO # (4.3), (4.4) of 1009.0947: NLO EW - flavio.register_citation("Brod:2010hi") + flavio.citations.register("Brod:2010hi") XtEW = Xt0 * (1 - 1.11508 + 1.12316*1.15338**(mt/165.)-0.179454*(mt/165)) - 1 XtEW = XtEW * 0.00062392534457616328 # <- alpha_em/4pi at 120 GeV Xt = Xt0 + Xt1 + XtEW @@ -81,7 +81,7 @@ def wctot_dict(wc_obj, sector, scale, par, nf_out=5): else: raise NotImplementedError("DeltaF=1 Wilson coefficients only implemented for B physics") # fold in approximate m_t-dependence of C_10 (see eq. 4 of arXiv:1311.0903) - flavio.register_citation("Bobeth:2013uxa") + flavio.citations.register("Bobeth:2013uxa") wc_sm[9] = wc_sm[9] * (par['m_t']/173.1)**1.53 # go from the effective to the "non-effective" WCs for C7 and C8 yi = np.array([0, 0, -1/3., -4/9., -20/3., -80/9.]) diff --git a/flavio/physics/betadecays/common.py b/flavio/physics/betadecays/common.py index 23a3d94f..e96b5495 100644 --- a/flavio/physics/betadecays/common.py +++ b/flavio/physics/betadecays/common.py @@ -10,7 +10,7 @@ def wc_eff(par, wc_obj, scale, nu): r"""Lee-Yang effective couplings. See eqS. (2), (9) of arXiv:1803.08732.""" - flavio.register_citation("Gonzalez-Alonso:2018omy") + flavio.citations.register("Gonzalez-Alonso:2018omy") # wilson coefficients wc = get_wceff_fccc_std(wc_obj, par, 'du', 'e', nu, None, scale, nf=3) # proton charges diff --git a/flavio/physics/betadecays/ft.py b/flavio/physics/betadecays/ft.py index eeed8650..c0585aa1 100644 --- a/flavio/physics/betadecays/ft.py +++ b/flavio/physics/betadecays/ft.py @@ -18,7 +18,7 @@ def xi(C, MF, MGT): `MGT`.""" # eq. (15) of arXiv:1803.08732 # note that C_i' = C_i - flavio.register_citation("Gonzalez-Alonso:2018omy") + flavio.citations.register("Gonzalez-Alonso:2018omy") return 2 * (abs(MF)**2 * (abs(C['V'])**2 + abs(C['S'])**2) + abs(MGT)**2 * (abs(C['A'])**2 + abs(C['T'])**2)) @@ -29,7 +29,7 @@ def a_xi(C, MF, MGT): `MGT`.""" # eq. (16) of arXiv:1803.08732 # note that C_i' = C_i - flavio.register_citation("Gonzalez-Alonso:2018omy") + flavio.citations.register("Gonzalez-Alonso:2018omy") return 2 * (abs(MF)**2 * (abs(C['V'])**2 - abs(C['S'])**2) - 1 / 3 * abs(MGT)**2 * (abs(C['A'])**2 - abs(C['T'])**2)) @@ -47,7 +47,7 @@ def b_xi(C, MF, MGT, alpha, Z, s): `MGT`, the fine structure constant `alpha`, and the nucleon charge `Z`. The sign `s` is + for the electron and - for the positron.""" # eq. (17) of arXiv:1803.08732 # note that C_i' = C_i - flavio.register_citation("Gonzalez-Alonso:2018omy") + flavio.citations.register("Gonzalez-Alonso:2018omy") gamma = sqrt(1 - alpha**2 * Z**2) return s * 2 * gamma * 2 * (abs(MF)**2 * (C['V'] * C['S'].conjugate()).real + abs(MGT)**2 * (C['A'] * C['T'].conjugate()).real) diff --git a/flavio/physics/ddecays/formfactors/bcl.py b/flavio/physics/ddecays/formfactors/bcl.py index 631b61d1..1bd93cdf 100644 --- a/flavio/physics/ddecays/formfactors/bcl.py +++ b/flavio/physics/ddecays/formfactors/bcl.py @@ -22,7 +22,7 @@ def ff(process, q2, par, n=3, t0=None): The standard convention defines the form factors $f_+$, $f_0$, and $f_T$. """ - flavio.register_citation("Bourrely:2008za") + flavio.citations.register("Bourrely:2008za") pd = process_dict[process] mpl = par[process + ' BCL m+'] m0 = par[process + ' BCL m0'] diff --git a/flavio/physics/ddecays/formfactors/bsz.py b/flavio/physics/ddecays/formfactors/bsz.py index 9e5fa815..588f457c 100644 --- a/flavio/physics/ddecays/formfactors/bsz.py +++ b/flavio/physics/ddecays/formfactors/bsz.py @@ -15,7 +15,7 @@ def ff(process, q2, par, n=3, t0=None): The standard convention defines the form factors $f_+$, $f_0$, and $f_T$. """ - flavio.register_citation("Gubernari:2018wyi") + flavio.citations.register("Gubernari:2018wyi") pd = process_dict[process] mpl = par[process + ' BCL m+'] m0 = par[process + ' BCL m0'] diff --git a/flavio/physics/higgs/decay.py b/flavio/physics/higgs/decay.py index d585d917..30227a23 100644 --- a/flavio/physics/higgs/decay.py +++ b/flavio/physics/higgs/decay.py @@ -10,7 +10,7 @@ def h_gg(C): r"""Higgs decay to two gluons normalized to the SM""" # obtained from an analytical one-loop calculation - flavio.register_citation("Falkowski:2019hvp") + flavio.citations.register("Falkowski:2019hvp") np = (+39.29 * C['phiG'] +0.121 * (C['phiBox'] - C['phiD'] / 4.) +0.061 * (C['ll_1221'] / 2 - C['phil3_22'] - C['phil3_11']) @@ -24,7 +24,7 @@ def h_gg(C): def h_gaga(C): r"""Higgs decay to two photons normalized to the SM""" # obtained from an analytical one-loop calculation - flavio.register_citation("Falkowski:2019hvp") + flavio.citations.register("Falkowski:2019hvp") np = (-45.78 * C['phiB'] -13.75 * C['phiW'] +(25.09 - 0.242) * C['phiWB'] # tree - loop @@ -41,7 +41,7 @@ def h_gaga(C): def h_ww(C): r"""Higgs decay to two $W$ bosons normalized to the SM""" - flavio.register_citation("Falkowski:2019hvp") + flavio.citations.register("Falkowski:2019hvp") np = (-0.092 * C['phiW'] -0.386 * C['phiWB'] -0.205 * C['phiD'] @@ -54,7 +54,7 @@ def h_ww(C): def h_zz(C): r"""Higgs decay to $Z$ bosons normalized to the SM""" - flavio.register_citation("Falkowski:2019hvp") + flavio.citations.register("Falkowski:2019hvp") np = (+0.329 * C['phiB'] -0.386 * C['phiW'] +0.149 * C['phiWB'] @@ -74,7 +74,7 @@ def h_vv(C): def h_zga(C): r"""Higgs decay to $Z\gamma$ normalized to the SM""" - flavio.register_citation("Falkowski:2019hvp") + flavio.citations.register("Falkowski:2019hvp") np = (+14.89 * C['phiB'] -14.89 * C['phiW'] +9.377 * C['phiWB'] @@ -83,7 +83,7 @@ def h_zga(C): def h_bb(C): r"""Higgs decay to two $b$ quarks normalized to the SM""" - flavio.register_citation("Falkowski:2019hvp") + flavio.citations.register("Falkowski:2019hvp") np = (-0.03 * C['phiD'] +0.121 * C['phiBox'] +0.061 * (C['ll_1221'] / 2 - C['phil3_22'] - C['phil3_11']) @@ -92,7 +92,7 @@ def h_bb(C): def h_cc(C): r"""Higgs decay to two charm quarks normalized to the SM""" - flavio.register_citation("Falkowski:2019hvp") + flavio.citations.register("Falkowski:2019hvp") np = (-0.03 * C['phiD'] +0.121 * C['phiBox'] +0.061 * (C['ll_1221'] / 2 - C['phil3_22'] - C['phil3_11']) @@ -101,7 +101,7 @@ def h_cc(C): def h_tautau(C): r"""Higgs decay to two taus normalized to the SM""" - flavio.register_citation("Falkowski:2019hvp") + flavio.citations.register("Falkowski:2019hvp") np = (-0.03 * C['phiD'] +0.121 * C['phiBox'] +0.061 * (C['ll_1221'] / 2 - C['phil3_22'] - C['phil3_11']) @@ -110,7 +110,7 @@ def h_tautau(C): def h_mumu(C): r"""Higgs decay to two muons normalized to the SM""" - flavio.register_citation("Falkowski:2019hvp") + flavio.citations.register("Falkowski:2019hvp") np = (-0.03 * C['phiD'] +0.121 * C['phiBox'] +0.061 * (C['ll_1221'] / 2 - C['phil3_22'] - C['phil3_11']) diff --git a/flavio/physics/higgs/production.py b/flavio/physics/higgs/production.py index 95bd8950..0ebadbdd 100644 --- a/flavio/physics/higgs/production.py +++ b/flavio/physics/higgs/production.py @@ -9,7 +9,7 @@ def ggF(C): r"""Higgs production from gluon fusion normalized to the SM""" # obtained from an analytical one-loop calculation - flavio.register_citation("Falkowski:2019hvp") + flavio.citations.register("Falkowski:2019hvp") np = (+35.86 * C['phiG'] +0.121 * (C['phiBox'] - C['phiD'] / 4.) +0.061 * (C['ll_1221'] / 2 - C['phil3_22'] - C['phil3_11']) @@ -22,7 +22,7 @@ def ggF(C): def hw(C): r"""Higgs production associated with a $W$ normalized to the SM""" - flavio.register_citation("Falkowski:2019hvp") + flavio.citations.register("Falkowski:2019hvp") np = (+0.891 * C['phiW'] -0.187 * C['phiWB'] -0.115 * C['phiD'] @@ -35,7 +35,7 @@ def hw(C): def hz(C): r"""Higgs production associated with a $Z$ normalized to the SM""" - flavio.register_citation("Falkowski:2019hvp") + flavio.citations.register("Falkowski:2019hvp") np = (+0.098 * C['phiB'] +0.721 * C['phiW'] +0.217 * C['phiWB'] @@ -65,7 +65,7 @@ def hv(C): def tth(C): r"""Higgs production associated with a top pair normalized to the SM""" - flavio.register_citation("Falkowski:2019hvp") + flavio.citations.register("Falkowski:2019hvp") np = (-0.030 * C['phiD'] +0.118 * C['phiBox'] -0.853 * C['uG_33'] @@ -77,7 +77,7 @@ def tth(C): def vv_h(C): r"""Higgs production from vector boson fusion normalized to the SM""" - flavio.register_citation("Falkowski:2019hvp") + flavio.citations.register("Falkowski:2019hvp") np = (-0.002 * C['phiB'] -0.088 * C['phiW'] -0.319 * C['phiWB'] diff --git a/flavio/physics/kdecays/formfactors.py b/flavio/physics/kdecays/formfactors.py index 493870ad..8e201e6b 100644 --- a/flavio/physics/kdecays/formfactors.py +++ b/flavio/physics/kdecays/formfactors.py @@ -20,17 +20,17 @@ def fp0_dispersive(q2, par): H1 = par['K->pi H1'] H2 = par['K->pi H2'] # (A.1) of 0903.1654 - flavio.register_citation("Bernard:2009zm") + flavio.citations.register("Bernard:2009zm") x = q2/t0 G = x*D + (1-x)*d + x*(1-x)*k # (A.3) of 0903.1654 - flavio.register_citation("Bernard:2009zm") + flavio.citations.register("Bernard:2009zm") H = H1*x + H2*x**2 # (33) of 1005.2323 - flavio.register_citation("Antonelli:2010yf") + flavio.citations.register("Antonelli:2010yf") f0_bar = exp(q2/DeltaKpi * (lnC - G)) # (37) of 1005.2323 - flavio.register_citation("Antonelli:2010yf") + flavio.citations.register("Antonelli:2010yf") fp_bar = exp(q2/mpi**2 * (Lp + H)) ff = {} ff['f+'] = fp_0 * fp_bar diff --git a/flavio/physics/kdecays/kll.py b/flavio/physics/kdecays/kll.py index 22f165fb..a2b0b045 100644 --- a/flavio/physics/kdecays/kll.py +++ b/flavio/physics/kdecays/kll.py @@ -44,7 +44,7 @@ def amplitudes_LD(par, K, l): s2w = par['s2w'] pre = 2 * ml / mK / s2w # numbers extracted from arXiv:1711.11030 - flavio.register_citation("Chobanova:2017rkj") + flavio.citations.register("Chobanova:2017rkj") ASgaga = 2.49e-4 * (-2.821 + 1.216j) ALgaga = 2.02e-4 * (par['chi_disp(KL->gammagamma)'] - 5.21j) S = pre * ASgaga diff --git a/flavio/physics/kdecays/klnu.py b/flavio/physics/kdecays/klnu.py index b207ae7f..c3f4bf4c 100644 --- a/flavio/physics/kdecays/klnu.py +++ b/flavio/physics/kdecays/klnu.py @@ -39,7 +39,7 @@ def _br_plnu(wc_obj, par, P, lep, nu): def r_plnu(wc_obj, par, P): # resumming logs according to (111) of 0707.4464 # (this is negligibly small for the individual rates) - flavio.register_citation("Cirigliano:2007ga") + flavio.citations.register("Cirigliano:2007ga") rg_corr = 1.00055 return rg_corr*br_plnu(wc_obj, par, P, 'e')/br_plnu(wc_obj, par, P, 'mu') diff --git a/flavio/physics/kdecays/kpinunu.py b/flavio/physics/kdecays/kpinunu.py index 61e51231..3d9338bc 100644 --- a/flavio/physics/kdecays/kpinunu.py +++ b/flavio/physics/kdecays/kpinunu.py @@ -32,7 +32,7 @@ def kpinunu_charm(par): mc = par['m_c'] alpha_s = par['alpha_s'] # approximate formula for NNLO perturbative result: (14) of hep-ph/0603079 - flavio.register_citation("Buras:2006gb") + flavio.citations.register("Buras:2006gb") return 0.379 * (mc/1.3)**2.155 * (alpha_s/0.1187)**(-1.417) def br_kplus_pinunu(wc_obj, par, nu1, nu2): diff --git a/flavio/physics/kdecays/kpipi.py b/flavio/physics/kdecays/kpipi.py index c64d264d..97b97be3 100644 --- a/flavio/physics/kdecays/kpipi.py +++ b/flavio/physics/kdecays/kpipi.py @@ -150,7 +150,7 @@ def epsprime_SM(par): ReA0 = par['ReA0(K->pipi)'] ReA2 = par['ReA2(K->pipi)'] # eq. (19) of arXiv:1507.06345 - flavio.register_citation("Buras:2015yba") + flavio.citations.register("Buras:2015yba") return (-par['omega+'] / (sqrt(2) * par['eps_K']) * (ImA0 / ReA0 * (1 - par['Omegahat_eff']) - 1 / a * ImA2 / ReA2).real) @@ -166,7 +166,7 @@ def epsprime_NP(wc_obj, par): ReA2 = par['ReA2(K->pipi)'] a = par['epsp a'] # eq. (16) # dividing by a to remove the isospin brk corr in omega+, cf. (16) in 1507.06345 - flavio.register_citation("Buras:2015yba") + flavio.citations.register("Buras:2015yba") return (-par['omega+'] / a / (sqrt(2) * par['eps_K']) * (ImA0 / ReA0 - ImA2 / ReA2).real) diff --git a/flavio/physics/kdecays/wilsoncoefficients.py b/flavio/physics/kdecays/wilsoncoefficients.py index 60273c2f..16ceed3c 100644 --- a/flavio/physics/kdecays/wilsoncoefficients.py +++ b/flavio/physics/kdecays/wilsoncoefficients.py @@ -29,7 +29,7 @@ def wilsoncoefficients_sm_fourquark(par, scale): Currently only implemented for `scale=1.3`.""" if scale != 1.3: raise ValueError("Wilson coefficients only implemented for scale=1.3") - flavio.register_citation("Buras:2015yba") + flavio.citations.register("Buras:2015yba") wcarr = wcsm(par['alpha_s']) wc_dict = dict(zip(["z1", "z2", "y3", "y4", "y5", "y6", "y7/al", "y8/al", "y9/al", "y10/al",], wcarr)) @@ -45,10 +45,10 @@ def wilsoncoefficients_sm_sl(par, scale): Currently only $C_{10}$ (top and charm contributions) is implemented.""" wc_dict = {} # fold in approximate m_t-dependence of C_10 (see eq. 4 of arXiv:1311.0903) - flavio.register_citation("Bobeth:2013uxa") + flavio.citations.register("Bobeth:2013uxa") wc_dict['C10_t'] = -4.10 * (par['m_t']/173.1)**1.53 Vus = abs(ckm.get_ckm(par)[0, 1]) Pc = 0.115 # +-0.011, arXiv:hep-ph/0605203 - flavio.register_citation("Gorbahn:2006bm") + flavio.citations.register("Gorbahn:2006bm") wc_dict['C10_c'] = -Pc / par['s2w'] * Vus**4 return wc_dict diff --git a/flavio/physics/mesonmixing/amplitude.py b/flavio/physics/mesonmixing/amplitude.py index de47de75..b4a04a40 100644 --- a/flavio/physics/mesonmixing/amplitude.py +++ b/flavio/physics/mesonmixing/amplitude.py @@ -83,7 +83,7 @@ def M12(par, wc, meson): return contribution_np + contribution_sm def G12_d_SM(par, meson): - flavio.register_citation("Beneke:2003az") + flavio.citations.register("Beneke:2003az") di_dj = meson_quark[meson] xi_t = ckm.xi('t',di_dj)(par) xi_u = ckm.xi('u',di_dj)(par) diff --git a/flavio/physics/mesonmixing/wilsoncoefficient.py b/flavio/physics/mesonmixing/wilsoncoefficient.py index 8e146932..10cde067 100644 --- a/flavio/physics/mesonmixing/wilsoncoefficient.py +++ b/flavio/physics/mesonmixing/wilsoncoefficient.py @@ -25,7 +25,7 @@ def F_box(x, y): def S0_box(x, y, xu=0): r"""$\Delta F=2$ box loop function $S_0(x, y, x_u)$.""" - flavio.register_citation("Inami:1980fz") + flavio.citations.register("Inami:1980fz") return F_box(x, y) + F_box(xu, xu) - F_box(x, xu) - F_box(y, xu) def df2_prefactor(par): diff --git a/flavio/physics/mudecays/mueconversion.py b/flavio/physics/mudecays/mueconversion.py index ea8a6fcc..00d9c3e0 100644 --- a/flavio/physics/mudecays/mueconversion.py +++ b/flavio/physics/mudecays/mueconversion.py @@ -24,7 +24,7 @@ def CR_mue(wc_obj, par, nucl): omega_capt = par['GammaCapture '+nucl] #####Wilson Coefficients###### #####Conversion Rate obtained from hep-ph/0203110##### - flavio.register_citation("Kitano:2002mt") + flavio.citations.register("Kitano:2002mt") wc = wc_obj.get_wc('mue', scale, par, nf_out=3) prefac = -np.sqrt(2)/par['GF'] AL = prefac / ( 4 * mm ) * wc['Cgamma_emu'] diff --git a/flavio/physics/running/masses.py b/flavio/physics/running/masses.py index fdeda534..0a264131 100644 --- a/flavio/physics/running/masses.py +++ b/flavio/physics/running/masses.py @@ -9,10 +9,10 @@ # (19) of arXiv:1107.3100v1 def fKsFromMs1(Mu, M, Nf): - flavio.register_citation("Gambino:2011cq") + flavio.citations.register("Gambino:2011cq") return -(4/3.)* (1- (4/3) * (Mu/M) - (Mu**2/(2*M**2)) ) def fKsFromMs2(Mu, M, Nf): - flavio.register_citation("Gambino:2011cq") + flavio.citations.register("Gambino:2011cq") b0 = 11 - 2*Nf/3. return ((((1/3.)*log(M/(2*Mu))+13/18.)*b0 - pi**2/3. + 23/18.)*Mu**2/M**2 + (((8/9.)*log(M/(2*Mu))+64/27.)*b0 - 8*pi**2/9. + 92/27.) * Mu/M @@ -21,7 +21,7 @@ def fKsFromMs2(Mu, M, Nf): ) # from (A.8) of hep-ph/0302262v1 def fKsFromMs3(Mu, M, Nf): - flavio.register_citation("Benson:2003kp") + flavio.citations.register("Benson:2003kp") b0 = 11 - 2*Nf/3. return -(b0/2.)**2*(2353/2592.+13/36.*pi**2+7/6.*zeta(3) -16/9.*Mu/M*((log(M/(2*Mu))+8/3.)**2+67/36.-pi**2/6.) diff --git a/flavio/physics/taudecays/tau3l.py b/flavio/physics/taudecays/tau3l.py index 5be4c06d..37ef4671 100644 --- a/flavio/physics/taudecays/tau3l.py +++ b/flavio/physics/taudecays/tau3l.py @@ -14,7 +14,7 @@ def _BR_taumuee(mtau, me, wc): # (22) of hep-ph/0404211 - flavio.register_citation("Brignole:2004ah") + flavio.citations.register("Brignole:2004ah") return (abs(wc['CVLL'])**2 + abs(wc['CVLR'])**2 + abs(wc['CVRL'])**2 + abs(wc['CVRR'])**2 + 1 / 4 * (abs(wc['CSLL'])**2 + abs(wc['CSLR'])**2 + abs(wc['CSRL'])**2 + abs(wc['CSRR'])**2) + 12 * (abs(wc['CTLL'])**2 + abs(wc['CTRR'])**2) @@ -26,8 +26,8 @@ def _BR_taumuee(mtau, me, wc): def _BR_tau3mu(mtau, mmu, wc): # (23) of hep-ph/0404211 # (117) of hep-ph/9909265 - flavio.register_citation("Brignole:2004ah") - flavio.register_citation("Kuno:1999jp") + flavio.citations.register("Brignole:2004ah") + flavio.citations.register("Kuno:1999jp") return (2 * abs(wc['CVLL'])**2 + abs(wc['CVLR'])**2 + abs(wc['CVRL'])**2 + 2 * abs(wc['CVRR'])**2 + 1 / 8 * (abs(wc['CSLL'])**2 + abs(wc['CSRR'])**2) + 8 * (wc['C7'] * (2 * wc['CVLL'] + wc['CVLR']).conjugate() diff --git a/flavio/physics/taudecays/taulnunu.py b/flavio/physics/taudecays/taulnunu.py index 5f58c34e..6c675f0f 100644 --- a/flavio/physics/taudecays/taulnunu.py +++ b/flavio/physics/taudecays/taulnunu.py @@ -55,7 +55,7 @@ def BR_taulnunu(wc_obj, par, lep, nu1, nu2): pre = par['tau_tau'] / 3 / 2**9 / pi**3 * mtau**5 alpha_e = flavio.physics.running.running.get_alpha_e(par, scale, nf_out=4) # eq. (3) of arXiv:1310.7922 - flavio.register_citation("Pich:2013lsa") + flavio.citations.register("Pich:2013lsa") emcorr = 1 + alpha_e / (2 * pi) * (25 / 4 - pi**2) return pre * _BR(x, CL, CR) * emcorr diff --git a/flavio/physics/wdecays/mw.py b/flavio/physics/wdecays/mw.py index c7f120da..16febf7e 100644 --- a/flavio/physics/wdecays/mw.py +++ b/flavio/physics/wdecays/mw.py @@ -10,7 +10,7 @@ def mW_SM(par): r"""Two-loop SM prediction for the $W$ pole mass. Eq. (6) of arXiv:hep-ph/0311148.""" - flavio.register_citation("Awramik:2003rn") + flavio.citations.register("Awramik:2003rn") dH = log(par['m_h'] / 100) dh = (par['m_h'] / 100)**2 dt = (par['m_t'] / 174.3)**2 - 1 @@ -37,7 +37,7 @@ def dmW_SMEFT(par, C): r"""Shift in the $W$ mass due to dimension-6 operators. Eq. (2) of arXiv:1606.06502.""" - flavio.register_citation("Bjorn:2016zlr") + flavio.citations.register("Bjorn:2016zlr") sh2 = smeftew._sinthetahat2(par) sh = sqrt(sh2) ch2 = 1 - sh2 diff --git a/flavio/physics/zdecays/gammazsm.py b/flavio/physics/zdecays/gammazsm.py index 3ef7fc76..23a68b22 100644 --- a/flavio/physics/zdecays/gammazsm.py +++ b/flavio/physics/zdecays/gammazsm.py @@ -53,7 +53,7 @@ def Zobs(name, m_h, m_t, alpha_s, Dalpha, m_Z): r"""Expansion formula for $Z$ partial widths according to eq. (28) of arXiv:1401.2447. """ - flavio.register_citation("Freitas:2014hra") + flavio.citations.register("Freitas:2014hra") L_H = log(m_h / 125.7) D_t = (m_t / 173.2)**2 - 1 D_alpha_s = alpha_s / 0.1184 - 1 diff --git a/flavio/physics/zdecays/smeftew.py b/flavio/physics/zdecays/smeftew.py index 527680f6..8e157688 100644 --- a/flavio/physics/zdecays/smeftew.py +++ b/flavio/physics/zdecays/smeftew.py @@ -22,17 +22,17 @@ def d_GF(par, C): - flavio.register_citation("Brivio:2017vri") + flavio.citations.register("Brivio:2017vri") return 1 / (sqrt(2) * par['GF']) * sqrt(2) / 2 * (C['phil3_22'] + C['phil3_11'] - C['ll_1221'] / 2) def _sinthetahat2(par): r"""$sin^2(\hat\theta)$""" - flavio.register_citation("Brivio:2017vri") + flavio.citations.register("Brivio:2017vri") return 1 / 2 * (1 - sqrt(1 - (4 * pi * par['alpha_e']) / (sqrt(2) * par['GF'] * par['m_Z']**2))) def d_sh2(par, C): - flavio.register_citation("Brivio:2017vri") + flavio.citations.register("Brivio:2017vri") sh2 = _sinthetahat2(par) sh = sqrt(sh2) ch2 = 1 - sh2 @@ -44,14 +44,14 @@ def d_sh2(par, C): def d_mZ2(par, C): - flavio.register_citation("Brivio:2017vri") + flavio.citations.register("Brivio:2017vri") return (1 / (2 * sqrt(2)) * par['m_Z']**2 / par['GF'] * C['phiD'] + (2**(1 / 4) * sqrt(pi * par['alpha_e']) * par['m_Z']) / par['GF']**(3 / 2) * C['phiWB']) def d_gZb(par, C): - flavio.register_citation("Brivio:2017vri") + flavio.citations.register("Brivio:2017vri") sh2 = _sinthetahat2(par) sh = sqrt(sh2) ch = sqrt(1 - sh2) @@ -76,7 +76,7 @@ def gA_SM(f, par): def d_gVl(f1, f2, par, C): - flavio.register_citation("Brivio:2017vri") + flavio.citations.register("Brivio:2017vri") i, j = sorted((_sectors['l'][f1], _sectors['l'][f2])) d_g = -(C['phie_{}{}'.format(i, j)] + C['phil1_{}{}'.format(i, j)] + C['phil3_{}{}'.format(i, j)]) / (4 * sqrt(2) * par['GF']) if i > j: @@ -87,7 +87,7 @@ def d_gVl(f1, f2, par, C): def d_gVnu(f1, f2, par, C): - flavio.register_citation("Brivio:2017vri") + flavio.citations.register("Brivio:2017vri") i, j = sorted((_sectors['nu'][f1], _sectors['nu'][f2])) d_g = -(C['phil1_{}{}'.format(i, j)] - C['phil3_{}{}'.format(i, j)]) / (4 * sqrt(2) * par['GF']) if i > j: @@ -98,7 +98,7 @@ def d_gVnu(f1, f2, par, C): def d_gVu(f1, f2, par, C): - flavio.register_citation("Brivio:2017vri") + flavio.citations.register("Brivio:2017vri") i, j = sorted((_sectors['u'][f1], _sectors['u'][f2])) d_g = (-C['phiu_{}{}'.format(i, j)] - C['phiq1_{}{}'.format(i, j)] + C['phiq3_{}{}'.format(i, j)]) / (4 * sqrt(2) * par['GF']) if i > j: @@ -109,7 +109,7 @@ def d_gVu(f1, f2, par, C): def d_gVd(f1, f2, par, C): - flavio.register_citation("Brivio:2017vri") + flavio.citations.register("Brivio:2017vri") i, j = sorted((_sectors['d'][f1], _sectors['d'][f2])) d_g = -(C['phid_{}{}'.format(i, j)] + C['phiq1_{}{}'.format(i, j)] + C['phiq3_{}{}'.format(i, j)]) / (4 * sqrt(2) * par['GF']) if i > j: @@ -120,7 +120,7 @@ def d_gVd(f1, f2, par, C): def d_gAl(f1, f2, par, C): - flavio.register_citation("Brivio:2017vri") + flavio.citations.register("Brivio:2017vri") i, j = sorted((_sectors['l'][f1], _sectors['l'][f2])) d_g = (C['phie_{}{}'.format(i, j)] - C['phil1_{}{}'.format(i, j)] - C['phil3_{}{}'.format(i, j)]) / (4 * sqrt(2) * par['GF']) if i > j: @@ -135,7 +135,7 @@ def d_gAnu(f1, f2, par, C): def d_gAu(f1, f2, par, C): - flavio.register_citation("Brivio:2017vri") + flavio.citations.register("Brivio:2017vri") i, j = sorted((_sectors['u'][f1], _sectors['u'][f2])) d_g = -(-C['phiu_{}{}'.format(i, j)] + C['phiq1_{}{}'.format(i, j)] - C['phiq3_{}{}'.format(i, j)]) / (4 * sqrt(2) * par['GF']) if i > j: @@ -146,7 +146,7 @@ def d_gAu(f1, f2, par, C): def d_gAd(f1, f2, par, C): - flavio.register_citation("Brivio:2017vri") + flavio.citations.register("Brivio:2017vri") i, j = sorted((_sectors['d'][f1], _sectors['d'][f2])) d_g = (C['phid_{}{}'.format(i, j)] - C['phiq1_{}{}'.format(i, j)] - C['phiq3_{}{}'.format(i, j)]) / (4 * sqrt(2) * par['GF']) if i > j: @@ -179,7 +179,7 @@ def d_gA(f1, f2, par, C): def d_gWl(f1, f2, par, C): - flavio.register_citation("Brivio:2017vri") + flavio.citations.register("Brivio:2017vri") i, j = sorted((_sectors['l'][f1], _sectors['l'][f2])) sh2 = _sinthetahat2(par) sh = sqrt(sh2) @@ -189,7 +189,7 @@ def d_gWl(f1, f2, par, C): def d_gWq(f1, f2, par, C): - flavio.register_citation("Brivio:2017vri") + flavio.citations.register("Brivio:2017vri") i, j = sorted((_sectors['u'][f1], _sectors['d'][f2])) sh2 = _sinthetahat2(par) sh = sqrt(sh2) diff --git a/flavio/test_citations.py b/flavio/test_citations.py index ad0c2579..daf0e9cf 100644 --- a/flavio/test_citations.py +++ b/flavio/test_citations.py @@ -3,18 +3,18 @@ class TestCitations(unittest.TestCase): def test_citations(self): - citations = flavio.default_citations + citations = flavio.citations # Default paper should be in the papers to cite - self.assertIn("Straub:2018kue", citations.toset) - citations._reset() - self.assertNotIn("Beneke:2003az", citations.toset) + self.assertIn("Straub:2018kue", citations.set) flavio.sm_prediction("DeltaGamma_s") - self.assertIn("Beneke:2003az", citations.toset) + self.assertIn("Beneke:2003az", citations.set) + citations.reset() + self.assertNotIn("Beneke:2003az", citations.set) def test_register(self): - citations = flavio.default_citations + citations = flavio.citations citations.register("fakename:2020abc") - self.assertIn("fakename:2020abc", citations.toset) + self.assertIn("fakename:2020abc", citations.set) def test_theory_citations(self): DGs_citations = flavio.Observable["DeltaGamma_s"].theory_citations() diff --git a/flavio/util.py b/flavio/util.py new file mode 100644 index 00000000..93c7e014 --- /dev/null +++ b/flavio/util.py @@ -0,0 +1,40 @@ +import pkgutil +import os +import sys +from itertools import chain +import re + + +def get_datapath(package, resource): + """Rewrite of pkgutil.get_data() that just returns the file path. + + Taken from https://stackoverflow.com/a/13773912""" + loader = pkgutil.get_loader(package) + if loader is None or not hasattr(loader, 'get_data'): + return None + mod = sys.modules.get(package) or loader.load_module(package) + if mod is None or not hasattr(mod, '__file__'): + return None + # Modify the resource name to be compatible with the loader.get_data + # signature - an os.path format "filename" starting with the dirname of + # the package's __file__ + parts = resource.split('/') + parts.insert(0, os.path.dirname(mod.__file__)) + resource_name = os.path.join(*parts) + return resource_name + +def extract_citations(): + regexp = re.compile(r'\.register\((\'.*?\'|".*?")\)') + flavio_dir = get_datapath('flavio', '') + generator_py_files = chain.from_iterable(( + ( os.path.join(root, name) for name in files + if os.path.splitext(name)[1] == '.py') + for root, dirs, files in os.walk(flavio_dir) + )) + citations = set() + for filename in generator_py_files: + with open(filename, 'r') as f: + citations |= set(chain.from_iterable(( + {v.strip('"\'') for v in regexp.findall(line)} for line in f + ))) + return citations