-
Notifications
You must be signed in to change notification settings - Fork 0
/
fakecor.py
executable file
·70 lines (55 loc) · 2.35 KB
/
fakecor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
import logging
import correlator
import build_corr
import pylab
import argparse
import os
from fitfunctions import * # noqa
import inspect
import sys
def make_fake_cor(cfgs, Nt, amps, masses):
assert(len(amps) == len(masses))
cfgs = list(range(cfgs))
times = list(range(Nt))
data = {}
vev = {}
def noisy(value):
return np.random.normal(value,value*0.001,1)
for c in cfgs:
vev[c] = 0.0
tmp = {}
for t in times:
tmp[t] = sum([noisy(amps[i]) * (np.exp((-1.0*masses[i]) * t)+np.exp((masses[i]) * (t-Nt))) for i in range(len(amps))])
data[c] = tmp
return correlator.Correlator.fromDataDicts(data, vev, vev)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Generate a fake correlator")
parser.add_argument("-o", "--output_stub", type=str, required=True,
help="stub of name to write output to")
parser.add_argument("-cfg", "--configs", type=int, required=False, default=100,
help="number of configs to make")
parser.add_argument("-t", "--times", type=int, required=False, default=64,
help="number of times")
parser.add_argument("-a", "--amps", type=float, nargs="+", required=True,
help="amplitudes for each exp")
parser.add_argument("-m", "--masses", type=float, nargs="+", required=True,
help="masses for each exp")
parser.add_argument("-b", "--amp2", type=float, required=False, default=0.0,
help="amplitude for second exp")
parser.add_argument("-m2", "--mass2", type=float, required=False, default=1.5,
help="mass for second exp")
parser.add_argument("-v", "--verbose", action="store_true",
help="increase output verbosity")
args = parser.parse_args()
if args.verbose:
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG)
logging.debug("Verbose debuging mode activated")
else:
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.INFO)
print args.amps
print args.masses
cor = make_fake_cor(args.configs, args.times, args.amps, args.masses)
cor.writefullfile(args.output_stub, comp=True)