Commit d55854d6 authored by ulrich_y's avatar ulrich_y
Browse files

Use different seeds for everything

parent 07d5efe5
......@@ -87,16 +87,36 @@ def create_menu(
}, folder="", binary='mcmule'
):
totalstat = [0,0,0]
# We first need to work out how many seeds we need.
# If a number of seeds per collection is requested, we just
# count the collections and the seeds per collection
nseeds = 0
for k, v in stats.items():
if len(v) == 4:
# number of seeds is missing
if type(seeds) == list:
raise ValueError("Explicit seeds require the number of seeds "
"per collection to be specified!")
stats[k] = tuple(list(v) + [seeds])
if 'C' in k or 'R' in k or 'F' in k:
nseeds += stats[k][4] * len(xicuts)
else:
nseeds += stats[k][4]
if type(seeds) == int:
n = seeds # Get n random numbers
seeds = []
while len(seeds) < n:
while len(seeds) < nseeds:
r = random.randint(10000, 100000)
if r in seeds:
continue
seeds.append(r)
elif type(seeds) == list:
pass
if len(seeds) < nseeds:
print("Not enough seeds provided! Will recycle seeds")
seeds = seeds * (nseeds//len(seeds)+1)
seeds = seeds[:nseeds]
else:
raise TypeError(
"Seeds needs to be either list or int, is type "
......@@ -144,7 +164,6 @@ def create_menu(
print("Warning! In part %s, calls and itmx might be swapped!" % (
part
))
n = stat[4] if len(stat) == 5 else len(seeds)
xiloop = (
"R" in part or # real corrections
......@@ -153,15 +172,15 @@ def create_menu(
)
for xi in (xicuts if xiloop else [1.]):
totalstat[0] += n*(stat[1] + stat[3]) # iterations
totalstat[0] += stat[4]*(stat[1] + stat[3]) # iterations
# iterations
totalstat[1] += 1000*n*(stat[0]*stat[1] + stat[2]*stat[3])
totalstat[1] += 1000*stat[4]*(stat[0]*stat[1] + stat[2]*stat[3])
# runs
totalstat[2] += n
totalstat[2] += stat[4]
menu += "\n\n"
menu += '\n'.join(
"run %d %f %s%s %s 0" % (seed, xi, genprocess, part, flavour)
for seed in seeds[:n]
"run %d %f %s%s %s 0" % (seeds.pop(), xi, genprocess, part, flavour)
for i in range(stat[4])
)
menu += "\n\n"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment