-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_config.py
38 lines (33 loc) · 1.15 KB
/
plot_config.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
import numpy as np
from matplotlib import pyplot as plt
import argparse
from base import config_loader
import json
def main(*files, register, **kwargs):
if register is None:
return
vals=[]
for file in files:
config={}
with open(file, 'r') as f: config=json.load(f)
value=config[register]
value=list( np.array(value)[config['csa_enable']] )
vals+=value
fig=plt.figure()
ax=fig.add_subplot()
ax.hist(vals, bins=32, range=(0,31), label=register)
ax.grid()
ax.legend()
ax.set_title('Module3 Run 2 ASIC Configs')
ax.set_xlabel('register value')
ax.set_ylabel('channel count')
fig.savefig('config_hist.png')
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('input_files', nargs='+', help='''files to modify''')
parser.add_argument('--register', type=str, default=None, help='''Register to modify''')
args = parser.parse_args()
main(
*args.input_files,
register=args.register
)