parsedata.py

This commit is contained in:
Eric Yu 2024-02-14 12:13:19 -08:00
parent 3871bf7829
commit f27bb51086
2 changed files with 20 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
__pycache__

19
src/python/parsedata.py Normal file
View File

@ -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