updated
This commit is contained in:
parent
284467dd71
commit
c6537b51ae
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
doc/*/*.*
|
doc/*/*.*
|
||||||
!doc/*/*.tex
|
!doc/*/*.tex
|
||||||
!doc/*/*.bib
|
!doc/*/*.bib
|
||||||
|
*.cpython-311.pyc
|
35
scripts/reader.py
Normal file
35
scripts/reader.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import csv
|
||||||
|
|
||||||
|
class Reader():
|
||||||
|
def __init__(self) -> None:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def readFile(self, filename) -> dict:
|
||||||
|
with open(filename, 'r') as file:
|
||||||
|
data = list(csv.reader(file, delimiter=','))
|
||||||
|
|
||||||
|
# Delete metadata for now
|
||||||
|
print("Removing metadata")
|
||||||
|
for i in range(15):
|
||||||
|
print(data.pop(0))
|
||||||
|
|
||||||
|
# {'TIME': [data], 'CH1': [data], 'CH2': [data]}
|
||||||
|
channels = []
|
||||||
|
for i in range(len(data[0])):
|
||||||
|
channels.append([])
|
||||||
|
|
||||||
|
for step in data[1:]:
|
||||||
|
for idx, point in enumerate(step):
|
||||||
|
channels[idx].append(float(point))
|
||||||
|
|
||||||
|
result = {}
|
||||||
|
for idx, label in enumerate(data[0]):
|
||||||
|
result[label] = channels[idx]
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
reader = Reader()
|
||||||
|
data = reader.readFile(r".\data\T0007ALL.csv")
|
||||||
|
print(data)
|
10
scripts/reflection.py
Normal file
10
scripts/reflection.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
from matplotlib import pyplot as plt
|
||||||
|
import reader
|
||||||
|
|
||||||
|
data_reader = reader.Reader()
|
||||||
|
data = data_reader.readFile(r".\data\T0001CH1.csv")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
plt.plot(data['TIME'], data['CH1'])
|
||||||
|
plt.show()
|
Loading…
Reference in New Issue
Block a user