|
|
|
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") |