49 lines
1.2 KiB
Python
Executable File
49 lines
1.2 KiB
Python
Executable File
#!/usr/bin/pypy3
|
|
import plotly.graph_objs as go
|
|
from decimal import *
|
|
from sys import argv
|
|
|
|
|
|
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")
|
|
data = {}
|
|
values_N = 0
|
|
for line in f:
|
|
print(line)
|
|
#print(line, len(line))
|
|
len_line = len(line)
|
|
try:
|
|
if (len_line >= 11):
|
|
if (line[:2] == "0x"):
|
|
values_N += 1
|
|
header = line[2:4]
|
|
value = line[4:10]
|
|
if not(header in data):
|
|
data[header] = []
|
|
data[header + "_N"] = []
|
|
data[header + "_hex"] = []
|
|
data[header].append(int(value,16))
|
|
data[header + "_hex"].append(value)
|
|
data[header + "_N"].append(values_N)
|
|
except ValueError:
|
|
pass
|
|
except IndexError:
|
|
pass
|
|
f.close()
|
|
# print("data samples:",len(data["X"]))
|
|
chart = go.Figure()
|
|
for key, val in data.items():
|
|
if (key.count("_N") + key.count("_hex")) == 0:
|
|
chart.add_trace(go.Scatter(x=data[key+"_N"], y=data[key], name=key, mode="lines+markers", text=data[key+"_hex"]))
|
|
chart.show()
|
|
|