-
Notifications
You must be signed in to change notification settings - Fork 0
/
fakecor_matrix.py
executable file
·59 lines (49 loc) · 2.06 KB
/
fakecor_matrix.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
#!/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
import zfactor
import fakecor
from fitfunctions import * # noqa
import inspect
import sys
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=50,
help="number of configs to make")
parser.add_argument("-t", "--times", type=int, required=False, default=20,
help="number of times")
parser.add_argument("-z", "--overlapsfile", type=str, required=True,
help="file to read the zfactors")
parser.add_argument("-m", "--masses", type=float, nargs="+", required=True,
help="list of masses for each level")
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)
N = len(args.masses)
raw_Zs = zfactor.read_coeffs_file(args.overlapsfile)
assert len(raw_Zs)==N*N, "Length missmatch in levels and coeffs"
print raw_Zs
Zs = np.matrix(raw_Zs.identities.values.reshape((N, N))).T
print Zs
print "blah"
for i in range(N):
for j in range(N):
print "Correlator_{}{}".format(i,j)
amps = [Zs[i,level]*Zs[j,level] for level in range(N)]
print "newaps", amps
cor = fakecor.make_fake_cor(args.configs, args.times, amps, args.masses)
cor.writefullfile(args.output_stub+"{}_{}".format(i,j), comp=True)
logging.info("done")