Esempio n. 1
0
 def test_labels(self):
     # setup objs
     theory_card = {
         "alphas": 0.35,
         "PTO": 0,
         "ModEv": "TRN",
         "fact_to_ren_scale_ratio": 1.0,
         "Qref": np.sqrt(2),
         "nfref": None,
         "Q0": np.sqrt(2),
         "NfFF": 3,
         "IC": 1,
         "IB": 0,
         "mc": 1.0,
         "mb": 4.75,
         "mt": 173.0,
         "kcThr": np.inf,
         "kbThr": np.inf,
         "ktThr": np.inf,
         "MaxNfPdf": 6,
         "MaxNfAs": 6,
     }
     for skip_singlet in [True, False]:
         for skip_ns in [True, False]:
             operators_card = {
                 "Q2grid": [1, 10],
                 "interpolation_xgrid": [0.1, 1.0],
                 "interpolation_polynomial_degree": 1,
                 "interpolation_is_log": True,
                 "debug_skip_singlet": skip_singlet,
                 "debug_skip_non_singlet": skip_ns,
                 "ev_op_max_order": 1,
                 "ev_op_iterations": 1,
                 "backward_inversion": "exact",
             }
             g = OperatorGrid.from_dict(
                 theory_card,
                 operators_card,
                 ThresholdsAtlas.from_dict(theory_card),
                 StrongCoupling.from_dict(theory_card),
                 InterpolatorDispatcher.from_dict(operators_card),
             )
             o = OperatorMatrixElement(g.config, g.managers, 10)
             labels = o.labels()
             test_labels = ["NS_qq", "NS_Hq"]
             for l in test_labels:
                 if skip_ns:
                     assert l not in labels
                 else:
                     assert l in labels
             test_labels = ["S_qq", "S_Hq", "S_gg", "S_Hg", "S_gH"]
             for l in test_labels:
                 if skip_singlet:
                     assert l not in labels
                 else:
                     assert l in labels
Esempio n. 2
0
 def _get_operator_grid(self, use_FFNS=True):
     theory_card, operators_card = self._get_setup(use_FFNS)
     # create objects
     basis_function_dispatcher = interpolation.InterpolatorDispatcher.from_dict(
         operators_card)
     threshold_holder = ThresholdsAtlas.from_dict(theory_card)
     a_s = StrongCoupling.from_dict(theory_card)
     return OperatorGrid.from_dict(
         theory_card,
         operators_card,
         threshold_holder,
         a_s,
         basis_function_dispatcher,
     )
Esempio n. 3
0
 def test_from_dict(self):
     tc = ThresholdsAtlas.from_dict(
         {
             "mc": 1.0,
             "mb": 4.0,
             "mt": 100.0,
             "kcThr": 1,
             "kbThr": 2.0,
             "ktThr": np.inf,
             "Q0": 1.0,
             "MaxNfPdf": 6,
         }
     )
     assert tc.area_walls[1:-1] == [1.0, 64.0, np.inf]
     assert tc.q2_ref == 1.0
Esempio n. 4
0
 def test_sanity(self):
     """Sanity checks for the input"""
     # errors
     with pytest.raises(ValueError):
         theory_card, operators_card = self._get_setup(True)
         basis_function_dispatcher = interpolation.InterpolatorDispatcher.from_dict(
             operators_card)
         threshold_holder = ThresholdsAtlas.from_dict(theory_card)
         a_s = StrongCoupling.from_dict(theory_card)
         theory_card.update({"ModEv": "wrong"})
         OperatorGrid.from_dict(
             theory_card,
             operators_card,
             threshold_holder,
             a_s,
             basis_function_dispatcher,
         )
Esempio n. 5
0
    def test_compute(self, monkeypatch):
        # setup objs
        theory_card = {
            "alphas": 0.35,
            "PTO": 0,
            "ModEv": "TRN",
            "fact_to_ren_scale_ratio": 1.0,
            "Qref": np.sqrt(2),
            "nfref": None,
            "Q0": np.sqrt(2),
            "FNS": "FFNS",
            "NfFF": 3,
            "IC": 0,
            "IB": 0,
            "mc": 1.0,
            "mb": 4.75,
            "mt": 173.0,
            "kcThr": np.inf,
            "kbThr": np.inf,
            "ktThr": np.inf,
            "MaxNfPdf": 6,
            "MaxNfAs": 6,
        }
        operators_card = {
            "Q2grid": [1, 10],
            "interpolation_xgrid": [0.1, 1.0],
            "interpolation_polynomial_degree": 1,
            "interpolation_is_log": True,
            "debug_skip_singlet": True,
            "debug_skip_non_singlet": False,
            "ev_op_max_order": 1,
            "ev_op_iterations": 1,
            "backward_inversion": "exact",
        }
        g = OperatorGrid.from_dict(
            theory_card,
            operators_card,
            ThresholdsAtlas.from_dict(theory_card),
            StrongCoupling.from_dict(theory_card),
            InterpolatorDispatcher.from_dict(operators_card),
        )
        o = Operator(g.config, g.managers, 3, 2, 10)
        # fake quad
        monkeypatch.setattr(scipy.integrate, "quad",
                            lambda *args, **kwargs: np.random.rand(2))
        # LO
        o.compute()
        assert "NS_m" in o.op_members
        np.testing.assert_allclose(o.op_members["NS_m"].value,
                                   o.op_members["NS_p"].value)
        np.testing.assert_allclose(o.op_members["NS_v"].value,
                                   o.op_members["NS_p"].value)
        # NLO
        o.config["order"] = 1
        o.compute()
        assert not np.allclose(o.op_members["NS_p"].value,
                               o.op_members["NS_m"].value)
        np.testing.assert_allclose(o.op_members["NS_v"].value,
                                   o.op_members["NS_m"].value)

        # unity operators
        for n in range(0, 2 + 1):
            o1 = Operator(g.config, g.managers, 3, 2, 2)
            o1.config["order"] = n
            o1.compute()
            for k in br.non_singlet_labels:
                assert k in o1.op_members
                np.testing.assert_allclose(o1.op_members[k].value,
                                           np.eye(2),
                                           err_msg=k)