-
Notifications
You must be signed in to change notification settings - Fork 0
/
d_3_interference_AST__AST.py
280 lines (251 loc) · 10.4 KB
/
d_3_interference_AST__AST.py
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 1 14:38:57 2021
@author: Xcz
"""
# %%
import copy
import math
import numpy as np
from fun_global_var import init_GLV_DICT, tree_print, init_GLV_rmw, end_STD, fGHU_plot_save
from fun_img_Resize import if_image_Add_black_border
from fun_pump import pump_pic_or_U
from fun_linear import init_AST
from b_1_AST import AST
np.seterr(divide='ignore', invalid='ignore')
def interference_AST__AST(img_full_name="Grating.png",
is_phase_only=0,
# %%
z_pump=0,
is_LG=0, is_Gauss=0, is_OAM=0,
l=0, p=0,
theta_x=0, theta_y=0,
# %%
is_random_phase=0,
is_H_l=0, is_H_theta=0, is_H_random_phase=0,
# %%
U_size=1, w0=0.3,
z=1, dz_expect=5,
# %%
lam1=0.8, is_air_pump=0, is_air=0, T=25,
# %%
is_save=0, is_save_txt=0, dpi=100,
# %%
cmap_2d='viridis',
# %%
ticks_num=6, is_contourf=0,
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_colorbar_on=1, is_energy=1,
# %%
is_print=1,
# %%
**kwargs, ):
# %%
info = "利用 干涉 描边:AST"
is_print and print(tree_print(kwargs.get("is_end", 0), add_level=2) + info)
kwargs.pop("is_end", None);
kwargs.pop("add_level", None) # 该 def 子分支 后续默认 is_end = 0,如果 kwargs 还会被 继续使用 的话。
# %%
if_image_Add_black_border("", img_full_name,
__name__ == "__main__", is_print, **kwargs, )
# %%
def args_AST(z_AST):
return ["",
img_full_name,
is_phase_only,
# %%
z_pump,
is_LG, is_Gauss, is_OAM,
l, p,
theta_x, theta_y,
# %%
is_random_phase,
is_H_l, is_H_theta, is_H_random_phase,
# %%
U_size, w0,
z_AST,
# %%
lam1, is_air_pump, is_air, T,
# %%
is_save, is_save_txt, dpi,
# %%
cmap_2d,
# %%
ticks_num, is_contourf,
is_title_on, is_axes_on,
is_mm,
# %%
fontsize, font,
# %%
is_colorbar_on, is_energy,
# %%
is_print, ]
kwargs_AST = copy.deepcopy(kwargs)
kwargs_AST.update({"ray": "1", })
U_z, G_z, ray_z, method_and_way_z, U_key_z = \
AST(*args_AST(z), **kwargs_AST, )
# %%
# 获取 size_PerPixel,方便 后续计算 n1, k1,以及 为了生成 U1_0 和 g1_shift
img_name, img_name_extension, img_squared, \
size_PerPixel, size_fig, Ix, Iy, \
U_0, g_shift = pump_pic_or_U("",
img_full_name,
is_phase_only,
# %%
z_pump,
is_LG, is_Gauss, is_OAM,
l, p,
theta_x, theta_y,
# %%
is_random_phase,
is_H_l, is_H_theta, is_H_random_phase,
# %%
U_size, w0,
# %%
lam1, is_air_pump, T,
kwargs.get("polar", "e"),
# %%
is_save, is_save_txt, dpi,
cmap_2d,
# %%
ticks_num, is_contourf,
is_title_on, is_axes_on, is_mm,
# %%
fontsize, font,
# %%
is_colorbar_on, is_energy,
# %%
is_print,
# %%
ray_pump='1', **kwargs, )
# %%
n1_inc, n1, k1_inc, k1, k1_z, k1_xy = init_AST(Ix, Iy, size_PerPixel,
lam1, is_air, T,
theta_x, theta_y,
kwargs.get("polar", "e"), **kwargs)
# %%
dz_min = math.pi / (k1 / size_PerPixel)
is_print and print(tree_print() + "dz_min = {} mm".format(dz_min))
delay_min_nums = dz_expect // dz_min
delay_min_nums_odd = delay_min_nums + np.mod(delay_min_nums + 1, 2)
dz = dz_min * delay_min_nums_odd
is_print and print(tree_print() + "dz = {} mm".format(dz))
Z = z + dz
# %%
kwargs_AST = copy.deepcopy(kwargs)
kwargs_AST.update({"ray": "1", })
U_Z, G_Z, ray_Z, method_and_way_Z, U_key_Z = \
AST(*args_AST(Z), **kwargs_AST, )
# %%
kwargs.update({"ray": "1", })
init_GLV_rmw("", "a", "ADD", "", **kwargs)
end_STD(U_z + U_Z, G_z,
is_energy, n_sigma=3, )
fGHU_plot_save(0, # 默认 全自动 is_auto = 1
img_name_extension, is_print,
# %%
[], 1, size_PerPixel,
is_save, is_save_txt, dpi, size_fig,
# %%
"b", cmap_2d,
ticks_num, is_contourf,
is_title_on, is_axes_on, is_mm,
fontsize, font,
# %%
is_colorbar_on, is_energy, # 默认无法 外界设置 vmax 和 vmin,因为 同时画 振幅 和 相位 得 传入 2*2 个 v
# %% 何况 一般默认 is_self_colorbar = 1...
z, is_end=1, )
# %%
if __name__ == '__main__':
kwargs = \
{"img_full_name": "grating.png",
"U_pixels_x": 0, "U_pixels_y": 0,
"is_phase_only": 0,
# %%
"z_pump": 0,
"is_LG": 0, "is_Gauss": 0, "is_OAM": 0,
"l": 0, "p": 0,
"theta_x": 0, "theta_y": 0,
"is_random_phase": 0,
"is_H_l": 0, "is_H_theta": 0, "is_H_random_phase": 0,
# %%
"U1_0_size": 1, "w0": 0, # 传递函数 是 等倾干涉图...
"z": 0, "dz_expect": 0, # z 越大,描边能量不变,但会越糊;dz_expect 越大,描边 能量越高,但也越糊
# %%
"lam1": 1, "is_air_pump": 1, "is_air": 0, "T": 25,
# %%
"is_save": 0, "is_no_data_save": 0,
"is_save_txt": 0, "dpi": 100,
# %%
"cmap_2d": 'viridis',
# %%
"ticks_num": 6, "is_contourf": 0,
"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_colorbar_on": 1, "is_energy": 1,
# %%
"is_print": 1,
# %% 该程序 作为 主入口时 -------------------------------
"kwargs_seq": 0, "root_dir": r'1',
"border_percentage": 0.1, "is_end": -1,
# %%
"theta_z": 90, "phi_z": 0, "phi_c": 24.3,
# KTP 50 度 :deff 最高: 90, ~, 24.3,(24.3 - 2002, 25.3 - 2000)
# 1994 :68.8, ~, 90,(68.8 - 2002, 68.9 - 2000)
# KTP 25 度 :deff 最高: 90, ~, 23.7,(23.7 - 2002, 24.8 - 2000)
# 1994 :68.8, ~, 90,(68.8 - 2002, 68.7 - 2000)
# LN 25 度 :90, ~, ~
"polar": "e",
}
kwargs = init_GLV_DICT(**kwargs)
interference_AST__AST(**kwargs)
# interference_AST__AST(img_full_name="grating.png",
# is_phase_only=0,
# # %%
# z_pump=0,
# is_LG=0, is_Gauss=0, is_OAM=0,
# l=0, p=0,
# theta_x=0, theta_y=0,
# is_random_phase=0,
# is_H_l=0, is_H_theta=0, is_H_random_phase=0,
# # %%
# U1_0_size=1, w0=0, # 传递函数 是 等倾干涉图...
# z=0, dz_expect=0, # z 越大,描边能量不变,但会越糊;dz_expect 越大,描边 能量越高,但也越糊
# # %%
# lam1=1, is_air_pump=0, is_air=0, T=25,
# # %%
# is_save=0, is_save_txt=0, dpi=100,
# # %%
# cmap_2d='viridis',
# # %%
# ticks_num=6, is_contourf=0,
# 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_colorbar_on=1, is_energy=1,
# # %%
# is_print=1,
# # %%
# root_dir=r'',
# border_percentage=0.1, is_end=-1, )