summaryrefslogtreecommitdiff
path: root/results/src/experiment2/__main__.py
diff options
context:
space:
mode:
authormjkwiatkowski <mati.rewa@gmail.com>2026-06-23 16:47:05 +0200
committermjkwiatkowski <mati.rewa@gmail.com>2026-06-23 16:47:05 +0200
commit15a3d5c6f55bec4a39f81f127dd1feec9660ecdc (patch)
treec234acfefc0e3a41c0d1eabcb9f57368e4559a85 /results/src/experiment2/__main__.py
parent81563cdb647b8de014a59fdc7e17fcd5ebf4be6c (diff)
feat: added experiment2HEADmaster
Diffstat (limited to 'results/src/experiment2/__main__.py')
-rw-r--r--results/src/experiment2/__main__.py133
1 files changed, 133 insertions, 0 deletions
diff --git a/results/src/experiment2/__main__.py b/results/src/experiment2/__main__.py
new file mode 100644
index 00000000..a2ac22a7
--- /dev/null
+++ b/results/src/experiment2/__main__.py
@@ -0,0 +1,133 @@
+import pandas as pd
+import time
+import csv
+import os
+from time import gmtime, strftime
+import numpy as np
+import matplotlib.pyplot as plt
+
+CONSTANT = 3_6000_000 / 24
+
+
+def get_name() -> str:
+
+ curr = time.time()
+ s = strftime("%d_%b_%Y_%H%M%S", gmtime(curr))
+ return s
+
+
+def main():
+ dictionary_alert = {
+ "3600000": 11,
+ "180000000": 11,
+ "212400000": 103,
+ "216000000": 103,
+ "219600000": 103,
+ "223200000": 103,
+ "374400000": 57,
+ "712800000": 103,
+ "795600000": 57,
+ "838800000": 11,
+ "882000000": 103,
+ "975600000": 57,
+ "979200000": 11,
+ "982800000": 11,
+ "1087200000": 11,
+ "1234800000": 11,
+ "1404000000": 11,
+ "1854000000": 103,
+ "1857600000": 103,
+ "1861200000": 103,
+ "1926000000": 36,
+ "2034000000": 103,
+ "2037600000": 103,
+ "2041200000": 34,
+ "2080800000": 11,
+ "2102400000": 11,
+ "2163600000": 11,
+ "2185200000": 57,
+ "2383200000": 57,
+ }
+
+ dictionary_red = {
+ 212400000: 70,
+ 216000000: 70,
+ 219600000: 70,
+ 223200000: 70,
+ 374400000: 24,
+ 712800000: 70,
+ 795600000: 24,
+ 882000000: 70,
+ 975600000: 24,
+ 1854000000: 70,
+ 1857600000: 70,
+ 1861200000: 70,
+ 1926000000: 7,
+ 2034000000: 70,
+ 2037600000: 70,
+ 2041200000: 1,
+ 2185200000: 24,
+ 2383200000: 23,
+ }
+
+ dictionary_yellow = {
+ 3600000: 11,
+ 180000000: 11,
+ 212400000: 33,
+ 216000000: 33,
+ 219600000: 33,
+ 223200000: 33,
+ 374400000: 33,
+ 712800000: 33,
+ 795600000: 33,
+ 838800000: 11,
+ 882000000: 33,
+ 975600000: 33,
+ 979200000: 11,
+ 982800000: 11,
+ 1087200000: 11,
+ 1234800000: 11,
+ 1404000000: 11,
+ 1854000000: 33,
+ 1857600000: 33,
+ 1861200000: 33,
+ 1926000000: 33,
+ 2034000000: 33,
+ 2037600000: 33,
+ 2041200000: 33,
+ 2080800000: 11,
+ 2102400000: 11,
+ 2163600000: 11,
+ 2185200000: 33,
+ 2383200000: 33,
+ }
+
+ df = pd.DataFrame(list(dictionary_red.items()), columns=["timestamp", "count"])
+ df2 = pd.DataFrame(list(dictionary_yellow.items()), columns=["timestamp", "count"])
+
+ plt.plot(
+ df["timestamp"] / CONSTANT,
+ df["count"],
+ label="Red alerts",
+ linewidth=1,
+ zorder=2,
+ )
+ plt.plot(
+ df2["timestamp"] / CONSTANT,
+ df2["count"],
+ label="Yellow alerts",
+ linewidth=3,
+ zorder=1,
+ )
+ plt.xlabel("Time [days]")
+ plt.ylabel("Alerts issued")
+ plt.title("Failure detection results")
+ plt.legend()
+
+ path = os.getcwd() + "/src/experiment2/"
+ location: str = path + "figures/%s.pdf" % get_name()
+ plt.savefig(location, dpi=300)
+
+
+if __name__ == "__main__":
+ main()