def do_work(fathers): for father in fathers: start = datetime.now() for decay in db[father]: work_copy = deepcopy(decay) work_copy['history'] = "{} --> {}".format( father, ' '.join(decay['products'])) get_fstates(work_copy) end = datetime.now() print "{}\t{}".format(father, end-start)
def do_work(parents): global db connect(db_name) for parent in parents: start = datetime.now() if not parent in db: print ("Parent not found in db: "+parent) continue for decay in db[parent]: work_copy = deepcopy(decay) #work_copy['history'] = "{} --> {}".format( # parent, ' '.join(decay['products'])) get_fstates(work_copy) end = datetime.now() print "{}\t{}".format(parent, end-start)
'branching': branching, 'father': father, 'products': products.split(" ") } decay_id += 1 decays.create_index("decay_id") # Lets suppose that we have only one decay scheme: # A -> (B -> f1 f2) (C -> f3 f4), where B,C,f1,f2,f3,f4 are final state particles from fstate import get_fstates for k in db.keys(): for decay in db[k]: for fs in get_fstates(decay_db[decay]['products'], db): if type(fs) != list: fs = [fs] try: scheme = [decay_db[decay]] for x in fs: if type(x) == str or type(x) == unicode: scheme.append(x) else: scheme.append(decay_db[x]) except TypeError: print "Error with fs={}, decay={}".format(fs, decay) raw_input()