Temporary fix for router's IP as client for WAN trace and paths for new tests for...
[pingpong.git] / python_ml / validate-detection.py
index 663dc784d81bcc84c961660374bbb1674a795c3a..c4335ebce0a746c3e97bea75fcf080013a4b6907 100644 (file)
@@ -2,13 +2,36 @@ from datetime import datetime
 
 
 path = "/scratch/July-2018/training/"
-device = "dlink-plug/self-test"
-#fileExperiment = "dlink-plug-8hr-data-oct-8-2018.timestamps"
-#fileDetection = "dlink-plug.detection.timestamps"
-#fileExperiment = "dlink-siren-aug-14-2018.timestamps"
-#fileDetection = "dlink-siren.2018-08-14_experiment.phone_signature_detected_events.txt"
-fileExperiment = "dlink-plug-oct-17-2018.timestamps"
+# D-Link plug
+#device = "dlink-plug/self-test"
+#fileExperiment = "dlink-plug-oct-17-2018.timestamps"
+#fileDetection = "detection-on-training-device-side"
+#fileDetection = "detection-on-training-phone-side"
+# Arlo camera
+#device = "arlo-camera/self-test"
+#fileExperiment = "arlo-camera-aug-10-2018.timestamps"
+#fileDetection = "detection-on-training-phone-side"
+# Blossom sprinkler
+#device = "blossom-sprinkler/self-test"
+#fileExperiment = "blossom-sprinkler-aug-13-2018.timestamps"
+#fileDetection = "detection-on-training-device-side"
+# Nest thermostat
+#device = "nest-thermostat/self-test"
+#fileExperiment = "nest-aug-15-2018.timestamps"
+#fileDetection = "detection-on-training-phone-side"
+# Hue bulb
+#device = "hue-bulb/self-test"
+#fileExperiment = "hue-bulb-aug-7-2018.timestamps"
+#fileDetection = "detection-on-training-phone-side"
+# TPLink bulb
+#device = "tplink-bulb/self-test"
+#fileExperiment = "tplink-bulb-aug-3-2018.timestamps"
+#fileDetection = "detection-on-training-phone-side"
+# WeMo Insight Plug
+device = "wemo-insight-plug/self-test"
+fileExperiment = "wemo-insight-july-31-2018.timestamps"
 fileDetection = "detection-on-training-device-side"
+
 TIME_WINDOW = 15 # detection/signature window of 15 seconds
 #NEG_TIME_WINDOW = -15 # detection/signature window of 15 seconds
 
@@ -42,10 +65,13 @@ while i < maxTimestamps:
        tsE = tsExperimentList[i]
        tsD = tsDetectionList[j]
        # Detection is always a bit later than training trigger
-       delta = tsD - tsE
+       delta1 = tsD - tsE
+       delta2 = tsE - tsD
+       #print("tsE: " + str(tsE) + " - tsD: " + str(tsD) + " - delta1: " + str(delta1.seconds) + " - delta2: " + str(delta2.seconds))
        # The following happens when we could detect less triggers than the experiment
-       if (delta.seconds > TIME_WINDOW):
+       if (delta1.seconds > TIME_WINDOW and delta2.seconds > TIME_WINDOW):
                print("Missing trigger at line: " + str(i) + ", t_experiment: " + str(tsE) + " and t_detection: " + str(tsD))
+               #print(str(tsD))
                i = i + 1
        # The following should not happen (we have more detected triggers than the experiment)
        #elif (delta.seconds < NEG_TIME_WINDOW):