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'] / VcbSM, 1) # Vub w = Wilson( {'lq3_3313': 0.5 * pre * VubSM * (-0.5) * exp(-1j * deltaSM)}, 91.1876, 'SMEFT', 'Warsaw') pp = gl.parameter_point(w) self.assertAlmostEqual(pp.par_dict_np['Vub'] / VubSM, 1.5, delta=0.03) # Vus w = Wilson({'lq3_2212': 0.5 * pre * VusSM * (-0.1)}, 91.1876, 'SMEFT', 'Warsaw') pp = gl.parameter_point(w) self.assertAlmostEqual(pp.par_dict_np['Vus'] / VusSM, 1.1, delta=0.03)
def test_np(self): # Bd CVSM = flavio.physics.mesonmixing.wilsoncoefficient.cvll_d(par, 'B0', scale=80)[0] w = Wilson({'CVRR_bdbd': CVSM}, 80, 'WET', 'flavio') self.assertAlmostEqual( flavio.np_prediction('DeltaM_d', w) / flavio.sm_prediction('DeltaM_d'), 2, delta=0.15) # difference due to NNLO evolution of SM contribution # Bs CVSM = flavio.physics.mesonmixing.wilsoncoefficient.cvll_d(par, 'Bs', scale=80)[0] w = Wilson({'CVRR_bsbs': CVSM}, 80, 'WET', 'flavio') self.assertAlmostEqual( flavio.np_prediction('DeltaM_s', w) / flavio.sm_prediction('DeltaM_s'), 2, delta=0.15) # difference due to NNLO evolution of SM contribution # K0 CVSM = flavio.physics.mesonmixing.wilsoncoefficient.cvll_d(par, 'K0', scale=80)[0] w = Wilson({'CVRR_sdsd': CVSM}, 80, 'WET', 'flavio') self.assertAlmostEqual( flavio.np_prediction('eps_K', w) / flavio.sm_prediction('eps_K'), 2, delta=0.15 ) # difference due to NNLO evolution of SM contribution + charm contribution
def test_taulnunu_np3(self): CLSM = -4 * par['GF'] / sqrt(2) w = Wilson({'CVLL_numunueemu': CLSM}, 80, 'WET', 'flavio') BRSM = flavio.sm_prediction('BR(tau->enunu)') BRNP = flavio.np_prediction('BR(tau->enunu)', w) self.assertEqual(BRNP / BRSM, 0.25) w = Wilson({'CVLL_numunueemu': -0.5 * CLSM}, 80, 'WET', 'flavio') BRSM = flavio.sm_prediction('BR(tau->enunu)') BRNP = flavio.np_prediction('BR(tau->enunu)', w) self.assertEqual(BRNP / BRSM, 4)
def test_GFeff(self): CLSM = -4 * par['GF'] / sqrt(2) w = Wilson({'CVLL_numunueemu': CLSM}, 80, 'WET', 'flavio') wc_np = flavio.WilsonCoefficients.from_wilson(w) GFeff = taulnunu.GFeff(wc_np, par) self.assertEqual(GFeff / par['GF'], 0.5) w = Wilson({'CVLL_numunueemu': -0.5 * CLSM}, 80, 'WET', 'flavio') wc_np = flavio.WilsonCoefficients.from_wilson(w) GFeff = taulnunu.GFeff(wc_np, par) self.assertEqual(GFeff / par['GF'], 2)
def predmodel(wc, l0, M): chi = lambda lr, li: chi2( Wilson(wc(lr + li * 1j, M * 1000), scale=M * 1000, eft='WET', basis='flavio'))[-1] m = Minuit(chi, lr=l0[0], li=l0[1], error_lr=0.001, error_li=0.001, errordef=1, print_level=0) m.migrad() cont = [(l0[0] + m.errors[0], l0[1]), (l0[0] - m.errors[0], l0[1]), (l0[0], l0[1] + m.errors[1]), (l0[0], l0[1] - m.errors[1])] #obs0 = [('<Rmue>(B+->Kll)', 1.0, 6.0), ('<Rmue>(B0->K*ll)', 0.045, 1.1), ('<Rmue>(B0->K*ll)', 1.1, 6.0), ('DMs',), ('S_psiphi',)] obs0 = [('S_psiphi', )] for ob in obs0: lim = [] if isinstance(ob, tuple): centr = flavio.np_prediction( ob[0], Wilson(wc(l0[0] + l0[1] * 1j, M * 1000), scale=M * 1000, eft='WET', basis='flavio'), *ob[1:]) for p in cont: lim.append( flavio.np_prediction( ob[0], Wilson(wc(p[0] + p[1] * 1j, M * 1000), scale=M * 1000, eft='WET', basis='flavio'), *ob[1:])) else: centr = flavio.np_prediction( ob, Wilson(wc(l0[0] + l0[1] * 1j, M * 1000), scale=M * 1000, eft='WET', basis='flavio')) for p in cont: lim.append( flavio.np_prediction( ob, Wilson(wc(p[0] + p[1] * 1j, M * 1000), scale=M * 1000, eft='WET', basis='flavio'))) errorsup = max(lim) - centr errorinf = centr - min(lim) print(ob, ':\t', centr, ' + ', errorsup, ' - ', errorinf)
def test_importing_from_wcxf(self): from wilson import Wilson inputs = { 'cbtaunutau::cSL': 0.3 + 0.1j, 'ubenue::cVL': -0.1 + 0.2j, } w = Wilson(inputs, scale=4.2, eft="WET", basis="EOS") p = eos.Parameters.FromWCxf(w) pdefaults = eos.Parameters.Defaults() outputs = { 'cbtaunutau::Re{cSL}': +0.3, 'cbtaunutau::Im{cSL}': +0.1, 'ubenue::Re{cVL}': -0.1, 'ubenue::Im{cVL}': +0.2, } outputs = { ok: ov + pdefaults[ok].evaluate() for ok, ov in outputs.items() } for ok, ov in outputs.items(): self.assertAlmostEqual( p[ok].evaluate(), ov, delta = 1.0e-10 )
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)
def makefit_complex(wc, rangeR, rangeI, rangeM, filename): ''' Fit and print results to file wc: Function that computes Wilson Coefficients from the model parameters (e.g. wc_Z, wc_LQ) Complex couplings stepM, maxM in TeV ''' chi0 = chi2() for M in rangeM: f = open(filename, 'at') #f.write(str(M) + '\t' + '0' + '\t' + '0' + '\t' + str(chi0[0]) + '\t' + str(chi0[1]) + '\t' + str(chi0[2]) + '\t' + str(chi0[3]) + '\n' ) for lR in rangeR: chi = [] for lI in rangeI: if (lR == 0) and (lI == 0): chitot = chi0 else: wcobj = Wilson(wc(lR + lI * 1j, M * 1000), scale=M * 1000, eft='WET', basis='flavio') chitot = chi2(wcobj) f.write( str(M) + '\t' + str(lR) + '\t' + str(lI) + '\t' + str(chitot[0]) + '\t' + str(chitot[1]) + '\t' + str(chitot[2]) + '\t' + str(chitot[3]) + '\n') f.close()
def test_trident_np_2(self): # mimic the SM but with taus or electrons to increase the rate 2x w = Wilson({ 'll_1222': pre * (1 - 1 / 2 + s2w), 'le_1222': pre * s2w }, 91.1876, 'SMEFT', 'Warsaw') self.assertAlmostEqual(flavio.np_prediction('R_trident', w), 2, delta=0.015) w = Wilson({ 'll_2223': pre * (1 - 1 / 2 + s2w), 'le_2322': pre * s2w }, 91.1876, 'SMEFT', 'Warsaw') self.assertAlmostEqual(flavio.np_prediction('R_trident', w), 2, delta=0.015)
def prompt_build(self): """Get user input before the maze has been built""" factor = raw_input("Enter loop factor (0: No loops; 100: All loops): ") speed = 3 print 'Building...' self._walker = Wilson(self, float(factor) / 100.0, speed) self.after(self._walker.delay(), self._run)
def chicalcBs(l , M, wc): "Chi-squared statistic for the fit to Bs-mixing-related observables" wcObj = Wilson(wc(l, M), scale=M, eft='WET', basis='flavio') chi2 = 0 for o in (-2,-1): chi2 += ((flavio.np_prediction(observables[o][0], wcObj, *observables[o][1:]) - exp[o] ))**2/(uncTot[o]**2 ) return chi2
def chicalcRK(l , M, wc): "Chi-squared statistic for the fit to RK(*)-related observables" wcObj = Wilson(wc(l, M), scale=M, eft='WET', basis='flavio') chi2 = 0 for o in range(0, len(observables)-2): chi2 += ((flavio.np_prediction(observables[o][0], wcObj, *observables[o][1:]) - exp[o] ))**2/(uncTot[o]**2 ) return chi2
def test_taulnunu_np2(self): w = Wilson({ 'CVLL_numunuetaue': 2e-2, 'CVLL_numunuetaumu': 1e-2 }, 80, 'WET', 'flavio') BR1 = flavio.np_prediction('BR(tau->enunu)', w) BR2 = flavio.np_prediction('BR(tau->mununu)', w) self.assertAlmostEqual(BR1 / BR2, 4, delta=0.2)
def C910mu(cr, ci): return Wilson({ 'C9_bsmumu': cr + 1j * ci, 'C10_bsmumu': -cr - 1j * ci }, scale=4.2, eft='WET', basis='flavio')
def chiM(wc, l, M): wcobj = Wilson(wc(l, M * 1000), scale=M * 1000, eft='WET', basis='flavio') chiM = 0 for i in range(0, nobs): if obslist[i]['obs'] in ['DMs', 'S_psiphi']: th = flavio.np_prediction(obslist[i]['obs'], wcobj) chiM += (th - obslist[i]['central'])**2 / obslist[i]['error']**2 return chiM
def dGEl(bm, el): w = Wilson( wcdict={"CSR_bctaunutau": -sqrt(2) * Yb * Ytau / 4 / p["GF"] * bm**2}, scale=5, eft="WET", basis="flavio", ) return bdlnu.dGEl(w, el)
def test_taulnunu_np(self): w = Wilson({ 'CVLL_numunuetaue': 2e-4, 'CVLL_numunueetau': 1e-4 }, 80, 'WET', 'flavio') wc_np = flavio.WilsonCoefficients.from_wilson(w) BR1 = taulnunu.BR_taulnunu(wc_np, par, 'e', 'e', 'mu') BR2 = taulnunu.BR_taulnunu(wc_np, par, 'e', 'mu', 'e') self.assertEqual(BR1 / BR2, 4)
def test_taulnunu_np4(self): CLSM = -4 * par['GF'] / sqrt(2) w = Wilson({ 'CVLL_numunueemu': -0.5 * CLSM, 'CVLL_nutaunueetau': CLSM }, 80, 'WET', 'flavio') BR1 = flavio.sm_prediction('BR(tau->enunu)') BR2 = flavio.np_prediction('BR(tau->enunu)', w) self.assertEqual(BR2 / BR1, 9)
def values(l, M, wc, ps=True): "Values of the observables in a NP scenario. Now in Markdown style" wcObj = Wilson(wc(l, M), scale=M, eft='WET', basis='flavio') print('|C9_bsmumu\t|' + str(wc(l, M)['C9_bsmumu']) + '|') print('|CVLL_bsbs\t|' + str(wc(l, M)['CVLL_bsbs']) + '|') for o in range(0, len(observables)): if o == len(observables) - 2 and ps: print('|' + observables[o][0] + '\t|' + str(roundC(flavio.np_prediction(observables[o][0], wcObj, *observables[o][1:])/flavio.sm_prediction('DeltaM_s')*20.01 ) ) + '|') else: print('|' + observables[o][0] + '\t|' + str(roundC(flavio.np_prediction(observables[o][0], wcObj, *observables[o][1:])) ) + '|')
def test_trident_np_1(self): # mimic the SM to increase the rate 4x w = Wilson( { 'll_2222': pre * (1 - 1 / 2 + s2w) / 2, 'le_2222': pre * s2w }, 91.1876, 'SMEFT', 'Warsaw') self.assertAlmostEqual(flavio.np_prediction('R_trident', w), 4, delta=0.03)
def test_amu_NP(self): w = Wilson({'C7_mumu': 1e-3}, 1.0, 'WET-3', 'flavio') e = sqrt(4 * pi * par['alpha_e']) m = par['m_mu'] p = 4 * par['GF'] / sqrt(2) * e / 16 / pi**2 * m pre = p * 4 * m / e a = pre * 1e-3 self.assertAlmostEqual(flavio.np_prediction('a_mu', w) - amu_SM, a, delta=0.01 * abs(a))
def test_tauegamma_implementation(self): input_dict_list=[{ 'Cgamma_taue':np.random.random()*1e-8*exp(1j*2*pi*np.random.random()), 'Cgamma_etau':np.random.random()*1e-8*exp(1j*2*pi*np.random.random()), } for i in range(10)] BRs = np.array([ flavio.np_prediction( 'BR(tau->egamma)', Wilson(input_dict, 100, 'WET', 'flavio') ) for input_dict in input_dict_list ]) compare_BRs = np.array([ compare_BR( Wilson(input_dict, 100, 'WET', 'flavio'), 'tau', 'e', ) for input_dict in input_dict_list ]) self.assertAlmostEqual(np.max(np.abs(1-BRs/compare_BRs)), 0, delta=0.002)
def test_trident_zprime(self): # reproduce eq. (11) in arXiv:1406.2332 vp = 1000 CV = -pre * v**2 / vp**2 w = Wilson({ 'll_2222': -CV / 2 / 2, 'le_2222': -CV / 2 }, 91.1876, 'SMEFT', 'Warsaw') R = (1 + (1 + 4 * s2w + 2 * v**2 / vp**2)**2) / (1 + (1 + 4 * s2w)**2) self.assertAlmostEqual(flavio.np_prediction('R_trident', w), R, delta=0.005)
def makeWilson(pt_dic, mLQ='mLQ_WM'): """Returns Wilson instance, provided with a parameter point in our conventions. LQ mass can be specified as a float or as a string key in pt_dic. """ UL = np.array(pt_dic['UL']) UR = np.array(pt_dic['UR']) if isinstance(mLQ, str): _mLQ = pt_dic[mLQ] elif (isinstance(mLQ, float) or isinstance(mLQ, int)): _mLQ = float(mLQ) WCs = ULR2WC(UL, UR, _mLQ) wil = Wilson(WCs, scale=_mLQ, eft='SMEFT', basis='Warsaw') return wil
def prompt_build(self): """Get user input before the maze has been built""" factor = raw_input("Enter loop factor (0: No loops; 100: All loops): ") print "How much of the maze building would you like to see?" print "1: Show me everything" print "2: Just give me the broad strokes" print "3: Quick Generation" try: speed = int(raw_input(">> ")) except ValueError: print "Since you can't type, I can only assume you're in a hurry." speed = 3 print 'Building...' self._walker = Wilson(self, float(factor) / 100.0, speed) #maze generation self.after(self._walker.delay(), self._run)
def prompt_build(self): """Get user input before the maze has been built""" factor = raw_input("Enter loop factor (0: No loops; 100: All loops): ") print ("How much of the maze building would you like to see?") print ("1: Show me everything") print ("2: Just give me the broad strokes") print ("3: I don't have all day. Mach schnell!") try: speed = int(raw_input(">> ")) except ValueError: print ("Since you can't type, I can only assume you're in a hurry.") speed = 3 print( 'Building...') self._walker = Wilson(self, float(factor) / 100.0, speed) self.after(self._walker.delay(), self._run)
def C9C10scen(C9, C10): return Wilson({ 'C9_bsmumu': C9, 'C10_bsmumu': C10, }, 4.8, 'WET', 'flavio')
def test_np(self): v = 246.22 from wilson import Wilson w = Wilson({'phil3_11': -0.5 / v**2}, 91.1876, 'SMEFT', 'Warsaw') self.assertAlmostEqual(flavio.np_prediction('BR(W->enu)', w), 10.83e-2 / 2, delta=0.15e-2)
def run_point(): arg_xi = 1.5 xi = 1 * (np.cos(arg_xi) + 1j * np.sin(arg_xi)) m_eta = 5e4 lambda_kappa = 0.05 m0 = lambda_kappa * VEV**2 / ((16 * np.pi**2)**2 * m_eta**2) z23 = 1 w22 = 1 w32 = -1 arg_y33 = 2 y33 = 2 * (np.cos(arg_y33) + 1j * np.sin(arg_y33)) m_Pi7 = 1000 x32 = x(xi, m0)[2] clequ1_3332 = np.conjugate(x32) * y33 / (2 * m_Pi7**2) m_zeta = 15000 z22_minus_z23 = Z(xi, m0)[1] z22 = (z22_minus_z23 - z23 * w32) / w22 clq3_2232 = np.conjugate(z22) * z23 / (4 * m_zeta**2) m_Phi = 2000 cqu1_2322 = -2 * w22 * w32 / (9 * m_Phi**2) wsmeft = Wilson( { "lequ1_3332": clequ1_3332, "lequ3_3332": 0.25 * clequ1_3332, "lq3_2223": clq3_2232, "lq1_2223": 3 * clq3_2232, "qu1_2322": cqu1_2322, "qu8_2322": -3 * cqu1_2322 / 2, }, scale=(m_Pi7 + m_Phi) / 2, eft="SMEFT", basis="Warsaw", ) wwet = wsmeft.match_run(scale=4.2, eft="WET", basis="flavio") rdstar = flavio.np_prediction("Rtaul(B->D*lnu)", wsmeft) rd = flavio.np_prediction("Rtaul(B->Dlnu)", wsmeft) print("---------------") print("Values") print("---------------") print(f"lequ1_3332: {clequ1_3332 * 1e6}") print(f"C9mumu: {wwet['C9_bsmumu']}") print(f"C10mumu: {wwet['C10_bsmumu']}") print(f"C9ee: {wwet['C9_bsee']}") print(f"C9tautau: {wwet['C9_bstautau']}") print(f"RD: {rd}") print(f"RD*: {rdstar}") print(f"CSL: {wwet['CSL_bctaunutau']}") print("---------------") print("With parameters") print("---------------") print(f"xi: {xi}") print(f"m_eta: {m_eta/1e3} TeV") print(f"m_zeta: {m_zeta/1e3} TeV") print(f"m_Pi7: {m_Pi7/1e3} TeV") print(f"z22: {z22}") print(f"z13: {-Z(xi, m0)[0]}") print(f"z23: {z23}") print(f"z33: {-Z(xi, m0)[2]}") print(f"x12: {x(xi, m0)[0]}") print(f"x22: {x(xi, m0)[1]}") print(f"x32: {x32}") print(f"y33: {y33}")
from wilson import Wilson import numpy as np #====================================== # Wilson coeffecients Left-Handed chiral Vector current (V-A structure ) # CVL_bctaunutau ( b -> c tau v_tau) ~ 10^-5 # CVL_bctaunumu (b->c tau v_mu) ~ 10^-4 # CV_bcmunutau (b->c mu v_tau) ~ 10^-7 #CV_bcmunumu (b -> c mu v_mu) ~10^-6 ################################################ # w_c input at the EW scale, and standard basis w = Wilson( { 'CVL_bctaunutau': 0.17, 'CVL_bctaunumu': 0.32, 'CVL_bcmunutau': 1e-3, 'CVL_bcmunumu': 1.7e-3 }, scale=4.8, eft='WET', basis='flavio') #the prediction for RD* RD_star_np = flavio.np_prediction('Rtaul(B->D*lnu)', w) RD_star_np_uncertainty = flavio.np_uncertainty('Rtaul(B->D*lnu)', w) RD_star_sm = flavio.sm_prediction('Rtaul(B->D*lnu)') RD_star_sm_uncertainty = flavio.sm_uncertainty('Rtaul(B->D*lnu)') #LHCb result RD_star_obs = 0.366 RD_star_obs_sys = 0.030 RD_star_obs_stat = 0.027 ## values = [