File size: 865 Bytes
a211326
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
import json
import sys
import numpy as np
from collections import Counter
import matplotlib as mpl
import matplotlib.pyplot as plt

files = sys.argv[1:]

def retrieve_day_to_num_signups(file):
    with open(file, "r") as f:
        json_file = json.load(f)

    list_of_days = [x["time"].split("T")[0] for x in json_file]

    return Counter(list_of_days)


counters = {file: retrieve_day_to_num_signups(file) for file in files}
total_counters = {file: np.cumsum(list(counters[file].values())) for file in files}
time_axis = np.arange(0, len(total_counters[files[0]]))

fig, ax = plt.subplots()
for file in files:
    ax.plot(time_axis, total_counters[file], label=file)

ax.set_xlabel("day since launch (on 23/08)")
ax.set_ylabel("number of requsets")
ax.set_title("Acces requests comparision")
ax.legend()
plt.savefig("access_requests.png")