~maddevelopers/mg5amcnlo/new_clustering

« back to all changes in this revision

Viewing changes to tests/unit_tests/core/test_base_objects.py

  • Committer: Rikkert Frederix
  • Date: 2021-09-09 15:51:40 UTC
  • mfrom: (78.75.502 3.2.1)
  • Revision ID: frederix@physik.uzh.ch-20210909155140-rg6umfq68h6h47cf
merge with 3.2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
################################################################################
15
15
"""Unit test library for the various base objects of the core library"""
16
16
 
 
17
from __future__ import absolute_import
17
18
import copy
18
19
import os
19
20
 
21
22
import madgraph.core.base_objects as base_objects
22
23
import madgraph.core.color_algebra as color
23
24
import tests.unit_tests as unittest
 
25
from six.moves import range
 
26
from six.moves import zip
24
27
 
25
28
#===============================================================================
26
29
# ParticleTest
1530
1533
                       'sqorders_types': {},
1531
1534
                       'has_born': True,
1532
1535
                       'overall_orders': {},
 
1536
                       'born_sq_orders': {},
1533
1537
                       'NLO_mode':'tree',
1534
1538
                       'split_orders':[]}
1535
1539
 
1618
1622
        goal = goal + "    \'perturbation_couplings\': [],\n"
1619
1623
        goal = goal + "    \'has_born\': True,\n"
1620
1624
        goal = goal + "    \'NLO_mode\': 'tree',\n"
1621
 
        goal = goal + "    \'split_orders\': []\n}"
 
1625
        goal = goal + "    \'split_orders\': [],\n"
 
1626
        goal = goal + "    \'born_sq_orders\': {}\n}"
1622
1627
 
1623
1628
        for a, b in zip(goal.split('\n'), str(self.myprocess).split('\n')):
1624
1629
            self.assertEqual(a,b)
1625
1630
        self.assertEqual(goal, str(self.myprocess))
1626
1631
 
 
1632
 
1627
1633
    def test_nice_string(self):
1628
1634
        """Test Process nice_string representation"""
1629
1635
 
1880
1886
                       'is_decay_chain': False,
1881
1887
                       'decay_chains': base_objects.ProcessList(),
1882
1888
                       'squared_orders':{},
 
1889
                       'born_sq_orders':{},
1883
1890
                       'constrained_orders':{},
1884
1891
                       'has_born': True,
1885
1892
                       'overall_orders':{},
1934
1941
                          self.my_process_definition.set,
1935
1942
                          'wrongparam', 0)
1936
1943
 
 
1944
    def test_get_process_with_legs(self):
 
1945
        """test the get_process_with_legs_function.
 
1946
        In particular, check that also the born_sq_orders are passed"""
 
1947
 
 
1948
        mydict = {'id':3,
 
1949
                      'number':5,
 
1950
                      'state':True,
 
1951
                      'from_group':False,
 
1952
                      'onshell':None,                       
 
1953
                      'loop_line':False}
 
1954
 
 
1955
        myleg = base_objects.Leg(mydict)
 
1956
 
 
1957
        mylist = [copy.copy(myleg) for dummy in range(1, 4) ]
 
1958
        myleglist = base_objects.LegList(mylist)
 
1959
        my_new_process_definition = copy.copy(self.my_process_definition)
 
1960
        my_new_process_definition['born_sq_orders'] = {'QCD':99, 'QED':99}
 
1961
        testproc = my_new_process_definition.get_process_with_legs(myleglist)
 
1962
 
 
1963
        for (k, v) in testproc.items():
 
1964
            if k not in list(self.my_process_definition.keys()): continue
 
1965
            if k != 'legs':
 
1966
                self.assertEqual(my_new_process_definition[k], testproc[k])
 
1967
            else:
 
1968
                self.assertEqual(myleglist, testproc[k])
 
1969
 
1937
1970
    def test_values_for_prop(self):
1938
1971
        """Test filters for process properties"""
1939
1972
 
2006
2039
        goal = goal + "    \'perturbation_couplings\': [],\n"
2007
2040
        goal = goal + "    \'has_born\': True,\n"
2008
2041
        goal = goal + "    \'NLO_mode\': 'tree',\n"
2009
 
        goal = goal + "    \'split_orders\': []\n}"                
 
2042
        goal = goal + "    \'split_orders\': [],\n"                
 
2043
        goal = goal + "    \'born_sq_orders\': {}\n}"                
2010
2044
        self.assertEqual(goal, str(self.my_process_definition))
2011
2045
 
2012
2046
#===============================================================================