pwact 0.1.26__py3-none-any.whl → 0.1.27__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pwact/active_learning/user_input/cmd_infos.py +1 -1
- pwact/utils/draw/__init__.py +0 -0
- pwact/utils/draw/hist_model_devi.py +132 -0
- {pwact-0.1.26.dist-info → pwact-0.1.27.dist-info}/METADATA +1 -1
- {pwact-0.1.26.dist-info → pwact-0.1.27.dist-info}/RECORD +9 -7
- {pwact-0.1.26.dist-info → pwact-0.1.27.dist-info}/LICENSE +0 -0
- {pwact-0.1.26.dist-info → pwact-0.1.27.dist-info}/WHEEL +0 -0
- {pwact-0.1.26.dist-info → pwact-0.1.27.dist-info}/entry_points.txt +0 -0
- {pwact-0.1.26.dist-info → pwact-0.1.27.dist-info}/top_level.txt +0 -0
|
@@ -25,7 +25,7 @@ def cmd_infos(cmd_type=None):
|
|
|
25
25
|
cmd_info += "you could use this method to extract pwdatas after active learing done.\nFor more detail for this command, you could use 'pwact gather_pwdata -h'\n\n"
|
|
26
26
|
|
|
27
27
|
cmd_info += "filter" + "\n"
|
|
28
|
-
cmd_info += "you could use this method to test the selection results corresponding to the upper and lower limit settings, you could use 'pwact filter -h'\n"
|
|
28
|
+
cmd_info += "you could use this method to test the selection results corresponding to the upper and lower limit settings, you could use 'pwact filter -h'\n\n"
|
|
29
29
|
|
|
30
30
|
cmd_info += "to_pwdata".lower() + "\n"
|
|
31
31
|
cmd_info += "(This method has been abandoned, new conversion methods refer to the pwdata documentation http://doc.lonxun.com/PWMLFF/Appendix-2/)\n\n"
|
|
File without changes
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import numpy as np
|
|
3
|
+
|
|
4
|
+
# import numpy as np
|
|
5
|
+
import matplotlib.pyplot as plt
|
|
6
|
+
|
|
7
|
+
mark_list = ["o", "^", "v", "X", "|", "*", "v", "+", '*', ' ']
|
|
8
|
+
color_list = ["#006400", "#FF8C00", "#B22222", "#FF8C00" ,"#ff0099" ,\
|
|
9
|
+
"#000000" , "#BDB76B", "#999900" ,"#009999" ,"#000099" ,"#990099", "#ff9900" ]
|
|
10
|
+
linestyle_list = ["--", "--", "--", "-", "-", "-"]
|
|
11
|
+
|
|
12
|
+
def draw_hists_2(data, save_path, min, max, legend_label):
|
|
13
|
+
bins = np.linspace(0, max, 100) # 根据需要调整bin的数量和范围
|
|
14
|
+
alpha = 0.5 # 透明度设置
|
|
15
|
+
plt.figure(figsize=(10, 6)) # 设置图形的大小
|
|
16
|
+
|
|
17
|
+
for i, _data in enumerate(data):
|
|
18
|
+
plt.hist(_data, bins=bins, alpha=alpha, label=legend_label[i], density=True)
|
|
19
|
+
|
|
20
|
+
# 设置坐标轴范围
|
|
21
|
+
plt.xlim(min, max)
|
|
22
|
+
|
|
23
|
+
# 添加标题、标签、图例
|
|
24
|
+
plt.title('Distribution of model deviation', fontsize=18, fontweight='bold', family='serif')
|
|
25
|
+
plt.xlabel('Model Deviation', fontsize=14, fontweight='bold', family='serif')
|
|
26
|
+
plt.ylabel('Frequency', fontsize=14, fontweight='bold', family='serif')
|
|
27
|
+
|
|
28
|
+
# 设置图例
|
|
29
|
+
plt.legend(loc='upper right', fontsize=15, title_fontsize='large')
|
|
30
|
+
|
|
31
|
+
# 调整坐标轴的字体大小
|
|
32
|
+
plt.tick_params(axis='both', labelsize=15)
|
|
33
|
+
|
|
34
|
+
# 添加网格
|
|
35
|
+
plt.grid(True, linestyle='--', alpha=0.7)
|
|
36
|
+
|
|
37
|
+
# 保存图像
|
|
38
|
+
plt.savefig(save_path, dpi=300, bbox_inches='tight')
|
|
39
|
+
plt.close()
|
|
40
|
+
|
|
41
|
+
def read_model_devi(file_path, low=None, high=None):
|
|
42
|
+
devi_files = []
|
|
43
|
+
for path, dirList, fileList in os.walk(file_path):
|
|
44
|
+
for _ in fileList:
|
|
45
|
+
if "model_devi.out" in _:
|
|
46
|
+
devi_files.append(os.path.join(path, _))
|
|
47
|
+
data = []
|
|
48
|
+
for file in devi_files:
|
|
49
|
+
_data = np.loadtxt(file, skiprows=0)
|
|
50
|
+
if _data.shape[0] > 1:
|
|
51
|
+
data.extend(list(_data[:, 1])) # force
|
|
52
|
+
|
|
53
|
+
right = 0
|
|
54
|
+
mid = 0
|
|
55
|
+
error = 0
|
|
56
|
+
if low is not None:
|
|
57
|
+
for d in data:
|
|
58
|
+
if d <= low:
|
|
59
|
+
right += 1
|
|
60
|
+
elif d > low and d <= high:
|
|
61
|
+
mid += 1
|
|
62
|
+
else:
|
|
63
|
+
error += 1
|
|
64
|
+
return data, devi_files, right, mid, error
|
|
65
|
+
|
|
66
|
+
def draw_hist_list(file_path:list[str], legend_label, save_path:str, low=None, high=None) :
|
|
67
|
+
data = []
|
|
68
|
+
min = None
|
|
69
|
+
max = None
|
|
70
|
+
abs_mean = []
|
|
71
|
+
abs_max = []
|
|
72
|
+
mid = 0
|
|
73
|
+
error = 0
|
|
74
|
+
right = 0
|
|
75
|
+
for file in file_path:
|
|
76
|
+
_data, devi_files, _right, _mid, _error = read_model_devi(file, low, high)
|
|
77
|
+
right += _right
|
|
78
|
+
mid += _mid
|
|
79
|
+
error += _error
|
|
80
|
+
_min = np.min(_data)
|
|
81
|
+
_max = np.max(_data)
|
|
82
|
+
min = _min if (min is None or _min < min) else min
|
|
83
|
+
max = _max if (max is None or _max > max) else max
|
|
84
|
+
data.append(_data)
|
|
85
|
+
abs_mean.append(np.mean(_data))
|
|
86
|
+
abs_max.append(np.max(_data))
|
|
87
|
+
|
|
88
|
+
for i in range(0, len(legend_label)):
|
|
89
|
+
if low is not None:
|
|
90
|
+
legend_label[i] = "{}\nmean {} max {} right {} candidate {} error {}".format(legend_label[i], round(abs_mean[i], 3), round(abs_max[i], 3), right, mid, error)
|
|
91
|
+
else:
|
|
92
|
+
legend_label[i] = "{}\nmean {} max {}".format(legend_label[i], round(abs_mean[i], 5), round(abs_max[i], 5))
|
|
93
|
+
# print(legend_label)
|
|
94
|
+
new_data = []
|
|
95
|
+
for id, d in enumerate(data):
|
|
96
|
+
tmp = []
|
|
97
|
+
for _d in d:
|
|
98
|
+
if _d > 1.0:
|
|
99
|
+
tmp.append(1.0)
|
|
100
|
+
else:
|
|
101
|
+
tmp.append(_d)
|
|
102
|
+
new_data.append(tmp)
|
|
103
|
+
max = 1.0 if max > 1.0 else max
|
|
104
|
+
draw_hists_2(new_data, save_path, min, max, legend_label)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
if __name__ == "__main__":
|
|
110
|
+
legend_label = ["iter.0006/md/md.000.sys.000"]
|
|
111
|
+
save_dir = "/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.002"
|
|
112
|
+
draw_hist_list([
|
|
113
|
+
"/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.002"
|
|
114
|
+
], legend_label, save_path=os.path.join(save_dir, "hist_mode_deiv_md.000.sys.002.png"))
|
|
115
|
+
|
|
116
|
+
legend_label = ["iter.0006/md/md.000.sys.001"]
|
|
117
|
+
save_dir = "/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.000"
|
|
118
|
+
draw_hist_list([
|
|
119
|
+
"/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.000"
|
|
120
|
+
], legend_label, save_path=os.path.join(save_dir, "hist_mode_deiv_md.000.sys.000.png"))
|
|
121
|
+
|
|
122
|
+
legend_label = ["iter.0006/md/md.000.sys.002"]
|
|
123
|
+
save_dir = "/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.001"
|
|
124
|
+
draw_hist_list([
|
|
125
|
+
"/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.001"
|
|
126
|
+
], legend_label, save_path=os.path.join(save_dir, "hist_mode_deiv_md.000.sys.001.png"))
|
|
127
|
+
|
|
128
|
+
legend_label = ["iter.0006/md/md.000.sys.003"]
|
|
129
|
+
save_dir = "/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.003"
|
|
130
|
+
draw_hist_list([
|
|
131
|
+
"/data/home/wuxingxing/datas/al_dir/djp/iter.0006/explore/md/md.000.sys.003"
|
|
132
|
+
], legend_label, save_path=os.path.join(save_dir, "hist_mode_deiv_md.000.sys.003.png"), low=0.1, high=0.2)
|
|
@@ -22,7 +22,7 @@ pwact/active_learning/train/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
|
|
|
22
22
|
pwact/active_learning/train/dp_kpu.py,sha256=GkGKEGhLmOvPERqgTkf_0_vD9zOEPlBX2N7vuSQG_-c,9317
|
|
23
23
|
pwact/active_learning/train/train_model.py,sha256=NXqTKrl7Lb_UGt2-Lq_gLM9iZDAZFY09nxP_aGtBdrE,10525
|
|
24
24
|
pwact/active_learning/user_input/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
|
-
pwact/active_learning/user_input/cmd_infos.py,sha256=
|
|
25
|
+
pwact/active_learning/user_input/cmd_infos.py,sha256=g1QW5Wi3JvmC5xEY4F-7AO1xBuJSjHG8IhZjom8haxQ,3728
|
|
26
26
|
pwact/active_learning/user_input/init_bulk_input.py,sha256=NCUAB1xpa67MXHRRWAkmWZjkQbTibE4EjmtlOmr0HdQ,6762
|
|
27
27
|
pwact/active_learning/user_input/iter_input.py,sha256=zwFCI6dDFIEVWitEqBBZP7TtrSvxMbmSUEPiM0Z8ZOk,10732
|
|
28
28
|
pwact/active_learning/user_input/resource.py,sha256=bg1rkdjIzuj7pDUvp6h1yMWFT0PqYzH4BfX5tJ7MZzc,6812
|
|
@@ -53,9 +53,11 @@ pwact/utils/app_lib/cp2k.py,sha256=ljhCCHmZ2kfoXEXn5O7-D56EgTLn2a7H3y_TIkHiasY,1
|
|
|
53
53
|
pwact/utils/app_lib/cp2k_dp.py,sha256=VP4gyPGhLcMAqAjrqCQSUiiGlESNlyYz7Gs3Q4QoUHo,6912
|
|
54
54
|
pwact/utils/app_lib/lammps.py,sha256=2oxHJHdDxfDDWWmnjo0gMNwgGvxABwuDgDlb8kbhgfk,8037
|
|
55
55
|
pwact/utils/app_lib/pwmat.py,sha256=PTRPkG_d00ibGhpCe2-4M7MW3dx2ZuAyb9hT2jl_LAs,18047
|
|
56
|
-
pwact
|
|
57
|
-
pwact
|
|
58
|
-
pwact-0.1.
|
|
59
|
-
pwact-0.1.
|
|
60
|
-
pwact-0.1.
|
|
61
|
-
pwact-0.1.
|
|
56
|
+
pwact/utils/draw/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
57
|
+
pwact/utils/draw/hist_model_devi.py,sha256=o1Try-ekith2A7S6u1mt3zuTqaQwyw5tdURReh8BeLY,4945
|
|
58
|
+
pwact-0.1.27.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
59
|
+
pwact-0.1.27.dist-info/METADATA,sha256=Kk2-JzZqYkUYiqFRbvXMFLiJBj5hV-jIITIG1U2G8q0,3659
|
|
60
|
+
pwact-0.1.27.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
61
|
+
pwact-0.1.27.dist-info/entry_points.txt,sha256=p61auAnpbn8E2WjvHNBA7rb9_NRAOCew4zdcCj33cGc,42
|
|
62
|
+
pwact-0.1.27.dist-info/top_level.txt,sha256=fY1_7sH5Lke4dC9L8MbYM4fT5aat5eCkAmpkIzY1SlM,6
|
|
63
|
+
pwact-0.1.27.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|