예제 #1
0
 def test_set_initial_wcxf_minimal(self):
     for eft in ['WET', 'WET-4', 'WET-3']:
         wc = wcxf.WC(eft, 'flavio', 120, {'CVLL_sdsd': {'Im': 1}})
         ww = wilson.Wilson.from_wc(wc)
         self.assertEqual(
             ww.match_run(120, eft, 'flavio', 'sdsd').dict['CVLL_sdsd'], 1j)
         wc = wcxf.WC(eft, 'JMS', 120, {'VddLL_1212': {'Im': 1}})
         wc.validate()
         ww = wilson.Wilson.from_wc(wc)
         self.assertAlmostEqual(
             ww.match_run(120, eft, 'flavio', 'sdsd').dict['CVLL_sdsd'], 1j)
예제 #2
0
 def test_set_initial_wcxf_minimal(self):
     for eft in ['WET', 'WET-4', 'WET-3']:
         wc = wcxf.WC(eft, 'flavio', 120, {'CVLL_sdsd': {'Im': 1}})
         fwc = WilsonCoefficients()
         fwc.set_initial_wcxf(wc)
         self.assertEqual(
             fwc.get_wc('sdsd', 120, par, eft=eft)['CVLL_sdsd'], 1j)
         pf = 4 * par['GF'] / np.sqrt(2)
         wc = wcxf.WC(eft, 'Bern', 120, {'1dsds': {'Im': 1 / pf}})
         fwc = WilsonCoefficients()
         fwc.set_initial_wcxf(wc)
         self.assertAlmostEqual(
             fwc.get_wc('sdsd', 120, par, eft=eft)['CVLL_sdsd'], 1j)
예제 #3
0
    def get_wcxf(self, C_out, scale_out):
        """Return the Wilson coefficients `C_out` as a wcxf.WC instance.

        Note that the Wilson coefficients are rotated into the Warsaw basis
        as defined in WCxf, i.e. to the basis where the down-type and charged
        lepton mass matrices are diagonal."""
        import wcxf
        # C = self.rotate_defaultbasis(C_out)
        C = C_out.copy()  # FIXME
        d = smeftutil.arrays2wcxf(C)
        basis = wcxf.Basis['SMEFT', 'Warsaw']
        d = {k: v for k, v in d.items() if k in basis.all_wcs and v != 0}
        keys_dim5 = ['llphiphi']
        keys_dim6 = list(set(smeftutil.WC_keys_0f + smeftutil.WC_keys_2f
                             + smeftutil.WC_keys_4f) - set(keys_dim5))
        for k in d:
            if k.split('_')[0] in keys_dim5:
                d[k] = d[k] / self.scale_high
        for k in d:
            if k.split('_')[0] in keys_dim6:
                d[k] = d[k] / self.scale_high**2
        # d = {k: v for k, v in d.items() if v != 0}
        d = wcxf.WC.dict2values(d)
        wc = wcxf.WC('SMEFT', 'Warsaw', scale_out, d)
        return wc
예제 #4
0
    def run(self, scale_out, sectors='all'):
        """Evolve the Wilson coefficients to the scale `scale_out`.

        Parameters:

        - scale_out: output scale
        - sectors: optional. If provided, must be a tuple of strings
          corresponding to WCxf sector names. Only Wilson coefficients
          belonging to these sectors will be present in the output.

        Returns an instance of `wcxf.WC`.
        """
        p_i = self._get_running_parameters(self.scale_in, self.f)
        p_o = self._get_running_parameters(scale_out, self.f)
        Etas = (p_i['alpha_s'] / p_o['alpha_s'])
        C_out = OrderedDict()
        for sector in wcxf.EFT[self.eft].sectors:
            if sector in definitions.sectors:
                if sectors == 'all' or sector in sectors:
                    C_out.update(rge.run_sector(sector, self.C_in,
                                                Etas, self.f, p_i))
        C_out = {k: v for k, v in C_out.items()
                 if v != 0 and k in wcxf.Basis[self.eft, 'Bern'].all_wcs}
        return wcxf.WC(eft=self.eft, basis='Bern',
                       scale=scale_out,
                       values=wcxf.WC.dict2values(C_out))
예제 #5
0
파일: test_wet.py 프로젝트: JLTastet/wilson
 def test_incomplete_input(self):
     # generate and input WC instance with just 1 non-zero coeff.
     jms_wc = wcxf.WC('WET', 'JMS', 80, {'VddRR_1212': {'Im': -1}})
     flavio_wc = jms_wc.translate('flavio')
     flavio_wc.validate()
     # the output WC instance should contain only one as well
     self.assertEqual(list(flavio_wc.dict.keys()), ['CVRR_sdsd'])
예제 #6
0
 def test_wcxf2array_incomplete(self):
     wc = wcxf.WC('SMEFT', 'Warsaw', 160, {'G': 1e-10})
     C = smeftutil.wcxf2arrays_symmetrized(wc.dict)
     d = smeftutil.arrays2wcxf_nonred(C)
     for k, v in d.items():
         self.assertEqual(v, wc[k], msg="Failed for {}".format(k))
         self.assertIsInstance(v, Number)
예제 #7
0
파일: test_wet.py 프로젝트: JLTastet/wilson
 def test_incomplete_input(self):
     # generate and input WC instance with just 1 non-zero coeff.
     jms_wc = wcxf.WC('WET', 'JMS', 80, {'VddLL_2323': {'Im': -1}})
     to_wc = jms_wc.translate('FlavorKit')
     to_wc.validate()
     # the output WC instance should contain only one as well
     self.assertEqual(list(to_wc.dict.keys()), ['DVLL_2323'])
     self.assertAlmostEqual(to_wc.dict['DVLL_2323'], +1j)
예제 #8
0
 def test_match_qq3_1322(self):
     # tests matching of Q_qq^(3) of Warsaw onto O_ud^V8,LL in JMS basis
     from_wc =  wcxf.WC(values = {'qq3_1322': 3e-6} ,
                 scale = 1e3 , eft = 'SMEFT' , basis = 'Warsaw up')
     to_wc = from_wc.match('WET', 'JMS')
     V = ckmutil.ckm.ckm_tree(p["Vus"], p["Vub"], p["Vcb"], p["gamma"])
     self.assertAlmostEqual(to_wc['V8udLL_1223']/V[2,2].conjugate()
     /V[1,1].conjugate(),12e-6)
예제 #9
0
 def test_match_dd_1223(self):
     # tests matching of Q_dd of Warsaw onto O_dd^V,RR in JMS basis
     from_wc = wcxf.WC(values={'dd_1223': 51e-6},
                       scale=1e3,
                       eft='SMEFT',
                       basis='Warsaw up')
     to_wc = from_wc.match('WET', 'JMS')
     self.assertAlmostEqual(to_wc['VddRR_1223'], 51e-6)
예제 #10
0
 def test_match_uu_1112(self):
     # tests matching of Q_uu of Warsaw onto O_uu^V,RR in JMS basis
     from_wc = wcxf.WC(values={'uu_1112': 5e-6},
                       scale=1e3,
                       eft='SMEFT',
                       basis='Warsaw up')
     to_wc = from_wc.match('WET', 'JMS')
     self.assertAlmostEqual(to_wc['VuuRR_1112'], 5e-6)
예제 #11
0
 def test_match_ee_1233(self):
     # tests matching of Q_ee of Warsaw onto O_ee^V,RR in JMS basis
     from_wc = wcxf.WC(values={'ee_1233': 100e-6},
                       scale=1e3,
                       eft='SMEFT',
                       basis='Warsaw up')
     to_wc = from_wc.match('WET', 'JMS')
     self.assertAlmostEqual(to_wc['VeeRR_1233'], 100e-6)
예제 #12
0
 def test_match_lq1_1233(self):
     # tests matching of Q_lq^1 of Warsaw onto O_ed^V,LL in JMS basis
     from_wc = wcxf.WC(values={'lq1_1233': 12e-6},
                       scale=1e3,
                       eft='SMEFT',
                       basis='Warsaw up')
     to_wc = from_wc.match('WET', 'JMS')
     self.assertAlmostEqual(to_wc['VedLL_1233'], 12e-6)
예제 #13
0
 def test_match_ll_1312(self):
     # tests matching of Q_ll of Warsaw onto O_nue^V,LL in JMS basis
     from_wc = wcxf.WC(values={'ll_1213': 20e-6},
                       scale=1e3,
                       eft='SMEFT',
                       basis='Warsaw up')
     to_wc = from_wc.match('WET', 'JMS')
     self.assertAlmostEqual(to_wc['VnueLL_1312'], 20e-6)
예제 #14
0
 def test_empty(self):
     wc_sm = wcxf.WC('SMEFT', 'Warsaw', 160, {})
     smeft_sm = SMEFT(wc_sm, get_smpar=False)
     C_in_sm = smeft_sm.C_in
     C_in_sm_2 = beta.C_array2dict(np.zeros(9999))
     for k, v in C_in_sm_2.items():
         if k not in SM_keys:
             npt.assert_array_equal(v, C_in_sm[k],
                                    err_msg="Failed for {}".format(k))
예제 #15
0
 def test_get_initial_wcxf_minimal(self):
     for eft in ['WET', 'WET-4', 'WET-3']:
         wc = wcxf.WC(eft, 'flavio', 120, {'CVLL_sdsd': {'Im': 1}})
         fwc = WilsonCoefficients()
         fwc.set_initial_wcxf(wc)
         wc2 = fwc.get_initial_wcxf
         self.assertEqual(wc.eft, wc2.eft)
         self.assertEqual(wc2.basis, 'flavio')
         self.assertDictEqual(wc.dict, wc2.dict)
예제 #16
0
 def test_lfu(self):
     sm_wc_dict = eos.get_sm_wcs(data_path)
     wc_dict = {
         'b->uenue::cSL': 0.2j,
         'b->umunumu::cSL': 0.1j,
     }
     wc = wcxf.WC('WET', 'EOS', 4.2, wcxf.WC.dict2values(wc_dict))
     with self.assertRaises(ValueError):
         eos.wcxf2eos(wc, sm_wc_dict)
예제 #17
0
def get_random_wc(eft, basis, scale, cmax=1e-2):
    """Generate a random wcxf.WC instance for a given basis."""
    basis_obj = wcxf.Basis[eft, basis]
    _wc = {}
    for s in basis_obj.sectors.values():
        for name, d in s.items():
            _wc[name] = cmax * np.random.rand()
            if 'real' not in d or not d['real']:
                _wc[name] += 1j * cmax * np.random.rand()
    return wcxf.WC(eft, basis, scale, wcxf.WC.dict2values(_wc))
예제 #18
0
파일: test_wet.py 프로젝트: JLTastet/wilson
 def test_incomplete_input(self):
     # generate and input WC instance with just 1 non-zero coeff.
     jms_wc = wcxf.WC('WET-3', 'flavio', 80, {'CVLL_sdsd': {'Im': -1e-6}})
     bern_wc = jms_wc.translate('Bern')
     bern_wc.validate()
     # the output WC instance should contain only one as well
     self.assertEqual(list(bern_wc.dict.keys()), ['1dsds'])
     GF = wilson.parameters.p['GF']
     pre = 4 * GF / sqrt(2)
     self.assertAlmostEqual(bern_wc.dict['1dsds'], -1e-6j / pre)
예제 #19
0
 def test_method(self):
     wc = wcxf.WC('SMEFT', 'Warsaw', 1000, {'uG_33': 1e-6})
     smeft = SMEFT(wc)
     p_out = smeft.get_smpar()
     p_def = smpar.p
     for k, v in p_out.items():
         self.assertAlmostEqual(v / p_def[k],
                                1,
                                places=1,
                                msg="Failed for {}".format(k))
예제 #20
0
 def test_rgsolution_smeft(self):
     wc = wcxf.WC('SMEFT', 'Warsaw', 1e5, {'qu1_1233': 1e-7})
     wc.validate()
     smeft = wilson.run.smeft.SMEFT(wc)
     sol = smeft.run_continuous(160)
     x, y = sol.plotdata('qu1_1233')
     self.assertTupleEqual(x.shape, (50, ))
     self.assertTupleEqual(y.shape, (50, ))
     self.assertEqual(x.dtype, float)
     self.assertEqual(y.dtype, float)
예제 #21
0
 def test_incomplete_input(self):
     # generate and input WC instance with just 1 non-zero coeff.
     jms_wc = wcxf.WC('WET', 'Bern', 80, {'1sbsb': {'Im': -1}})
     flavio_wc = jms_wc.translate('flavio')
     flavio_wc.validate()
     # the output WC instance should contain only one as well
     self.assertEqual(list(flavio_wc.dict.keys()), ['CVLL_bsbs'])
     GF = wcxf.parameters.p['GF']
     pre = 4*GF/sqrt(2)
     self.assertAlmostEqual(flavio_wc.dict['CVLL_bsbs'], -1j * pre)
예제 #22
0
 def test_run_wcxf(self):
     for eft in [
         ('WET', 'WET', 120, 120),
         ('WET', 'WET-4', 120, 3),
         ('WET', 'WET-3', 120, 2),
         ('WET-4', 'WET-4', 3, 2),
         ('WET-4', 'WET-3', 3, 2),
         ('WET-3', 'WET-3', 2, 1),
     ]:
         wc = wcxf.WC(eft[0], 'flavio', eft[2], {'CVLL_sdsd': {'Im': 1}})
         ww = wilson.Wilson.from_wc(wc)
         wc_out = ww.match_run(eft[3], eft[1], 'flavio')
         wc_out.validate()
예제 #23
0
 def test_nedm_jms_CEDM(self):
     wc = wcxf.WC('WET', 'JMS', 160, {'dG_11': {'Im': 1e-10}})
     wcf = flavio.WilsonCoefficients()
     wcf.set_initial_wcxf(wc)
     wcd = wcf.get_wc('dF=0', scale=2, par=par, eft='WET-3', basis='flavio')
     self.assertAlmostEqual(wcd['C8_dd'] / 1j, 0.07, delta=0.02)
     par_dG = par.copy()
     par_dG['nEDM gT_d'] = 0
     par_dG['nEDM beta_G'] = 0
     par_dG['nEDM gT_u'] = 0
     par_dG['nEDM ~rho_u'] = 0
     p = flavio.Observable['d_n'].prediction_par(par_dG, wcf)
     self.assertAlmostEqual(p, 2e-10, delta=0.3e-10)
예제 #24
0
파일: classes.py 프로젝트: JLTastet/wilson
    def _to_wcxf(self, C_out, scale_out):
        """Return the Wilson coefficients `C_out` as a wcxf.WC instance.

        Note that the Wilson coefficients are rotated into the Warsaw basis
        as defined in WCxf, i.e. to the basis where the down-type and charged
        lepton mass matrices are diagonal."""
        C = self._rotate_defaultbasis(C_out)
        d = wilson.util.smeftutil.arrays2wcxf_nonred(C)
        basis = wcxf.Basis['SMEFT', 'Warsaw']
        all_wcs = set(basis.all_wcs)  # to speed up lookup
        d = {k: v for k, v in d.items() if k in all_wcs and v != 0}
        d = wcxf.WC.dict2values(d)
        wc = wcxf.WC('SMEFT', 'Warsaw', scale_out, d)
        return wc
예제 #25
0
 def test_nedm_jms_G(self):
     wc = wcxf.WC('WET', 'JMS', 160, {'Gtilde': 1e-6})
     wcf = flavio.WilsonCoefficients()
     wcf.set_initial_wcxf(wc)
     wcd = wcf.get_wc('dF=0', scale=2, par=par, eft='WET-3', basis='flavio')
     self.assertEqual(wcd['CG'], 0)
     self.assertAlmostEqual(wcd['CGtilde'], 0.007, delta=0.001)
     par_G = par.copy()
     par_G['nEDM gT_d'] = 0
     par_G['nEDM ~rho_d'] = 0
     par_G['nEDM gT_u'] = 0
     par_G['nEDM ~rho_u'] = 0
     p = flavio.Observable['d_n'].prediction_par(par_G, wcf)
     self.assertAlmostEqual(p, 4.5e-9, delta=1e-9)
예제 #26
0
 def test_wcxf2eos(self):
     sm_wc_dict = eos.get_sm_wcs(data_path)
     wc_dict = {
         'b->s::c7': 0.1,
         'b->uenue::cSL': 0.2j,
         'b->umunumu::cSL': 0.2j,
         'b->uenue::cVL': 0.2,
         'b->umunumu::cVL': 0.2,
         'b->s::c5': -0.03
     }
     wc = wcxf.WC('WET', 'EOS', 4.2, wcxf.WC.dict2values(wc_dict))
     eos_dict = eos.wcxf2eos(wc, sm_wc_dict)
     self.assertEqual(eos_dict['b->s::Re{c7}']['central'],
                      -0.33726473 + 0.1)
     self.assertEqual(eos_dict['b->s::c5']['central'], 0.00042854 - 0.03)
     self.assertEqual(eos_dict['b->ulnu::Im{cSL}']['min'], 0.0 + 0.2)
     self.assertEqual(eos_dict['b->ulnu::Re{cVL}']['max'], 1.0 + 0.2)
예제 #27
0
 def test_symm_fac(self):
     wc = wcxf.WC('SMEFT', 'Warsaw mass', 120,
                  {'ll_1111': 1e-6, 'll_1221': 4e-6})
     tmpdir = mkdtemp()
     with open(os.path.join(tmpdir, 'my_wcxf.yaml'), 'w') as f:
         wc.dump(f, fmt='yaml')
     res = subprocess.run(['wcxf2smeftsim', 'my_wcxf.yaml'],
                          cwd=tmpdir)
     # check if file is present
     outf = os.path.join(tmpdir, 'wcxf2smeftsim_param_card.dat')
     self.assertTrue(os.path.isfile, outf)
     with open(outf, 'r') as f:
         card = pylha.load(f)
     self.assertEqual(dict(card['BLOCK']['FRBlock']['values'])[691],
                      1e6 * 4e-6 / 2,  # symmetry factor of 1 / 2!
                      msg="Wrong value for ll_1221")
     self.assertEqual(dict(card['BLOCK']['FRBlock']['values'])[689],
                      1e6 * 1e-6,  # no symmetry factor!
                      msg="Wrong value for ll_1111")
예제 #28
0
파일: classes.py 프로젝트: knut0815/wilson
    def __init__(self, wcdict, scale, eft, basis):
        """Initialize the `Wilson` class.

        Parameters:

        - `wcdict`: dictionary of Wilson coefficient values at the input scale.
          The keys must exist as Wilson coefficients in the WCxf basis file.
          The values must be real or complex numbers (not dictionaries with key
          'Re'/'Im'!)
        - `scale`: input scale in GeV
        - `eft`: input EFT
        - `basis`: input basis
        """
        super().__init__()
        self.wc = wcxf.WC(eft=eft,
                          basis=basis,
                          scale=scale,
                          values=wcxf.WC.dict2values(wcdict))
        self.wc.validate()
        self._cache = {}
예제 #29
0
    def run(self, scale_out, sectors='all'):
        """Evolve the Wilson coefficients to the scale `scale_out`.

        Parameters:

        - scale_out: output scale
        - sectors: optional. If provided, must be a tuple of strings
          corresponding to WCxf sector names. Only Wilson coefficients
          belonging to these sectors will be present in the output.

        Returns an instance of `wcxf.WC`.
        """
        C_out = self._run_dict(scale_out, sectors=sectors)
        all_wcs = set(wcxf.Basis[self.eft,
                                 'JMS'].all_wcs)  # to speed up lookup
        C_out = {k: v for k, v in C_out.items() if v != 0 and k in all_wcs}
        return wcxf.WC(eft=self.eft,
                       basis='JMS',
                       scale=scale_out,
                       values=wcxf.WC.dict2values(C_out))
예제 #30
0
    def get_wcxf(self,
                 sector,
                 scale,
                 par,
                 eft='WET',
                 basis='flavio',
                 nf_out=None):
        """Get the values of the Wilson coefficients belonging to a specific
        sector (e.g. `bsmumu`) at a given scale.

        Returns a WCxf.WC instance.

        Parameters:

        - sector: string name of the sector as defined in the WCxf EFT instance
        - scale: $\overline{\text{MS}}$ renormalization scale
        - par: dictionary of parameters
        - eft: name of the EFT at the output scale
        - basis: name of the output basis
        """
        # nf_out is only present to preserve backwards compatibility
        if nf_out == 5:
            eft = 'WET'
        elif nf_out == 4:
            eft = 'WET-4'
        elif nf_out == 3:
            eft = 'WET-3'
        elif nf_out is not None:
            raise ValueError("Invalid value: nf_out=".format(nf_out))
        if sector == 'all':
            mr_sectors = 'all'
        else:
            # translate from legacy flavio to wcxf sector if necessary
            wcxf_sector = sectors_flavio2wcxf.get(sector, sector)
            mr_sectors = (wcxf_sector, )
        if not self.wc:
            return wcxf.WC(eft=eft, basis=basis, scale=scale, values={})
        return self.match_run(scale=scale,
                              eft=eft,
                              basis=basis,
                              sectors=mr_sectors)