当前位置: 首页>>代码示例>>Python>>正文


Python import_ufo.import_model函数代码示例

本文整理汇总了Python中models.import_ufo.import_model函数的典型用法代码示例。如果您正苦于以下问题:Python import_model函数的具体用法?Python import_model怎么用?Python import_model使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了import_model函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_model_name

 def test_model_name(self):
     """ test that the model name is correctly set """
     self.assertEqual(self.base_model["name"], "sm")
     model = import_ufo.import_model('sm-full') 
     self.assertEqual(model["name"], "sm-full")
     model = import_ufo.import_model('sm-no_b_mass') 
     self.assertEqual(model["name"], "sm-no_b_mass")        
开发者ID:cesarotti,项目名称:MMAPS,代码行数:7,代码来源:test_import_ufo.py

示例2: test_simple_import

 def test_simple_import(self):
     """ check that basic quantity are define """
     
     #remove pkl file
     try:
         model_path = os.path.join(MG5DIR, 'models', 'sm')
         os.remove(os.path.join(model_path,'model.pkl'))
     except:
         pass
     
     import_ufo._import_once = []
     sm_path = import_ufo.find_ufo_path('sm')
     model = import_ufo.import_model(sm_path)
 
     self.assertNotEqual(model.get('particles'),None)
     self.assertNotEqual(model.get('particles'),[], "empty particles list")
 
     self.assertNotEqual(model.get('interactions'),None)
     self.assertNotEqual(model.get('interactions'),[])    
     
     
     # try with the pickle:
     sm_path = import_ufo.find_ufo_path('sm')
     model = import_ufo.import_model(sm_path)
 
     self.assertNotEqual(model.get('particles'),None)
     self.assertNotEqual(model.get('particles'),[], "empty particles list")
 
     self.assertNotEqual(model.get('interactions'),None)
     self.assertNotEqual(model.get('interactions'),[])            
开发者ID:harrypuuter,项目名称:tp1,代码行数:30,代码来源:test_link_to_ufo.py

示例3: setUp

 def setUp(self):
     self.base_model_scalar = import_ufo.import_model('uutt_tch_scalar')
     self.full_model_scalar = \
                            model_reader.ModelReader(self.base_model_scalar)
     self.full_model_scalar.set_parameters_and_couplings()
     
     self.base_model_4ferm = import_ufo.import_model('uutt_tch_4fermion')
     self.full_model_4ferm = \
                            model_reader.ModelReader(self.base_model_4ferm)
     self.full_model_4ferm.set_parameters_and_couplings()
开发者ID:harrypuuter,项目名称:tp1,代码行数:10,代码来源:test_4fermion_models.py

示例4: setUp

 def setUp(self):
     self.base_model_scalar = import_ufo.import_model('sextet_diquarks')
     self.full_model_scalar = \
                            model_reader.ModelReader(self.base_model_scalar)
     self.full_model_scalar.set_parameters_and_couplings()
     self.full_model_scalar.get('parameter_dict')['mdl_MSIX'] = 1.e5
     
     self.base_model_4ferm = import_ufo.import_model('uutt_sch_4fermion')
     self.full_model_4ferm = \
                            model_reader.ModelReader(self.base_model_4ferm)
     self.full_model_4ferm.set_parameters_and_couplings()
开发者ID:bendavid,项目名称:MadGraph5_aMC-NLO,代码行数:11,代码来源:test_4fermion_models.py

示例5: test_mssm_equivalence

    def test_mssm_equivalence(self):
        """Test the UFO and MG4 MSSM model correspond to the same model """
        
        # import UFO model
        sm_path = import_ufo.find_ufo_path('mssm')
        ufo_model = import_ufo.import_model(sm_path)
        #converter = import_ufo.UFOMG5Converter(model)
        #ufo_model = converter.load_model()
        ufo_model.pass_particles_name_in_mg_default()
        
        # import MG4 model
        model = base_objects.Model()
        if not MG4DIR:
            raise MadGraph5Error, "Please provide a valid MG/ME path with -d"
        v4_path = os.path.join(MG4DIR, 'models', 'mssm_v4')
        if not os.path.isdir(v4_path):
            v4_path = os.path.join(MG4DIR, 'Models', 'mssm')
            if not os.path.isdir(v4_path):
                raise MadGraph5Error, \
                      "Please provide a valid MG/ME path with -d"

        model.set('particles', files.read_from_file(
               os.path.join(v4_path,'particles.dat'),
               import_v4.read_particles_v4))
        model.set('interactions', files.read_from_file(
            os.path.join(v4_path,'interactions.dat'),
            import_v4.read_interactions_v4,
            model['particles']))
        
        model.pass_particles_name_in_mg_default()
        # Checking the particles
        for particle in model['particles']:
            ufo_particle = ufo_model.get("particle_dict")[particle['pdg_code']]
            self.check_particles(particle, ufo_particle)

        # Skip test below until equivalence has been created by Benj and Claude
        return

        
        # Checking the interactions
        nb_vertex = 0
        ufo_vertices = []
        for ufo_vertex in ufo_model['interactions']:
            pdg_code_ufo = [abs(part['pdg_code']) for part in ufo_vertex['particles']]
            int_name = [part['name'] for part in ufo_vertex['particles']]
            rep = (pdg_code_ufo, int_name)
            pdg_code_ufo.sort()
            ufo_vertices.append(pdg_code_ufo)
        mg4_vertices = []
        for vertex in model['interactions']:
            pdg_code_mg4 = [abs(part['pdg_code']) for part in vertex['particles']]
            pdg_code_mg4.sort()

            try:
                ufo_vertices.remove(pdg_code_mg4)
            except ValueError:
                mg4_vertices.append(pdg_code_mg4)

        self.assertEqual(ufo_vertices, [])  
        self.assertEqual(mg4_vertices, [])  
开发者ID:harrypuuter,项目名称:tp1,代码行数:60,代码来源:test_model_equivalence.py

示例6: load_model

    def load_model(self, name, use_mg_default, complex_mass=False):
        """load the model"""
        
        
        loop = False
        #if (name.startswith('loop_')):
        #    logger.info("The model in the banner is %s" % name)
        #    logger.info("Set the model to %s since only" % name[:5])
        #    logger.info("tree-level amplitudes are used for the decay ")
        #    name = name[5:]
        #    self.banner.proc_card.info['full_model_line'].replace('loop_','')

        logger.info('detected model: %s. Loading...' % name)
        model_path = name
        #base_model = import_ufo.import_model(model_path)

        # Import model
        base_model = import_ufo.import_model(name, decay=True,
                                               complex_mass_scheme=complex_mass)

        if use_mg_default:
            base_model.pass_particles_name_in_mg_default()
        
        self.model = base_model
        self.mg5cmd._curr_model = self.model
        self.mg5cmd.process_model()
开发者ID:liu0604,项目名称:MG5_aMC,代码行数:26,代码来源:interface_madspin.py

示例7: setUp

 def setUp(self):
     m_path = import_ufo.find_ufo_path("triplet_diquarks")
     self.base_model = import_ufo.import_model(m_path)
     self.full_model = model_reader.ModelReader(self.base_model)
     self.full_model.set_parameters_and_couplings()
     # Set top quark mass to 0 to compare with literature expression
     self.full_model.get("parameter_dict")["MT"] = 0.0
     self.full_model.get("parameter_dict")["WT"] = 0.0
开发者ID:harrypuuter,项目名称:tp1,代码行数:8,代码来源:test_diquark_models.py

示例8: setUp

 def setUp(self):
     m_path = import_ufo.find_ufo_path('triplet_diquarks')
     self.base_model = import_ufo.import_model(m_path)
     self.full_model = model_reader.ModelReader(self.base_model)
     self.full_model.set_parameters_and_couplings()
     # Set top quark mass to 0 to compare with literature expression
     self.full_model.get('parameter_dict')['mdl_MT'] = 0.
     self.full_model.get('parameter_dict')['mdl_WT'] = 0.
开发者ID:cesarotti,项目名称:MMAPS,代码行数:8,代码来源:test_diquark_models.py

示例9: load_IOTestsUnit

    def load_IOTestsUnit(self):
        """load the models and exporters if necessary."""
            
        if not hasattr(self, 'models') or \
           not hasattr(self, 'fortran_models') or \
           not hasattr(self, 'loop_exporters'):\
           
            self.models = { \
                'loop_sm' : import_ufo.import_model('loop_sm') 
                          }
            self.fortran_models = {
                'fortran_model' : helas_call_writers.FortranUFOHelasCallWriter(\
                                                         self.models['loop_sm']) 
                                  }
            
            self.loop_exporters = {
                'default' : loop_exporters.LoopProcessExporterFortranSA(\
                                  _mgme_file_path, _proc_file_path,
                                  {'clean':False, 'complex_mass':False, 
                                   'export_format':'madloop','mp':True,
                                   'loop_dir':_loop_file_path,
                                   'cuttools_dir':_cuttools_file_path,
                                   'fortran_compiler':'gfortran',
                                   'output_dependencies':'external'}),
                'optimized' : loop_exporters.\
                                  LoopProcessOptimizedExporterFortranSA(\
                                  _mgme_file_path, _proc_file_path,
                                  {'clean':False, 'complex_mass':False, 
                                   'export_format':'madloop','mp':True,
                                   'loop_dir':_loop_file_path,
                                   'cuttools_dir':_cuttools_file_path,
                                   'fortran_compiler':'gfortran',
                                   'output_dependencies':'external'})
                                  }
            
            # g g > t t~
            self.addIOTestsForProcess( testName = 'gg_ttx',
                                       testFolder = 'short_ML_SMQCD',
                                       particles_ids = [21,21,6,-6],
                                       exporters = self.loop_exporters,
                                       orders = {'QCD':2,'QED':0} )

            # d d > t t~ (only the proc files for this one)
            self.addIOTestsForProcess( testName = 'ddx_ttx',
                                       testFolder = 'short_ML_SMQCD',
                                       particles_ids = [1,-1,6,-6],
                                       exporters = self.loop_exporters,
                                       orders = {'QCD':2,'QED':0},
                                       files_to_check=IOTests.IOTest.proc_files)

            # And the loop induced g g > h h for good measure 
            # Use only one exporter only here
            self.addIOTestsForProcess( testName = 'gg_hh',
                                       testFolder = 'short_ML_SMQCD_LoopInduced',
                                       particles_ids = [21,21,25,25],
                                       exporters = self.loop_exporters['default'],
                                       orders = {'QCD': 2, 'QED': 2} )
开发者ID:cesarotti,项目名称:MMAPS,代码行数:57,代码来源:test_loop_exporters.py

示例10: setUp

    def setUp(self):
        """ prepare a model and the ParamCardWriter"""

        # load the SM
        self.model = import_ufo.import_model('sm')
        # initialize the main object 
        self.writter = writter.ParamCardWriter(self.model)
        self.content = StringIO.StringIO()
        self.writter.define_output_file(self.content)
        self.content.truncate(0) # remove the header
开发者ID:cirslinger,项目名称:Rutgers,代码行数:10,代码来源:test_write_param.py

示例11: __init__

 def __init__(self, model):
     
     self.model = model
     self.cmd = cmd_interface.MasterCmd()
     self.cmd.exec_cmd('set automatic_html_opening False')
     self.cmd.exec_cmd('import model %s --modelname' % model)
     self.cmd._curr_model = import_ufo.import_model(model, decay=True)
     
     self.particles_id = dict([(p.get('name'), p.get('pdg_code'))
                             for p in self.cmd._curr_model.get('particles')])
开发者ID:bendavid,项目名称:MadGraph5_aMC-NLO,代码行数:10,代码来源:decay_comparator.py

示例12: setUp

    def setUp(self):
        if not hasattr(self, 'mymodel') or \
           not hasattr(self, 'myleglist3') or \
           not hasattr(self, 'myproc1') or \
           not hasattr(self, 'myproc3'):

            myleglist1 = MG.LegList()
            # PROCESS: u g > u g 
            mylegs = [{'id': 2, 'number': 1, 'state': False},
                      {'id': 21, 'number': 2, 'state': False},
                      {'id': 2, 'number': 3, 'state': True},
                      {'id': 21, 'number': 4, 'state': True}]
            for i in mylegs:
                myleglist1.append(MG.Leg(i))
                
            myleglist3 = MG.LegList()
            # PROCESS: d d~ > u u~
            mylegs = [{'id': 1, 'number': 1, 'state': False},
                      {'id': -1, 'number': 2, 'state': False},
                      {'id': 2, 'number': 3, 'state': True},
                      {'id': -2, 'number': 4, 'state': True}]
            for i in mylegs:
                myleglist3.append(MG.Leg(i))

            mymodel = import_ufo.import_model('sm')

            dict1 = {'legs' : myleglist1, 'orders':{'QCD':10, 'QED':0},
                               'model': mymodel,
                               'id': 1,
                               'required_s_channels':[],
                               'forbidden_s_channels':[],
                               'forbidden_particles':[],
                               'is_decay_chain': False,
                               'orders': {'QED': 0, 'WEIGHTED':2},
                               'perturbation_couplings' : ['QCD'],
                               'decay_chains': MG.ProcessList(),
                               'overall_orders': {}}

            dict3 = {'legs' : myleglist3, 'orders':{'QCD':10, 'QED':0},
                               'model': mymodel,
                               'id': 1,
                               'required_s_channels':[],
                               'forbidden_s_channels':[],
                               'forbidden_particles':[],
                               'is_decay_chain': False,
                               'orders': {'QED': 0, 'WEIGHTED':2 },
                               'perturbation_couplings' : ['QCD'],
                               'decay_chains': MG.ProcessList(),
                               'overall_orders': {}}
            
            testFKSHelasObjects.mymodel = mymodel
            testFKSHelasObjects.myleglist3 = myleglist3
            testFKSHelasObjects.myproc1 = MG.Process(dict1)
            testFKSHelasObjects.myproc3 = MG.Process(dict3)
开发者ID:cesarotti,项目名称:MMAPS,代码行数:54,代码来源:test_fks_helas_objects.py

示例13: test_fks_ppzz_in_RS

    def test_fks_ppzz_in_RS(self):
        """"""

        p = [21, 1, 2, 3, -1, -2, -3 ]
        z_leg = MG.MultiLeg({'ids':[23], 'state': True})
        p_leg = MG.MultiLeg({'ids': p, 'state': False});
        my_multi_leglist = MG.MultiLegList([copy.copy(leg) for leg in [p_leg] * 2] \
                    + MG.MultiLegList([z_leg, z_leg]))
        mymodel = import_ufo.import_model('RS')
        my_process_definition = MG.ProcessDefinition({ \
                        'orders': {'WEIGHTED': 4},
                        'legs': my_multi_leglist,
                        'perturbation_couplings': ['QCD'],
                        'NLO_mode': 'real',
                        'model': mymodel})
        my_process_definitions = MG.ProcessDefinitionList(\
            [my_process_definition])

        my_multi_process = fks_base.FKSMultiProcess(\
                {'process_definitions': my_process_definitions})
        for born in my_multi_process['born_processes']:
            born_pdg_list = [l['id'] for l in born.born_proc['legs']]
            if born_pdg_list[0] == 21:
            # gg initiated
                self.assertEqual(len(born.born_amp['diagrams']), 1)
                for amp in born.real_amps:
                    if amp.pdgs[0] != 21 or amp.pdgs[1] != 21:
                        self.assertEqual(len(amp.amplitude['diagrams']), 12)
                    else:
                        self.assertEqual(len(amp.amplitude['diagrams']), 4)
            else:
            # qq initiated
                self.assertEqual(len(born.born_amp['diagrams']), 4)
                for amp in born.real_amps:
                    self.assertEqual(len(amp.amplitude['diagrams']), 12)

        my_helas_mp = fks_helas.FKSHelasMultiProcess(my_multi_process, gen_color = False)
        for born in my_helas_mp['matrix_elements']:
            born_pdg_list = [l['id'] for l in born.born_matrix_element['base_amplitude']['process']['legs']]
            if born_pdg_list[0] == 21:
            # gg initiated
                self.assertEqual(len(born.born_matrix_element['diagrams']), 1)
                for real in born.real_processes:
                    pdgs = [l['id'] for l in real.matrix_element['base_amplitude']['process']['legs']]
                    if pdgs[0] != 21 or pdgs[1] != 21:
                        self.assertEqual(len(real.matrix_element['diagrams']), 12)
                    else:
                        self.assertEqual(len(real.matrix_element['diagrams']), 4)
            else:
            # qq initiated
                self.assertEqual(len(born.born_matrix_element['diagrams']), 4)
                for real in born.real_processes:
                    self.assertEqual(len(real.matrix_element['diagrams']), 12)
开发者ID:bendavid,项目名称:MadGraph5_aMC-NLO,代码行数:53,代码来源:test_fks_helas_objects.py

示例14: setUp

 def setUp(self):
     """ creating the full model from scratch """
     CheckFileCreate.clean_files(self)
     
     #picklefile = os.path.join(MG5DIR,'models','sm','model.pkl') 
     #if not files.is_uptodate(picklefile):
     #    sm_path = import_ufo.find_ufo_path('sm')
     model = import_ufo.import_model('sm')
     #else:
     #    model = save_load_object.load_from_file(picklefile)
         
     export_v4.UFO_model_to_mg4(model, self.output_path).build()
开发者ID:harrypuuter,项目名称:tp1,代码行数:12,代码来源:test_model_equivalence.py

示例15: load_IOTestsAcceptance

    def load_IOTestsAcceptance(self):
        """load the models and exporters if necessary."""
        if not hasattr(self, 'models') or \
           not hasattr(self, 'fortran_models') or \
           not hasattr(self, 'loop_exporters'):\
           
            self.models = { \
                'loop_sm' : import_ufo.import_model('loop_sm') 
                          }
            self.fortran_models = {
                'fortran_model' : helas_call_writers.FortranUFOHelasCallWriter(\
                                                         self.models['loop_sm']) 
                                  }
            
            self.loop_exporters = {
                'default' : loop_exporters.LoopProcessExporterFortranSA(\
                                  _mgme_file_path, _proc_file_path,
                                  {'clean':False, 'complex_mass':False, 
                                   'export_format':'madloop','mp':True,
                                   'loop_dir':_loop_file_path,
                                   'cuttools_dir':_cuttools_file_path,
                                   'fortran_compiler':'gfortran',
                                   'output_dependencies':'external',
                                   'SubProc_prefix': '',
                                   'compute_color_flows': False}),
                'optimized' : loop_exporters.\
                                  LoopProcessOptimizedExporterFortranSA(\
                                  _mgme_file_path, _proc_file_path,
                                  {'clean':False, 'complex_mass':False, 
                                   'export_format':'madloop','mp':True,
                                   'loop_dir':_loop_file_path,
                                   'cuttools_dir':_cuttools_file_path,
                                   'fortran_compiler':'gfortran',
                                    'output_dependencies':'external',
                                    'SubProc_prefix': '',
                                   'compute_color_flows': False})
                                  }

            # d u~ > mu- vmx g
            self.addIOTestsForProcess( testName = 'dux_mumvmxg',
                                       testFolder = 'long_ML_SMQCD',
                                       particles_ids = [1,-2,13,-14,21],
                                       exporters = ['default','optimized'],
                                       orders = {'QCD': 1, 'QED': 2} )

            # g g > w- t b~ Single top (long but really includes everything)
            self.addIOTestsForProcess( testName = 'gg_wmtbx',
                                       testFolder = 'long_ML_SMQCD',
                                       particles_ids = [21,21,-24,6,-5],
                                       exporters = ['default','optimized'],
                                       orders = {'QCD': 2, 'QED': 1} )
开发者ID:bendavid,项目名称:MadGraph5_aMC-NLO,代码行数:51,代码来源:test_output_files.py


注:本文中的models.import_ufo.import_model函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。