4 parser = argparse.ArgumentParser()
5 parser.add_argument(
"-l",
"--logicid", help=
"Logicid mapping", default=
"params_EBEE_logicid.csv")
6 parser.add_argument(
"-i",
"--inputfile", type=str, help=
"Input file", required=
True)
7 parser.add_argument(
"-o",
"--outputfile", type=str, help=
"Output file", required=
True)
8 args = parser.parse_args()
11 gmap = pd.read_csv(args.logicid, sep=
",")
14 for lid
in gmap.stripid:
18 with open(args.inputfile)
as lm:
19 for l
in lm.readlines():
20 if l.startswith(
"#")
or len(l)==0 :
continue 25 for k
in final_map.keys():
30 for strip
in gmap[(gmap.FED >= 610)&(gmap.FED <=645)].stripid:
31 final_map[strip] = n[2]
33 for strip
in gmap[(gmap.FED < 610)&(gmap.FED >645)].stripid:
34 final_map[strip] = n[2]
36 for strip
in gmap[gmap.FED < 610].stripid:
37 final_map[strip] = n[2]
39 for strip
in gmap[gmap.FED > 645].stripid:
40 final_map[strip] = n[2]
44 for strip
in gmap[gmap.FED ==
int(n[1])].stripid:
45 final_map[strip] = n[2]
49 for strip
in gmap[gmap.TT ==
int(n[1])].stripid:
50 final_map[strip] = n[2]
54 for strip
in gmap[(gmap.FED ==
int(n[1])) & (gmap.TT ==
int(n[2]))].stripid:
55 final_map[strip] = n[3]
58 final_map[
int(n[1])] = n[2]
61 with open(args.outputfile,
"w")
as of:
62 for k,v
in final_map.items():
63 of.write(
"{} {}\n".
format(k,v))
def split(sequence, size)