コード例 #1
0
    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
コード例 #2
0
    def setUp(self):
        """ prepare a model and the ParamCardWriter"""

        # load the SM with restriction
        self.model = import_ufo.import_model('sm-full')
        self.model = import_ufo.RestrictModel(self.model)
        self.restrict_file = os.path.join(_file_path, os.path.pardir,
                                     'input_files', 'restrict_sm.dat')
        self.model.restrict_model(self.restrict_file)
        
        # 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
コード例 #3
0
def do_generate_param_card(modelname, output):
    """Do the work for generating param_card.dat to <output> given
    the model name. We put this in a separate function so it can be called
    in a different process, because the imports below are sensitive to the
    model changing, so we need a new Python interpreter for each call"""

    # Modify sys.path so we can import the below objects
    # See: http://stackoverflow.com/questions/279237/import-a-module-from-a-relative-path/6098238#6098238
    cmd_folder = os.path.realpath(os.path.abspath(options.mg5_dir))
    if cmd_folder not in sys.path:
        sys.path.insert(0, cmd_folder)

    import madgraph.core.base_objects as base_objects
    import models.import_ufo as import_ufo
    import models.write_param_card as write_param_card

    model = import_ufo.import_model(modelname)
    writer = write_param_card.ParamCardWriter(model)
    writer.define_output_file(output)
    writer.write_card()