-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot.py
66 lines (43 loc) · 1.08 KB
/
plot.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
#!/usr/bin/env python
# coding: utf-8
# In[15]:
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import pandas as pd
from sklearn.decomposition import PCA
import numpy as np
import os
import tensorflow as tf
import sys
# In[38]:
def plot(json_path):
if json_path is None:
return
df = pd.read_json(json_path)
results_se = []
results_ba = []
for i in df['Threshold Values'][0]:
results_se.append(i['Signal Efficiency'])
results_ba.append(i['Background Acceptance'])
plt.plot(results_ba, results_se)
plt.xlabel("Background Acceptance")
plt.ylabel("Signal Efficiency")
# In[37]:
def calcArea(results_se, results_ba):
total_area = 0
values = list(zip(results_se, results_ba))
values.sort(key=lambda x: x[1])
prev = values[0][1]
for curr in values:
total_area += (curr[1] - prev) * curr[0]
prev = curr[1]
total_area
# In[39]:
try:
inp = sys.argv[1]
except Exception as e:
inp = None
print(e)
print("You must enter a valid path!")
plot(inp)
# In[ ]: