From 8f67a3dd0a7760a4d921802ebdf961231c4f5fe0 Mon Sep 17 00:00:00 2001 From: dmy Date: Wed, 4 Mar 2026 19:22:34 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E8=87=B31.0.18?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 - VERSION | 2 +- animation.py | 94 -------------------------------------------- metadata.yml | 2 +- plot.py | 100 ----------------------------------------------- webui/index.html | 2 +- 6 files changed, 3 insertions(+), 198 deletions(-) delete mode 100644 animation.py delete mode 100644 plot.py diff --git a/README.md b/README.md index 4149bda..c7d64d7 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,6 @@ pip install -r requirements.txt - ezdxf - DXF文件生成 - loguru - 日志记录 -- matplotlib - 数据可视化和动画 - numpy - 数值计算 - tomli - TOML配置文件解析 - pywebview - 图形界面框架 diff --git a/VERSION b/VERSION index 8fc77d0..f8f3c08 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.17 +1.0.18 diff --git a/animation.py b/animation.py deleted file mode 100644 index b2bd9fc..0000000 --- a/animation.py +++ /dev/null @@ -1,94 +0,0 @@ -import matplotlib.pyplot as plt -from functools import wraps -import numpy as np - - -class Animation: - def __init__(self) -> None: - fig, ax = plt.subplots() - self._fig = fig - self._ax = ax - self._ticks = 0 - self._disable = False - self.init_fig() - pass - - @staticmethod - def switch_decorator(func): - @wraps(func) - def not_run(cls, *args, **kwargs): - # print("not run") - pass - - @wraps(func) - def wrapTheFunction(cls, *args, **kwargs): - if not cls._disable: - # print("desc") - return func(cls, *args, **kwargs) - return not_run(cls, *args, **kwargs) - - return wrapTheFunction - - def enable(self, _enable): - self._disable = not _enable - - @switch_decorator - def init_fig(self): - ax = self._ax - ax.set_aspect(1) - ax.set_xlim([-500, 500]) - ax.set_ylim([-500, 500]) - - @switch_decorator - def show(self): - self._fig.show() - - @switch_decorator - def add_rg_line(self, line_func): - ax = self._ax - x = np.linspace(0, 300) - y = line_func(x) - ax.plot(x, y) - - @switch_decorator - def add_rs(self, rs, rs_x, rs_y): - ax = self._ax - ax.add_artist(plt.Circle((rs_x, rs_y), rs, fill=False)) - - @switch_decorator - def add_rc(self, rc, rc_x, rc_y): - ax = self._ax - ax.add_artist(plt.Circle((rc_x, rc_y), rc, fill=False)) - - # 增加暴露弧范围 - @switch_decorator - def add_expose_area( - self, - rc_x, - rc_y, - intersection_x1, - intersection_y1, - intersection_x2, - intersection_y2, - ): - ax = self._ax - ax.plot([rc_x, intersection_x1], [rc_y, intersection_y1], color="red") - ax.plot([rc_x, intersection_x2], [rc_y, intersection_y2], color="red") - pass - - @switch_decorator - def clear(self): - ax = self._ax - ax.cla() - - @switch_decorator - def pause(self): - ax = self._ax - self._ticks += 1 - ticks = self._ticks - ax.set_title(f"{ticks}") - plt.pause(0.02) - self.clear() - self.init_fig() - - pass diff --git a/metadata.yml b/metadata.yml index f7ebe12..e0eb444 100644 --- a/metadata.yml +++ b/metadata.yml @@ -1,4 +1,4 @@ -version: 1.0.17 +version: 1.0.18 company_name: EGM file_description: EGM Lightning Protection Calculator product_name: Lightening diff --git a/plot.py b/plot.py deleted file mode 100644 index bce5869..0000000 --- a/plot.py +++ /dev/null @@ -1,100 +0,0 @@ -import matplotlib -from plot_data import * -import matplotlib.pyplot as plt -import matplotlib.ticker as mticker - -matplotlib.use("Qt5Agg") -# 解决中文乱码 -plt.rcParams["font.sans-serif"] = ["simsun"] -plt.rcParams["font.family"] = "sans-serif" -# plt.rcParams["font.weight"] = "bold" -# 解决负号无法显示的问题 -plt.rcParams["axes.unicode_minus"] = False -plt.rcParams["savefig.dpi"] = 1200 # 图片像素 -# plt.savefig("port.png", dpi=600, bbox_inches="tight") -fontsize = 12 -################################################ -witdh_of_bar=0.3 -color=plt.cm.BuPu(np.linspace(152/255, 251/255,152/255)) -percent1 = data_150m塔高_不同地线保护角[:, 1] / data_150m塔高_不同地线保护角[:, 0] -# percent1 = data_66m串长_不同塔高[:, 1] / data_66m串长_不同塔高[:, 0] -# percent2 = data_68m串长_不同塔高[:, 1] / data_68m串长_不同塔高[:, 0] -fig, ax = plt.subplots() -x = np.arange(len(category_names_150m塔高_不同地线保护角)) # the label locations -p1 = ax.bar(category_names_150m塔高_不同地线保护角, percent1, witdh_of_bar, label="绕击/反击跳闸率比值",color=color,hatch='-') -# p1 = ax.bar(x - 0.3 / 2, percent1, 0.3, label="6.6m绝缘距离") -# p2 = ax.bar(x + 0.3 / 2, percent2, 0.3, label="6.8m绝缘距离") -ax.xaxis.set_major_locator(mticker.FixedLocator(x)) -ax.set_xticklabels(category_names_150m塔高_不同地线保护角) -ax.set_ylabel("比值", fontsize=fontsize) -ax.set_xlabel("地线保护角(°)", fontsize=fontsize) -# ax.set_xlabel("接地电阻(Ω)", fontsize=fontsize) -plt.xticks(fontsize=fontsize) -plt.yticks(fontsize=fontsize) -ax.bar_label(p1, padding=0, fontsize=fontsize) -# ax.bar_label(p2, padding=0, fontsize=fontsize) -ax.legend(fontsize=fontsize) - -fig.tight_layout() -plt.show() - - -# results = { -# "100m": 100 * data[0, :] / np.sum(data[0, :]), -# "110m": data[1, :] / np.sum(data[1, :]), -# "120m": data[2, :] / np.sum(data[2, :]), -# "130m": data[3, :] / np.sum(data[3, :]), -# "140m": data[4, :] / np.sum(data[4, :]), -# "150m": data[5, :] / np.sum(data[5, :]), -# } - - -# def survey(results, category_names): -# """ -# Parameters -# ---------- -# results : dict -# A mapping from question labels to a list of answers per category. -# It is assumed all lists contain the same number of entries and that -# it matches the length of *category_names*. -# category_names : list of str -# The category labels. -# """ -# labels = list(results.keys()) -# data = np.array(list(results.values())) -# data_cum = data.cumsum(axis=1) -# category_colors = plt.get_cmap("RdYlGn")(np.linspace(0.15, 0.85, data.shape[1])) -# -# fig, ax = plt.subplots(figsize=(9.2, 5)) -# ax.invert_yaxis() -# ax.xaxis.set_visible(False) -# ax.set_xlim(0, np.sum(data, axis=1).max()) -# -# for i, (colname, color) in enumerate(zip(category_names, category_colors)): -# widths = data[:, i] -# starts = data_cum[:, i] - widths -# rects = ax.barh( -# labels, widths, left=starts, height=0.5, label=colname, color=color -# ) -# -# r, g, b, _ = color -# text_color = "white" if r * g * b < 0.5 else "darkgrey" -# ax.bar_label(rects, label_type="center", color=text_color) -# ax.legend( -# ncol=len(category_names), -# bbox_to_anchor=(0, 1), -# loc="lower left", -# fontsize="small", -# ) -# -# return fig, ax - -# percent=data/np.sum(data,axis=1)[:,None]*100 -# percent = data[:, 1] / data[:, 0] -# plt.bar(category_names, percent, 0.3, label="黑") -# # plt.bar(category_names, percent[:,0], 0.2, label="r") -# -# # plt.bar(category_names, [0.014094 / 100, 0.025094 / 100], 0.2, label="h") -# plt.legend() -# # survey(results, category_names) -# plt.show() diff --git a/webui/index.html b/webui/index.html index e32170f..d70d40a 100644 --- a/webui/index.html +++ b/webui/index.html @@ -4,7 +4,7 @@ - EGM 输电线路绕击跳闸率计算 v1.0.17 + EGM 输电线路绕击跳闸率计算 v1.0.18