jar_project/second_try.py
2020-06-24 15:42:11 +02:00

39 lines
772 B
Python

import matplotlib.pyplot as plt
import os
import glob
import IPython
from IPython import embed
def parse_dataset(dataset_name):
assert(os.path.exists(dataset_name))
f = open(dataset_name, 'r')
lines = f.readlines()
f.close()
print(type(lines))
time = []
frequency = []
amplitude = []
for i in range(len(lines)):
print(lines[i])
l = lines[i].strip()
if len(l) > 0 and l[0] is not '#':
temp = list(map(float, l.split(l)))
time.append(temp[0])
frequency.append(temp[1])
amplitude.append(temp[2])
return time, frequency, amplitude
dataset = 'D:\ jar project\ JAR\ 2020-06-22-aa\ beats-eod.dat'
t, f, a = parse_dataset(dataset)
plt.plot(t, f)
plt.show()