From f27bb5108696395bd54a0b5a07ab5a32e4701aa7 Mon Sep 17 00:00:00 2001 From: Eric Yu Date: Wed, 14 Feb 2024 12:13:19 -0800 Subject: [PATCH] parsedata.py --- .gitignore | 1 + src/python/parsedata.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 .gitignore create mode 100644 src/python/parsedata.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bee8a64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__ diff --git a/src/python/parsedata.py b/src/python/parsedata.py new file mode 100644 index 0000000..47fc74f --- /dev/null +++ b/src/python/parsedata.py @@ -0,0 +1,19 @@ +import os, numpy as np + +f = open("data.txt", "r").readlines() + +# create a numpy array of the data +data = np.zeros((len(f), 2)) +for i in range(len(f)): + # get the last two columns of the data, then convert them to numpy integers, and place it into the array + data[i] = np.array(f[i].strip().split(",")[-2:], dtype=np.int32) + +# sum each index of the array +sum = np.sum(data, axis=1) + +count = 0 +for i in sum: + # print(count, i) + # convert each i in pico seconds to MHz + print(count, (1/(i*10**-12))/10**6) + count += 1