From 80cf014c21ea3c5393aca10cbfa785e398d11daf Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Sat, 8 May 2021 20:56:40 +0100 Subject: [PATCH] add save function for filtered flickers list. This could do with being generalised with the other save functions (in io_services). For now, it's job is to save the list of readings which contain four or more readings-per-second and at least one of them is over 39. The specificness of the 39 is because the test data used is from 'factory1' (Light Meter) and that is the threshold for triggering the lights connected to 'gallery1' in the gallery. --- src/services/io_services.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/services/io_services.py b/src/services/io_services.py index 03941c6..01d28b9 100644 --- a/src/services/io_services.py +++ b/src/services/io_services.py @@ -21,3 +21,8 @@ def save_rps_above_threshold(readings, path): wtr = csv.writer(result) for item in readings: wtr.writerow([item]) + +def save_filtered_flickers(readings, path): + with open(path, mode="w") as results: + wtr = csv.writer(results, delimiter=',', lineterminator='\n') + wtr.writerows(readings)