def test_check_u_u_six_g(self): """Test the process u u > six g against literature expression""" myleglist = base_objects.LegList() myleglist.append(base_objects.Leg({'id':2, 'state':False, 'number': 1})) myleglist.append(base_objects.Leg({'id':2, 'state':False, 'number': 2})) myleglist.append(base_objects.Leg({'id':9000006, 'state':True, 'number': 3})) myleglist.append(base_objects.Leg({'id':21, 'state':True, 'number': 4})) myproc = base_objects.Process({'legs':myleglist, 'model':self.base_model}) comparison_results, used_lorentz = \ process_checks.check_processes(myproc, quick=True) self.assertTrue(comparison_results[0]['passed'])
def test_failed_process(self): """Test that check process fails for wrong color-Lorentz.""" # Change 4g interaction so color and lorentz don't agree id = [int.get('id') for int in self.base_model.get('interactions') if [p['pdg_code'] for p in int['particles']] == [21,21,21,21]][0] gggg = self.base_model.get_interaction(id) assert [p['pdg_code'] for p in gggg['particles']] == [21,21,21,21] gggg.set('lorentz', ['VVVV1', 'VVVV4', 'VVVV3']) myleglist = base_objects.LegList() myleglist.append(base_objects.Leg({'id':21, 'state':False})) myleglist.append(base_objects.Leg({'id':21, 'state':False})) myleglist.append(base_objects.Leg({'id':21, 'state':True})) myleglist.append(base_objects.Leg({'id':21, 'state':True})) myproc = base_objects.Process({'legs':myleglist, 'model':self.base_model}) process_checks.clean_added_globals(process_checks.ADDED_GLOBAL) comparison = process_checks.check_processes(myproc)[0][0] self.assertFalse(comparison['passed']) comparison = process_checks.check_processes(myproc, quick = True)[0][0] self.assertFalse(comparison['passed']) comparison = process_checks.check_gauge(myproc) nb_fail = process_checks.output_gauge(comparison, output='fail') self.assertNotEqual(nb_fail, 0) comparison = process_checks.check_lorentz(myproc) nb_fail = process_checks.output_lorentz_inv(comparison, output='fail') self.assertNotEqual(0, nb_fail)
def test_comparison_for_multiprocess(self): """Test check process for multiprocess""" myleglist = base_objects.MultiLegList() p = [1,2,-1,-2] myleglist.append(base_objects.MultiLeg({'ids':p, 'state':False})) myleglist.append(base_objects.MultiLeg({'ids':p, 'state':False})) myleglist.append(base_objects.MultiLeg({'ids':p})) myleglist.append(base_objects.MultiLeg({'ids':p})) myproc = base_objects.ProcessDefinition({'legs':myleglist, 'model':self.base_model, 'orders':{'QED':0}}) comparisons, used_aloha = process_checks.check_processes(myproc) goal_value_len = [8, 2] for i, comparison in enumerate(comparisons): self.assertEqual(len(comparison['values']), goal_value_len[i]) self.assertTrue(comparison['passed']) comparisons = process_checks.check_lorentz(myproc) nb_fail = process_checks.output_lorentz_inv(comparisons, output='fail') self.assertEqual(0, nb_fail) #check number of helicities/jamp nb_hel = [] nb_jamp = [] for one_comp in comparisons: if one_comp['results'] != 'pass': nb_hel.append(len(one_comp['results'][0]['jamp'])) nb_jamp.append(len(one_comp['results'][0]['jamp'][0])) self.assertEqual(nb_hel, [16, 16]) self.assertEqual(nb_jamp, [2, 2]) for i, comparison in enumerate(comparisons): if i == 2: self.assertEqual(comparison['results'],'pass') continue else: nb_fail = process_checks.output_lorentz_inv([comparison], output='fail') self.assertEqual(0, nb_fail)
def test_comparison_for_multiprocess(self): """Test check process for multiprocess""" myleglist = base_objects.MultiLegList() p = [1, 2, -1, -2] myleglist.append(base_objects.MultiLeg({'ids': p, 'state': False})) myleglist.append(base_objects.MultiLeg({'ids': p, 'state': False})) myleglist.append(base_objects.MultiLeg({'ids': p})) myleglist.append(base_objects.MultiLeg({'ids': p})) myproc = base_objects.ProcessDefinition({ 'legs': myleglist, 'model': self.base_model, 'orders': { 'QED': 0 } }) process_checks.clean_added_globals(process_checks.ADDED_GLOBAL) comparisons, used_aloha = process_checks.check_processes(myproc) goal_value_len = [8, 2] for i, comparison in enumerate(comparisons): self.assertEqual(len(comparison['values']), goal_value_len[i]) self.assertTrue(comparison['passed']) comparisons = process_checks.check_lorentz(myproc) nb_fail = process_checks.output_lorentz_inv(comparisons, output='fail') self.assertEqual(0, nb_fail) #check number of helicities/jamp nb_hel = [] nb_jamp = [] for one_comp in comparisons: if one_comp['results'] != 'pass': nb_hel.append(len(one_comp['results'][0]['jamp'])) nb_jamp.append(len(one_comp['results'][0]['jamp'][0])) self.assertEqual(nb_hel, [16, 16]) self.assertEqual(nb_jamp, [2, 2]) for i, comparison in enumerate(comparisons): if i == 2: self.assertEqual(comparison['results'], 'pass') continue else: nb_fail = process_checks.output_lorentz_inv([comparison], output='fail') self.assertEqual(0, nb_fail)
def test_comparison_for_process(self): """Test check process for e+ e- > a Z""" myleglist = base_objects.LegList() myleglist.append(base_objects.Leg({'id':-11, 'state':False})) myleglist.append(base_objects.Leg({'id':11, 'state':False})) myleglist.append(base_objects.Leg({'id':22, 'state':True})) myleglist.append(base_objects.Leg({'id':23, 'state':True})) myproc = base_objects.Process({'legs':myleglist, 'model':self.base_model}) comparison = process_checks.check_processes(myproc)[0][0] self.assertEqual(len(comparison['values']), 8) self.assertTrue(comparison['values'][0] > 0) self.assertTrue(comparison['passed']) comparison = process_checks.check_gauge(myproc) #check number of helicities/jamp nb_hel = [] nb_jamp = [] for one_comp in comparison: nb_hel.append(len(one_comp['value']['jamp'])) nb_jamp.append(len(one_comp['value']['jamp'][0])) self.assertEqual(nb_hel, [24]) self.assertEqual(nb_jamp, [1]) nb_fail = process_checks.output_gauge(comparison, output='fail') self.assertEqual(nb_fail, 0) comparison = process_checks.check_lorentz(myproc) #check number of helicities/jamp nb_hel = [] nb_jamp = [] for one_comp in comparison: nb_hel.append(len(one_comp['results'][0]['jamp'])) nb_jamp.append(len(one_comp['results'][0]['jamp'][0])) self.assertEqual(nb_hel, [24]) self.assertEqual(nb_jamp, [1]) nb_fail = process_checks.output_lorentz_inv(comparison, output='fail') self.assertEqual(0, nb_fail)
def test_comparison_for_process(self): """Test check process for e+ e- > a Z""" myleglist = base_objects.LegList() myleglist.append(base_objects.Leg({'id':-11, 'state':False})) myleglist.append(base_objects.Leg({'id':11, 'state':False})) myleglist.append(base_objects.Leg({'id':22, 'state':True})) myleglist.append(base_objects.Leg({'id':23, 'state':True})) myproc = base_objects.Process({'legs':myleglist, 'model':self.base_model}) process_checks.clean_added_globals(process_checks.ADDED_GLOBAL) comparison = process_checks.check_processes(myproc)[0][0] self.assertEqual(len(comparison['values']), 8) self.assertTrue(comparison['values'][0] > 0) self.assertTrue(comparison['passed']) comparison = process_checks.check_gauge(myproc) #check number of helicities/jamp nb_hel = [] nb_jamp = [] for one_comp in comparison: nb_hel.append(len(one_comp['value']['jamp'])) nb_jamp.append(len(one_comp['value']['jamp'][0])) self.assertEqual(nb_hel, [24]) self.assertEqual(nb_jamp, [1]) nb_fail = process_checks.output_gauge(comparison, output='fail') self.assertEqual(nb_fail, 0) comparison = process_checks.check_lorentz(myproc) #check number of helicities/jamp nb_hel = [] nb_jamp = [] for one_comp in comparison: nb_hel.append(len(one_comp['results'][0]['jamp'])) nb_jamp.append(len(one_comp['results'][0]['jamp'][0])) self.assertEqual(nb_hel, [24]) self.assertEqual(nb_jamp, [1]) nb_fail = process_checks.output_lorentz_inv(comparison, output='fail') self.assertEqual(0, nb_fail)
def test_check_u_u_six_g(self): """Test the process u u > six g against literature expression""" myleglist = base_objects.LegList() myleglist.append(base_objects.Leg({"id": 2, "state": False, "number": 1})) myleglist.append(base_objects.Leg({"id": 2, "state": False, "number": 2})) myleglist.append(base_objects.Leg({"id": 9000006, "state": True, "number": 3})) myleglist.append(base_objects.Leg({"id": 21, "state": True, "number": 4})) myproc = base_objects.Process({"legs": myleglist, "model": self.base_model}) comparison_results, used_lorentz = process_checks.check_processes(myproc, quick=True) self.assertTrue(comparison_results[0]["passed"])
def test_failed_process(self): """Test that check process fails for wrong color-Lorentz.""" # Change 4g interaction so color and lorentz don't agree gggg = self.base_model.get_interaction(3) gggg.set('lorentz', ['VVVV1', 'VVVV4', 'VVVV3']) myleglist = base_objects.LegList() myleglist.append(base_objects.Leg({'id':21, 'state':False})) myleglist.append(base_objects.Leg({'id':21, 'state':False})) myleglist.append(base_objects.Leg({'id':21, 'state':True})) myleglist.append(base_objects.Leg({'id':21, 'state':True})) myproc = base_objects.Process({'legs':myleglist, 'model':self.base_model}) comparison = process_checks.check_processes(myproc)[0][0] self.assertFalse(comparison['passed']) comparison = process_checks.check_processes(myproc, quick = True)[0][0] self.assertFalse(comparison['passed']) comparison = process_checks.check_gauge(myproc) nb_fail = process_checks.output_gauge(comparison, output='fail') self.assertNotEqual(nb_fail, 0) comparison = process_checks.check_lorentz(myproc) nb_fail = process_checks.output_lorentz_inv(comparison, output='fail') self.assertNotEqual(0, nb_fail)