Module flavio.physics.bdecays.formfactors.b_v.test_btov
Classes
class TestBtoV (methodName='runTest')-
Expand source code
class TestBtoV(unittest.TestCase): def test_cln(self): c = copy.deepcopy(default_parameters) par = c.get_central_all() cln.ff('B->D*', 1, par, 4.8) Implementation['B->D* CLN'].get_central(constraints_obj=c, wc_obj=None, q2=1) ff0 = Implementation['B->D* CLN'].get_central(constraints_obj=c, wc_obj=None, q2=0) mB = par['m_B0'] mV = par['m_D*+'] # check that exact kinematic relation at q^2=0 is fulfilled self.assertAlmostEqual(ff0['A0'], 8*mB*mV/(mB**2-mV**2)*ff0['A12'], places=12) def test_bsz3(self): c = copy.deepcopy(default_parameters) bsz_parameters.bsz_load_v1_lcsr(c) # compare to numbers in table 4 of arXiv:1503.05534v1 # B->K* all FFs ffbsz3 = Implementation['B->K* BSZ3'].get_central(constraints_obj=c, wc_obj=None, q2=0) self.assertAlmostEqual(ffbsz3['A0'], 0.391, places=2) self.assertAlmostEqual(ffbsz3['A1'], 0.289, places=3) self.assertAlmostEqual(ffbsz3['A12'], 0.281, places=1) self.assertAlmostEqual(ffbsz3['V'], 0.366, places=3) self.assertAlmostEqual(ffbsz3['T1'], 0.308, places=3) self.assertAlmostEqual(ffbsz3['T23'], 0.793, places=3) self.assertAlmostEqual(ffbsz3['T1'], ffbsz3['T2'], places=16) # A1 for the remaining transitions ffbsz3 = Implementation['B->rho BSZ3'].get_central(constraints_obj=c, wc_obj=None, q2=0) self.assertAlmostEqual(ffbsz3['A1'], 0.267, places=3) ffbsz3 = Implementation['B->omega BSZ3'].get_central(constraints_obj=c, wc_obj=None, q2=0) self.assertAlmostEqual(ffbsz3['A1'], 0.237, places=3) ffbsz3 = Implementation['Bs->phi BSZ3'].get_central(constraints_obj=c, wc_obj=None, q2=0) self.assertAlmostEqual(ffbsz3['A1'], 0.315, places=3) ffbsz3 = Implementation['Bs->K* BSZ3'].get_central(constraints_obj=c, wc_obj=None, q2=0) self.assertAlmostEqual(ffbsz3['A1'], 0.246, places=3) def test_gkvd(self): # compare to numbers of arXiv:1811.00983 c = copy.deepcopy(default_parameters) for q2 in [1.5, 6]: for ff in ['A0', 'A1', 'A12', 'V', 'T1', 'T2', 'T23']: for V in ['K*', 'D*', 'rho']: fit = 'LCSR' if V == 'rho' else 'LCSR-Lattice' bsz_parameters.gkvd_load('v1', fit, ('B->{}'.format(V),), c) ffbsz3 = Implementation['B->{} BSZ3'.format(V)].get_central(constraints_obj=c, wc_obj=None, q2=q2) self.assertAlmostEqual(ffbsz3[ff] / test_eos_ff[V][q2][ff], 1, places=2, msg="Failed for {} in B->{} at q2={}".format(ff, V, q2)) def test_lattice(self): c = copy.deepcopy(default_parameters) lattice_parameters.lattice_load(c) fflatt = Implementation['B->K* SSE'].get_central(constraints_obj=c, wc_obj=None, q2=12.) self.assertAlmostEqual(fflatt['V'], 0.84, places=2) self.assertAlmostEqual(fflatt['A0'], 0.861, places=3) self.assertAlmostEqual(fflatt['A1'], 0.440, places=3) self.assertAlmostEqual(fflatt['A12'], 0.339, places=3) self.assertAlmostEqual(fflatt['T1'], 0.711, places=3) self.assertAlmostEqual(fflatt['T2'], 0.433, places=3) self.assertAlmostEqual(fflatt['T23'], 0.809, places=3) fflatt = Implementation['Bs->phi SSE'].get_central(constraints_obj=c, wc_obj=None, q2=12.) self.assertAlmostEqual(fflatt['V'], 0.767, places=2) self.assertAlmostEqual(fflatt['A0'], 0.907, places=2) self.assertAlmostEqual(fflatt['A1'], 0.439, places=2) self.assertAlmostEqual(fflatt['A12'], 0.321, places=2) self.assertAlmostEqual(fflatt['T1'], 0.680, places=2) self.assertAlmostEqual(fflatt['T2'], 0.439, places=2) self.assertAlmostEqual(fflatt['T23'], 0.810, places=2) fflatt = Implementation['Bs->K* SSE'].get_central(constraints_obj=c, wc_obj=None, q2=12.) self.assertAlmostEqual(fflatt['V'], 0.584, places=3) self.assertAlmostEqual(fflatt['A0'], 0.884, places=3) self.assertAlmostEqual(fflatt['A1'], 0.370, places=3) self.assertAlmostEqual(fflatt['A12'], 0.321, places=3) self.assertAlmostEqual(fflatt['T1'], 0.605, places=3) self.assertAlmostEqual(fflatt['T2'], 0.383, places=3) self.assertAlmostEqual(fflatt['T23'], 0.743, places=3)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_bsz3(self)-
Expand source code
def test_bsz3(self): c = copy.deepcopy(default_parameters) bsz_parameters.bsz_load_v1_lcsr(c) # compare to numbers in table 4 of arXiv:1503.05534v1 # B->K* all FFs ffbsz3 = Implementation['B->K* BSZ3'].get_central(constraints_obj=c, wc_obj=None, q2=0) self.assertAlmostEqual(ffbsz3['A0'], 0.391, places=2) self.assertAlmostEqual(ffbsz3['A1'], 0.289, places=3) self.assertAlmostEqual(ffbsz3['A12'], 0.281, places=1) self.assertAlmostEqual(ffbsz3['V'], 0.366, places=3) self.assertAlmostEqual(ffbsz3['T1'], 0.308, places=3) self.assertAlmostEqual(ffbsz3['T23'], 0.793, places=3) self.assertAlmostEqual(ffbsz3['T1'], ffbsz3['T2'], places=16) # A1 for the remaining transitions ffbsz3 = Implementation['B->rho BSZ3'].get_central(constraints_obj=c, wc_obj=None, q2=0) self.assertAlmostEqual(ffbsz3['A1'], 0.267, places=3) ffbsz3 = Implementation['B->omega BSZ3'].get_central(constraints_obj=c, wc_obj=None, q2=0) self.assertAlmostEqual(ffbsz3['A1'], 0.237, places=3) ffbsz3 = Implementation['Bs->phi BSZ3'].get_central(constraints_obj=c, wc_obj=None, q2=0) self.assertAlmostEqual(ffbsz3['A1'], 0.315, places=3) ffbsz3 = Implementation['Bs->K* BSZ3'].get_central(constraints_obj=c, wc_obj=None, q2=0) self.assertAlmostEqual(ffbsz3['A1'], 0.246, places=3) def test_cln(self)-
Expand source code
def test_cln(self): c = copy.deepcopy(default_parameters) par = c.get_central_all() cln.ff('B->D*', 1, par, 4.8) Implementation['B->D* CLN'].get_central(constraints_obj=c, wc_obj=None, q2=1) ff0 = Implementation['B->D* CLN'].get_central(constraints_obj=c, wc_obj=None, q2=0) mB = par['m_B0'] mV = par['m_D*+'] # check that exact kinematic relation at q^2=0 is fulfilled self.assertAlmostEqual(ff0['A0'], 8*mB*mV/(mB**2-mV**2)*ff0['A12'], places=12) def test_gkvd(self)-
Expand source code
def test_gkvd(self): # compare to numbers of arXiv:1811.00983 c = copy.deepcopy(default_parameters) for q2 in [1.5, 6]: for ff in ['A0', 'A1', 'A12', 'V', 'T1', 'T2', 'T23']: for V in ['K*', 'D*', 'rho']: fit = 'LCSR' if V == 'rho' else 'LCSR-Lattice' bsz_parameters.gkvd_load('v1', fit, ('B->{}'.format(V),), c) ffbsz3 = Implementation['B->{} BSZ3'.format(V)].get_central(constraints_obj=c, wc_obj=None, q2=q2) self.assertAlmostEqual(ffbsz3[ff] / test_eos_ff[V][q2][ff], 1, places=2, msg="Failed for {} in B->{} at q2={}".format(ff, V, q2)) def test_lattice(self)-
Expand source code
def test_lattice(self): c = copy.deepcopy(default_parameters) lattice_parameters.lattice_load(c) fflatt = Implementation['B->K* SSE'].get_central(constraints_obj=c, wc_obj=None, q2=12.) self.assertAlmostEqual(fflatt['V'], 0.84, places=2) self.assertAlmostEqual(fflatt['A0'], 0.861, places=3) self.assertAlmostEqual(fflatt['A1'], 0.440, places=3) self.assertAlmostEqual(fflatt['A12'], 0.339, places=3) self.assertAlmostEqual(fflatt['T1'], 0.711, places=3) self.assertAlmostEqual(fflatt['T2'], 0.433, places=3) self.assertAlmostEqual(fflatt['T23'], 0.809, places=3) fflatt = Implementation['Bs->phi SSE'].get_central(constraints_obj=c, wc_obj=None, q2=12.) self.assertAlmostEqual(fflatt['V'], 0.767, places=2) self.assertAlmostEqual(fflatt['A0'], 0.907, places=2) self.assertAlmostEqual(fflatt['A1'], 0.439, places=2) self.assertAlmostEqual(fflatt['A12'], 0.321, places=2) self.assertAlmostEqual(fflatt['T1'], 0.680, places=2) self.assertAlmostEqual(fflatt['T2'], 0.439, places=2) self.assertAlmostEqual(fflatt['T23'], 0.810, places=2) fflatt = Implementation['Bs->K* SSE'].get_central(constraints_obj=c, wc_obj=None, q2=12.) self.assertAlmostEqual(fflatt['V'], 0.584, places=3) self.assertAlmostEqual(fflatt['A0'], 0.884, places=3) self.assertAlmostEqual(fflatt['A1'], 0.370, places=3) self.assertAlmostEqual(fflatt['A12'], 0.321, places=3) self.assertAlmostEqual(fflatt['T1'], 0.605, places=3) self.assertAlmostEqual(fflatt['T2'], 0.383, places=3) self.assertAlmostEqual(fflatt['T23'], 0.743, places=3)
class TestCLN2 (methodName='runTest')-
Expand source code
class TestCLN2(unittest.TestCase): @classmethod def setUpClass(cls): cls.c = default_parameters.copy() cls.imp = Implementation['B->D* CLN'] def test_q2_1(self): ff = self.__class__.imp.get_central(constraints_obj=self.__class__.c, wc_obj=None, q2=1) for k, v in ff.items(): self.assertTrue(v > 0, msg="Failed for {}".format(k)) def test_q2_0_A(self): ff = self.__class__.imp.get_central(constraints_obj=self.__class__.c, wc_obj=None, q2=0) for k, v in ff.items(): self.assertTrue(v > 0, msg="Failed for {}".format(k)) par = self.__class__.c.get_central_all() mB = par['m_B0'] mV = par['m_D*+'] # check that exact kinematic relation at q^2=0 is fulfilled self.assertAlmostEqual(ff['A0'], 8*mB*mV/(mB**2-mV**2)*ff['A12'], places=10) def test_q2_0_T(self): ff = self.__class__.imp.get_central(constraints_obj=self.__class__.c, wc_obj=None, q2=0) par = self.__class__.c.get_central_all() mB = par['m_B0'] mV = par['m_D*+'] # check that exact kinematic relation at q^2=0 is fulfilled self.assertEqual(ff['T1'], ff['T2']) ff = self.__class__.imp.get_central(constraints_obj=self.__class__.c, wc_obj=None, q2=(mB-mV)**2)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
Static methods
def setUpClass()-
Hook method for setting up class fixture before running tests in the class.
Methods
def test_q2_0_A(self)-
Expand source code
def test_q2_0_A(self): ff = self.__class__.imp.get_central(constraints_obj=self.__class__.c, wc_obj=None, q2=0) for k, v in ff.items(): self.assertTrue(v > 0, msg="Failed for {}".format(k)) par = self.__class__.c.get_central_all() mB = par['m_B0'] mV = par['m_D*+'] # check that exact kinematic relation at q^2=0 is fulfilled self.assertAlmostEqual(ff['A0'], 8*mB*mV/(mB**2-mV**2)*ff['A12'], places=10) def test_q2_0_T(self)-
Expand source code
def test_q2_0_T(self): ff = self.__class__.imp.get_central(constraints_obj=self.__class__.c, wc_obj=None, q2=0) par = self.__class__.c.get_central_all() mB = par['m_B0'] mV = par['m_D*+'] # check that exact kinematic relation at q^2=0 is fulfilled self.assertEqual(ff['T1'], ff['T2']) ff = self.__class__.imp.get_central(constraints_obj=self.__class__.c, wc_obj=None, q2=(mB-mV)**2) def test_q2_1(self)-
Expand source code
def test_q2_1(self): ff = self.__class__.imp.get_central(constraints_obj=self.__class__.c, wc_obj=None, q2=1) for k, v in ff.items(): self.assertTrue(v > 0, msg="Failed for {}".format(k))