From 7e19b88d30481e4b6e57b7eeab661954da5ecfc5 Mon Sep 17 00:00:00 2001 From: "Thomas J. Kennedy" <tkennedy@cs.odu.edu> Date: Wed, 19 Oct 2022 15:27:16 -0400 Subject: [PATCH] Expand Semester Project Input example --- .../python3/parseTempsDemo.py | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/SemesterProject-CPU-Temps/python3/parseTempsDemo.py b/SemesterProject-CPU-Temps/python3/parseTempsDemo.py index 31ee534..132268a 100755 --- a/SemesterProject-CPU-Temps/python3/parseTempsDemo.py +++ b/SemesterProject-CPU-Temps/python3/parseTempsDemo.py @@ -15,8 +15,44 @@ def main(): input_temps = sys.argv[1] with open(input_temps, 'r') as temps_file: - for temps_as_floats in parse_raw_temps(temps_file): - print(temps_as_floats) + # Output raw structure + # for temps_as_floats in parse_raw_temps(temps_file): + # print(temps_as_floats) + + # Split data + # for temps_as_floats in parse_raw_temps(temps_file): + # time, core_data = temps_as_floats + # print(f"{time = } | {core_data = }") + + # Split Data + # times = [] + # core_0_data = [] + # core_1_data = [] + # core_2_data = [] + # core_3_data = [] + # for time, core_data in parse_raw_temps(temps_file): + # times.append(time) + # core_0_data.append(core_data[0]) + # core_1_data.append(core_data[1]) + # core_2_data.append(core_data[2]) + # core_3_data.append(core_data[3]) + + # print(f"{times[:4] = }") + # print(f"{core_0_data[:4] = }") + # for time, *temps in list(zip(times, core_0_data, core_1_data, core_2_data, core_3_data))[4:]: + # print(f"{time=} {temps=}") + + # Split Data, but Better! + times = [] + core_data = [[] for _ in range(0, 4)] + + for time, raw_core_data in parse_raw_temps(temps_file): + times.append(time) + for core_idx, reading in enumerate(raw_core_data): + core_data[core_idx].append(reading) + + for time, *temps in list(zip(times, *core_data))[4:]: + print(f"{time=} {temps=}") if __name__ == "__main__": -- GitLab