created C folder with FP_math.c, Makefile and plotter. FP_math have a FFT realisation with fixed-point math, and its tester
This commit is contained in:
56
C/plotter.py
Executable file
56
C/plotter.py
Executable file
@ -0,0 +1,56 @@
|
||||
#!/usr/bin/pypy3
|
||||
import plotly.graph_objs as go
|
||||
from decimal import *
|
||||
from sys import argv
|
||||
import csv
|
||||
|
||||
|
||||
def main():
|
||||
chart = go.Figure()
|
||||
chart.add_trace(go.Scatter(x=[1,2,3], y=[1,2,3]))
|
||||
chart.show()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(argv) == 1:
|
||||
main()
|
||||
else:
|
||||
f = open(argv[1], "rt")
|
||||
#csv_reader = csv.reader(f)
|
||||
data = {}
|
||||
# for line in csv_reader:
|
||||
headers = f.readline()
|
||||
headers = headers.split(",")
|
||||
headers[-1] = headers[-1][:-1]
|
||||
for i in range(len(headers)):
|
||||
headers[i] = headers[i].strip()
|
||||
for header in headers:
|
||||
data[header] = []
|
||||
for line in f:
|
||||
try:
|
||||
line_data = line.split(",")
|
||||
#line_data = line
|
||||
#print(line_data)
|
||||
for i in range(len(line_data)):
|
||||
val = float(line_data[i])
|
||||
if (i < len(headers)):
|
||||
header = headers[i]
|
||||
data[header].append(val)
|
||||
else:
|
||||
print("too much values!")
|
||||
print("headers:", headers)
|
||||
print("values:", line_data)
|
||||
except ValueError:
|
||||
pass
|
||||
f.close()
|
||||
# print(data)
|
||||
chart = go.Figure()
|
||||
keys = [k for k in data.keys()]
|
||||
# print("data.keys:", keys)
|
||||
X_name = keys[0]
|
||||
print("data samples:",len(data[X_name]))
|
||||
for key, val in data.items():
|
||||
if key != X_name:
|
||||
chart.add_trace(go.Scatter(x=data[X_name], y=val, name=key, mode="markers+lines"))
|
||||
chart.show()
|
||||
|
||||
Reference in New Issue
Block a user