From 8f9df9462b70b0fde1fac4edf6e812409929841d Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Sat, 8 May 2021 15:13:22 +0100 Subject: [PATCH] import io_services into flicker.py. I, also, removed the load_data function. This is part of the gradual move to transfer 'service' based functions out of flicker.py. The aim here is to reduce the need for duplicating code or make it easier to make function calls when needing a particular piece of data (or transformation of data). --- src/flicker.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/flicker.py b/src/flicker.py index 73a1700..bcb5136 100644 --- a/src/flicker.py +++ b/src/flicker.py @@ -1,15 +1,6 @@ import csv import datetime -from services import io_services - -def load_data(): - data = dict() - with open("data/test-data-lite.csv") as csv_file: - csv_reader = csv.reader(csv_file, delimiter=",") - for r in csv_reader: - if (r[1] != "Time Stamp"): - data[r[1]] = r[2] # Ignores the 'Id' column. - return data +from services import io_services, log_services def tally_readings_per_second2(data): time_tallies = dict() @@ -82,7 +73,7 @@ def main(): # rsp_above_two = get_rps_above(2, time_tallies) # flicker_tallies = tally_flickers(rsp_above_two, time_tallies) raw_data = io_services.load_raw_data("data/test-data-lite.csv") - print(raw_data) + log_services.print_dictionary(raw_data) if __name__ == "__main__": main()