-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha_0_test_plot_1D.py
More file actions
185 lines (170 loc) · 8.37 KB
/
Copy patha_0_test_plot_1D.py
File metadata and controls
185 lines (170 loc) · 8.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 26 22:09:04 2021
@author: Xcz
"""
# %%
from fun_os import img_squared_bordered_Read, get_Data_new_attrs, get_items_new_attr, \
U_energy_plot_save, U_error_energy_plot_save, U_twin_energy_error_plot_save, U_twin_error_energy_plot_save
from fun_global_var import init_GLV_DICT, Get, tree_print
# %%
def plot_1D_test(test_target=3, is_energy_normalized=0,
Data_Seq=0,
img_full_name="lena1.png",
is_phase_only=0,
# %%
U_size=0.9,
# %%
is_save=0, is_save_txt=0, dpi=100,
# %%
color_1d='b', color_1d2='r',
# %%
sample=1, ticks_num=6,
is_title_on=1, is_axes_on=1, is_mm=1,
# %%
fontsize=9,
font={'family': 'serif',
'style': 'normal', # 'normal', 'italic', 'oblique'
'weight': 'normal',
'color': 'black', # 'black','gray','darkred'
},
# %%
is_print=1, **kwargs, ):
# %%
Data_Seq = str(Data_Seq) + (("." + str(Get("level_min"))) if '.' not in str(Data_Seq) else '') # 先转成 str
if test_target == 0:
test_func = "U_energy_plot_save"
elif test_target == 1:
test_func = "U_error_energy_plot_save"
elif test_target == 2:
test_func = "U_twin_energy_error_plot_save"
elif test_target == 3:
test_func = "U_twin_error_energy_plot_save"
else:
test_func = get_Data_new_attrs(Data_Seq, "saver_name")[0]
info = "plot_1d 测试 —— " + test_func
is_print and print(tree_print(kwargs.get("is_end", 0), add_level=2) + info)
# 没有 treeprint 会没有 Set("f_f"),导致 z 之后被 format 成 0.0。。。
kwargs.pop("is_end", None);
kwargs.pop("add_level", None) # 该 def 子分支 后续默认 is_end = 0,如果 kwargs 还会被 继续使用 的话。
# %% 分析 all_data_info.txt、data_info.txt
folder_new_address, index, U_list, U_name_list, U_name_no_suffix_list, z_list = \
get_items_new_attr(Data_Seq, is_save_txt, is_print, )
# %% 绘图
img_name, img_name_extension, img_squared, \
size_PerPixel, size_fig, Ix, Iy, U = \
img_squared_bordered_Read(img_full_name,
U_size, dpi,
is_phase_only, **kwargs, )
if test_func == "U_energy_plot_save":
U_energy_plot_save(U_list[index+0], U_name_no_suffix_list[index+0],
img_name_extension,
is_save_txt,
# %%
U_list[index+1], sample, size_PerPixel,
is_save, dpi, Get("size_fig_x"), Get("size_fig_y"),
color_1d, ticks_num, is_title_on, is_axes_on, is_mm,
fontsize, font, # 默认无法 外界设置,只能 自动设置 y 轴 max 和 min 了(不是 但 类似 colorbar),还有 is_energy
# %%
z_list[index+0], **kwargs, )
elif test_func == "U_error_energy_plot_save":
U_error_energy_plot_save(U_list[index+0], U_list[index+1], U_list[index+2], U_name_no_suffix_list[index+0],
img_name_extension, is_save_txt,
# %%
U_list[index+3], U_list[index+4], sample, size_PerPixel,
is_save, dpi, Get("size_fig_x"), Get("size_fig_y"),
# %%
color_1d, color_1d2,
ticks_num, is_title_on, is_axes_on, is_mm,
fontsize, font, # 默认无法 外界设置,只能 自动设置 y 轴 max 和 min 了(不是 但 类似 colorbar),还有 is_energy
# %%
z_list[index+0], **kwargs, )
elif test_func == "U_twin_energy_error_plot_save":
U_twin_energy_error_plot_save(U_list[index+0], U_list[index+1], U_name_no_suffix_list[index+0],
img_name_extension, is_save_txt,
# %%
U_list[index+2], U_list[index+3], sample, size_PerPixel,
is_save, dpi, Get("size_fig_x"), Get("size_fig_y"),
# %%
color_1d, color_1d2,
ticks_num, is_title_on, is_axes_on, is_mm,
fontsize, font,
# 默认无法 外界设置,只能 自动设置 y 轴 max 和 min 了(不是 但 类似 colorbar),还有 is_energy
# %%
z_list[index+0],
# %%
is_energy_normalized=is_energy_normalized, **kwargs, )
elif test_func == "U_twin_error_energy_plot_save":
U_twin_error_energy_plot_save(U_list[index+0], U_list[index+1], U_list[index+2], U_name_no_suffix_list[index+0],
img_name_extension, is_save_txt,
# %%
U_list[index+3], U_list[index+4], sample, size_PerPixel,
is_save, dpi, Get("size_fig_x"), Get("size_fig_y"),
# %%
color_1d, color_1d2,
ticks_num, is_title_on, is_axes_on, is_mm,
fontsize, font,
# 默认无法 外界设置,只能 自动设置 y 轴 max 和 min 了(不是 但 类似 colorbar),还有 is_energy
# %%
z_list[index+0],
# %%
is_energy_normalized=is_energy_normalized, **kwargs, )
if __name__ == '__main__':
kwargs = \
{"test_target": -1, # 自动化了,不用填这个参数了
"Data_Seq": 460,
"img_full_name": "lena1.png",
"U_pixels_x": 0, "U_pixels_y": 0,
"is_phase_only": 0,
# %%
"U_size": 1,
# %%
"is_save": 0, "is_no_data_save": 0,
"is_save_txt": 0, "dpi": 100,
# %%
"color_1d": 'b', "color_1d2": 'r',
# %%
"sample": 1, "ticks_num": 6,
"is_title_on": 1, "is_axes_on": 1, "is_mm": 1,
# %%
"fontsize": 10,
"font": {'family': 'serif',
'style': 'normal', # 'normal', 'italic', 'oblique'
'weight': 'normal',
'color': 'black', # 'black','gray','darkred'
},
"is_print": 1,
"is_energy_normalized": 2,
# %% 该程序 作为 主入口时 -------------------------------
"kwargs_seq": 0, "root_dir": r'1',
"is_end": -1,
# %%
"size_fig_x_scale": 10, "size_fig_y_scale": 2,
"ax_yscale": 'linear', "xticklabels_rotate": 45, }
kwargs = init_GLV_DICT(**kwargs)
plot_1D_test(**kwargs)
# plot_1D_test(test_target=3,
# Data_Seq=24,
# img_full_name="lena1.png",
# is_phase_only=0,
# # %%
# U_size=0.9,
# # %%
# is_save=0, is_save_txt=0, dpi=100,
# # %%
# color_1d='b', color_1d2='r',
# # %%
# sample=1, ticks_num=7, is_print=1,
# is_title_on=1, is_axes_on=1, is_mm=1,
# # %%
# fontsize=9,
# font={'family': 'serif',
# 'style': 'normal', # 'normal', 'italic', 'oblique'
# 'weight': 'normal',
# 'color': 'black', # 'black','gray','darkred'
# },
# is_energy_normalized=2,
# # %%
# root_dir=r'', is_end=-1,
# size_fig_x_scale=10, size_fig_y_scale=2,
# ax_yscale='linear', )