fq_sim/plot.py

25 lines
627 B
Python
Raw Permalink Normal View History

# 可以使用这个绘图脚本绘图
# 注意由于网表节点到电路节点经过一次映射最终log.txt中的节点顺序和电路节点顺序不一样
import numpy as np
import matplotlib.pyplot as plt
index = 3
# 导入data.log文件
data0 = np.loadtxt('log.txt',skiprows=1)
x0 = data0[:, 0]
for i in range(1,data0.shape[1]):
y0 = data0[:, i]
if i==1:
label = "number of iterations"
elif i==2:
label = "final error"
else:
label = f'Matrix node {i-1}'
plt.plot(x0, y0, label=label)
plt.xlabel("time(s)")
plt.legend()
plt.show()