Ejemplo n.º 1
0
 def test_wcxf2array(self):
     wc = get_random_wc('SMEFT', 'Warsaw', 160)
     C = smeftutil.wcxf2arrays_symmetrized(wc.dict)
     d = smeftutil.arrays2wcxf_nonred(C)
     self.assertEqual(wc.dict.keys(), d.keys())
     for k, v in wc.dict.items():
         self.assertAlmostEqual(v, d[k], msg=f"Failed for {k}")
Ejemplo n.º 2
0
 def test_smeft(self):
     wc = get_random_wc('SMEFT', 'Warsaw', 1000, 1e-8)
     with self.assertRaises(Exception):
         # no initial condition set
         smeft = SMEFT()
     # just check this doesn't raise errors
     smeft = SMEFT(wc)
     wc = smeft.run(900)
     wc.validate()
     wc = smeft.run(900, 'leadinglog')
     wc.validate()
Ejemplo n.º 3
0
 def test_roundtrip_warsaw(self):
     wc = get_random_wc("SMEFT", "Warsaw up", 120)
     basis = wcxf.Basis["SMEFT", "Warsaw up"]
     for name in basis.all_wcs:
         if name == 'phiD':
             continue
         wc = wcxf.WC("SMEFT", "Warsaw up", 120, {name: 1e-8})
         wc_translated = wc.translate("Higgs-Warsaw up")
         wc_translated.validate()
         # translate back and check that nothing changed
         wc_roundtrip = wc_translated.translate("Warsaw up")
         for k, v in wc.dict.items():
             self.assertAlmostEqual(v,
                                    wc_roundtrip.dict[k],
                                    places=20,
                                    msg=f"Failed for {k}")
Ejemplo n.º 4
0
 def test_padding(self):
     wc = get_random_wc('WET', 'JMS', 90)
     C = wetutil.wcxf2arrays(wc.dict)
     C_shapes = {
         k: 1
         if isinstance(v, numbers.Number)
         else v.shape
         for k,v in C.items()
     }
     self.assertGreaterEqual(wetutil.C_keys_shape.items(), C_shapes.items())
     C_padded = wetutil.pad_C(C)
     C_padded_shapes = {
         k: 1
         if isinstance(v, numbers.Number)
         else v.shape
         for k,v in C_padded.items()
     }
     self.assertEqual(
         3, min((min(v) for v in C_padded_shapes.values() if v != 1))
     )
     for k, v in wetutil.unpad_C(C_padded).items():
         assert_array_equal(C[k], v)
Ejemplo n.º 5
0
 def test_symmetrize(self):
     wc = get_random_wc('WET', 'JMS', 90)
     C = wetutil.wcxf2arrays_symmetrized(wc.dict)
     d = wetutil.arrays2wcxf_nonred(C)
     self.assertEqual(wc.dict, d)
Ejemplo n.º 6
0
import wilson
from wilson.test_wilson import get_random_wc
import wilson.match._smeft_old
import wilson.match.smeft_tree
from wilson.parameters import p

np.random.seed(77)

# These WCs appear quadratically in the "old" matching implementation
wc_sm = ['phiD', 'phiWB']
wc_vert = [
    k for k in wcxf.Basis['SMEFT', 'Warsaw'].all_wcs
    if 'phiq' in k or 'phil' in k or 'phiu' in k or 'phid' in k or 'phie' in k
]

_wcr = get_random_wc('SMEFT', 'Warsaw', 100, cmax=1e-8)
wc_linear = wilson.Wilson(
    {k: v
     for k, v in _wcr.dict.items() if k not in wc_sm + wc_vert}, 100, 'SMEFT',
    'Warsaw').wc
wc_quadratic = wilson.Wilson(
    {k: v
     for k, v in _wcr.dict.items() if k in wc_sm + wc_vert}, 100, 'SMEFT',
    'Warsaw').wc


class TestSMEFTWETreimpl(unittest.TestCase):
    def test_linear(self):
        """For WCs entering linearly, agreement should be numerically exact"""
        C = wilson.util.smeftutil.wcxf2arrays_symmetrized(wc_linear.dict)
        c_old = wilson.match._smeft_old.match_all_array(C, p)