Module flavio.physics.kdecays.test_kpilnu
Classes
class TestKpilnu (methodName='runTest')-
Expand source code
class TestKpilnu(unittest.TestCase): def test_kpilnu(self): # test for errors q2=0.05 flavio.physics.kdecays.kpilnu.get_ff(q2, par, 'KL') flavio.physics.kdecays.kpilnu.get_ff(q2, par, 'K+') flavio.physics.kdecays.kpilnu.get_angularcoeff(q2, wc_obj, par, 'KL', 'pi+', 'e') flavio.physics.kdecays.kpilnu.get_angularcoeff(q2, wc_obj, par, 'KL', 'pi+', 'mu') flavio.physics.kdecays.kpilnu.get_angularcoeff(q2, wc_obj, par, 'K+', 'pi0', 'e') flavio.physics.kdecays.kpilnu.get_angularcoeff(q2, wc_obj, par, 'K+', 'pi0', 'mu') # unphysical q2 self.assertEqual(flavio.physics.kdecays.kpilnu.dBRdq2(0, wc_obj, par, 'KL', 'pi+', 'e'), 0) self.assertEqual(flavio.physics.kdecays.kpilnu.dBRdq2(0.01, wc_obj, par, 'K+', 'pi0', 'mu'), 0) self.assertEqual(flavio.physics.kdecays.kpilnu.dBRdq2(2, wc_obj, par, 'K+', 'pi0', 'e'), 0) self.assertEqual(flavio.physics.kdecays.kpilnu.dBRdq2(1.5, wc_obj, par, 'KL', 'pi+', 'mu'), 0) self.assertEqual(flavio.physics.kdecays.kpilnu.dBRdq2(0.1, wc_obj, par, 'KL', 'pi+', 'tau'), 0) # compare central predictions to PDG values self.assertAlmostEqual(flavio.sm_prediction('BR(KL->pienu)')*1e2/40.55, 1, delta=0.04) self.assertAlmostEqual(flavio.sm_prediction('BR(K+->pienu)')*1e2/5.07, 1, delta=0.04) self.assertAlmostEqual(flavio.sm_prediction('BR(KL->pimunu)')*1e2/27.04, 1, delta=0.02) self.assertAlmostEqual(flavio.sm_prediction('BR(K+->pimunu)')*1e2/3.352, 1, delta=0.03) def test_kpilnu_nu(self): wc_sm = flavio.WilsonCoefficients() wc_np_mu = flavio.WilsonCoefficients() wc_np_mu.set_initial({'CVL_sumunumu': 1}, 4.8) wc_np_e = flavio.WilsonCoefficients() wc_np_e.set_initial({'CVL_sumunue': 1}, 4.8) obs = flavio.Observable["BR(K+->pimunu)"] br_sm = obs.prediction_central(constraints, wc_sm) br_mu = obs.prediction_central(constraints, wc_np_mu) br_e = obs.prediction_central(constraints, wc_np_e) # with interference: (1 + 1)^2 = 4 self.assertAlmostEqual(br_mu/br_sm, 4, delta=0.06) # without interference: 1 + 1 = 2 self.assertAlmostEqual(br_e/br_sm, 2, delta=0.03) def test_logC(self): # SM: prediction = input self.assertAlmostEqual(flavio.sm_prediction('lnC(K->pimunu)'), par['K->pi ln(C)'], delta=0.0001) def test_RT(self): self.assertEqual(flavio.sm_prediction('RT(K->pimunu)'), 0) wc = flavio.WilsonCoefficients() wc.set_initial({'CT_sumunumu': 1}, par['m_rho0']) self.assertEqual(flavio.np_prediction('RT(K->pienu)', wc), 0) self.assertNotEqual(flavio.np_prediction('RT(K->pimunu)', wc), 0)A class whose instances are single test cases.
By default, the test code itself should be placed in a method named 'runTest'.
If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.
Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test's environment ('fixture') can be implemented by overriding the 'setUp' and 'tearDown' methods respectively.
If it is necessary to override the init method, the base class init method must always be called. It is important that subclasses should not change the signature of their init method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.
When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when the instance's assertion methods fail; test methods raising this exception will be deemed to have 'failed' rather than 'errored'. * longMessage: determines whether long messages (including repr of objects used in assert methods) will be printed on failure in addition to any explicit message passed. * maxDiff: sets the maximum length of a diff in failure messages by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
Ancestors
- unittest.case.TestCase
Methods
def test_RT(self)-
Expand source code
def test_RT(self): self.assertEqual(flavio.sm_prediction('RT(K->pimunu)'), 0) wc = flavio.WilsonCoefficients() wc.set_initial({'CT_sumunumu': 1}, par['m_rho0']) self.assertEqual(flavio.np_prediction('RT(K->pienu)', wc), 0) self.assertNotEqual(flavio.np_prediction('RT(K->pimunu)', wc), 0) def test_kpilnu(self)-
Expand source code
def test_kpilnu(self): # test for errors q2=0.05 flavio.physics.kdecays.kpilnu.get_ff(q2, par, 'KL') flavio.physics.kdecays.kpilnu.get_ff(q2, par, 'K+') flavio.physics.kdecays.kpilnu.get_angularcoeff(q2, wc_obj, par, 'KL', 'pi+', 'e') flavio.physics.kdecays.kpilnu.get_angularcoeff(q2, wc_obj, par, 'KL', 'pi+', 'mu') flavio.physics.kdecays.kpilnu.get_angularcoeff(q2, wc_obj, par, 'K+', 'pi0', 'e') flavio.physics.kdecays.kpilnu.get_angularcoeff(q2, wc_obj, par, 'K+', 'pi0', 'mu') # unphysical q2 self.assertEqual(flavio.physics.kdecays.kpilnu.dBRdq2(0, wc_obj, par, 'KL', 'pi+', 'e'), 0) self.assertEqual(flavio.physics.kdecays.kpilnu.dBRdq2(0.01, wc_obj, par, 'K+', 'pi0', 'mu'), 0) self.assertEqual(flavio.physics.kdecays.kpilnu.dBRdq2(2, wc_obj, par, 'K+', 'pi0', 'e'), 0) self.assertEqual(flavio.physics.kdecays.kpilnu.dBRdq2(1.5, wc_obj, par, 'KL', 'pi+', 'mu'), 0) self.assertEqual(flavio.physics.kdecays.kpilnu.dBRdq2(0.1, wc_obj, par, 'KL', 'pi+', 'tau'), 0) # compare central predictions to PDG values self.assertAlmostEqual(flavio.sm_prediction('BR(KL->pienu)')*1e2/40.55, 1, delta=0.04) self.assertAlmostEqual(flavio.sm_prediction('BR(K+->pienu)')*1e2/5.07, 1, delta=0.04) self.assertAlmostEqual(flavio.sm_prediction('BR(KL->pimunu)')*1e2/27.04, 1, delta=0.02) self.assertAlmostEqual(flavio.sm_prediction('BR(K+->pimunu)')*1e2/3.352, 1, delta=0.03) def test_kpilnu_nu(self)-
Expand source code
def test_kpilnu_nu(self): wc_sm = flavio.WilsonCoefficients() wc_np_mu = flavio.WilsonCoefficients() wc_np_mu.set_initial({'CVL_sumunumu': 1}, 4.8) wc_np_e = flavio.WilsonCoefficients() wc_np_e.set_initial({'CVL_sumunue': 1}, 4.8) obs = flavio.Observable["BR(K+->pimunu)"] br_sm = obs.prediction_central(constraints, wc_sm) br_mu = obs.prediction_central(constraints, wc_np_mu) br_e = obs.prediction_central(constraints, wc_np_e) # with interference: (1 + 1)^2 = 4 self.assertAlmostEqual(br_mu/br_sm, 4, delta=0.06) # without interference: 1 + 1 = 2 self.assertAlmostEqual(br_e/br_sm, 2, delta=0.03) def test_logC(self)-
Expand source code
def test_logC(self): # SM: prediction = input self.assertAlmostEqual(flavio.sm_prediction('lnC(K->pimunu)'), par['K->pi ln(C)'], delta=0.0001)