示例#1
0
 def run(self):
     """Start the worker subprocess, set parameters and register processes.
     Run loop: receive (data_id, (process_str, amptype), phase space point)
     from in_queue and evaluate the matrix element (multiply if swap
     optionsare set). Push the result(s) as a list of matrix elements
     to out_queue."""
     proc_handles = {}
     import openloops
     for key, val in self.options:
         openloops.set_parameter(key, val)
     for procamp in self.processes:
         proc_handles[procamp] = openloops.Process(*procamp)
     while True:
         data_id, procamp, psp = self.in_queue.get()
         mes = []
         if self.swap_options:
             # multiple evaluation with different parameters
             for sopts in self.swap_options:
                 for key, val in sopts:
                     openloops.set_parameter(key, val)
                 mes.append(proc_handles[procamp].evaluate(psp))
         else:
             # single evaluation
             mes.append(proc_handles[procamp].evaluate(psp))
         self.out_queue.put((data_id, mes))
示例#2
0
 def run(self):
     """Start the worker subprocess, set parameters and register processes.
     Run loop: receive (data_id, (process_str, amptype), phase space point)
     from in_queue and evaluate the matrix element (multiply if swap
     optionsare set). Push the result(s) as a list of matrix elements
     to out_queue."""
     proc_handles = {}
     import openloops
     for key, val in self.options:
         openloops.set_parameter(key, val)
     for procamp in self.processes:
         proc_handles[procamp] = openloops.Process(*procamp)
     while True:
         data_id, procamp, psp = self.in_queue.get()
         mes = []
         if self.swap_options:
             # multiple evaluation with different parameters
             for sopts in self.swap_options:
                 for key, val in sopts:
                     openloops.set_parameter(key, val)
                 mes.append(proc_handles[procamp].evaluate(psp))
         else:
             # single evaluation
             mes.append(proc_handles[procamp].evaluate(psp))
         self.out_queue.put((data_id, mes))
示例#3
0
def set_option(key, val):
    if key.startswith('alpha') and '/' in val:
        try:
            valnum, valden = val.split('/')
            val = float(valnum) / float(valden)
        except ValueError:
            print('[PYOL] ERROR: invalid option \'{}\''.format(opt))
    if args.verbose >= 3:
        print('call set_parameter({},{})'.format(key, val))
    openloops.set_parameter(key, val)
示例#4
0
def set_option(key, val):
    if key.startswith('alpha') and '/' in val:
        try:
            valnum, valden = val.split('/')
            val = float(valnum)/float(valden)
        except ValueError:
            print '[PYOL] ERROR: invalid option \'{}\''.format(opt)
    if args.verbose >= 3:
        print 'call set_parameter({},{})'.format(key,val)
    openloops.set_parameter(key, val)
示例#5
0
文件: run.py 项目: thuer/openloops
for opt in options:
    try:
        key, val = opt.split('=', 1)
    except ValueError:
        print '[PYOL] ERROR: invalid option \'{}\''.format(opt)
        sys.exit(1)
    if key.startswith('alpha') and '/' in val:
        try:
            valnum, valden = val.split('/')
            val = float(valnum) / float(valden)
        except ValueError:
            print '[PYOL] ERROR: invalid option \'{}\''.format(opt)
    if args.verbose >= 3:
        print 'call set_parameter({},{})'.format(key, val)
    openloops.set_parameter(key, val)

# ================== #
# register processes #
# ================== #

is_library = False
if not '>' in args.process:
    is_library = True
    try:
        procinfo = openloops.ProcessInfo(args.process)
    except openloops.ProcessInfoError:
        is_library = False

if not is_library:
    # register a partonic channel
示例#6
0
文件: run.py 项目: thuer/openloops
for opt in options:
    try:
        key, val = opt.split("=", 1)
    except ValueError:
        print "[PYOL] ERROR: invalid option '{}'".format(opt)
        sys.exit(1)
    if key.startswith("alpha") and "/" in val:
        try:
            valnum, valden = val.split("/")
            val = float(valnum) / float(valden)
        except ValueError:
            print "[PYOL] ERROR: invalid option '{}'".format(opt)
    if args.verbose >= 3:
        print "call set_parameter({},{})".format(key, val)
    openloops.set_parameter(key, val)

# ================== #
# register processes #
# ================== #

is_library = False
if not ">" in args.process:
    is_library = True
    try:
        procinfo = openloops.ProcessInfo(args.process)
    except openloops.ProcessInfoError:
        is_library = False

if not is_library:
    # register a partonic channel