patrickvonplaten commited on
Commit
a211326
1 Parent(s): 090ea4d

Create new file

Browse files
Files changed (1) hide show
  1. graph_acces_requests.py +32 -0
graph_acces_requests.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ import json
3
+ import sys
4
+ import numpy as np
5
+ from collections import Counter
6
+ import matplotlib as mpl
7
+ import matplotlib.pyplot as plt
8
+
9
+ files = sys.argv[1:]
10
+
11
+ def retrieve_day_to_num_signups(file):
12
+ with open(file, "r") as f:
13
+ json_file = json.load(f)
14
+
15
+ list_of_days = [x["time"].split("T")[0] for x in json_file]
16
+
17
+ return Counter(list_of_days)
18
+
19
+
20
+ counters = {file: retrieve_day_to_num_signups(file) for file in files}
21
+ total_counters = {file: np.cumsum(list(counters[file].values())) for file in files}
22
+ time_axis = np.arange(0, len(total_counters[files[0]]))
23
+
24
+ fig, ax = plt.subplots()
25
+ for file in files:
26
+ ax.plot(time_axis, total_counters[file], label=file)
27
+
28
+ ax.set_xlabel("day since launch (on 23/08)")
29
+ ax.set_ylabel("number of requsets")
30
+ ax.set_title("Acces requests comparision")
31
+ ax.legend()
32
+ plt.savefig("access_requests.png")