<jupyter_start><jupyter_text>Wavefront converngence to the focus<jupyter_code>p_xnew,p_ynew,wavefront = wavefront_initialize(pixelsize_h=1e-7,pixelsize_v=1e-7,npixels_h=4096*2,npixels_v=4096*2,amplitude_value=1.0)
p_xnew,p_ynew, wavefrontlens= wavefront_aperture(p_xnew,p_ynew,wavefront,diameter_h=40e-6,diameter_v=40e-6,type=1)
f = 1/(1/focus_x + 1/focus_y)
p_xynew = np.array(np.meshgrid(p_ynew,p_xnew))
wavefrontlens = wavefrontlens
#*np.exp(-1.j*k/2/f*(p_xynew[1]**2+p_xynew[0]**2)+1e9j*alpha_x*(p_xynew[1]/f)**3+1e9j*alpha_y*(p_xynew[0]/f)**3)
Fwave = np.fft.fft2(wavefrontlens)
method1 = "fourier_convolution_Fresnel"
p_xdef,p_ydef,wavefront_defocus = propagator2d(p_xnew,p_ynew,wavefrontlens,method= method1 ,wavelength=wl,propagation_distance=defocus,return_angles=0)
method2 ="fresnel_scaling_propagate"
distance = 0.0001
def magnification(R,delta):
    mag = (R+delta)/R
    return mag
mag = magnification(defocus,distance)
p_xdet,p_ydet,wavefront_det = propagator2d(p_xdef,p_ydef,wavefront_defocus,method= method2 ,wavelength=wl,propagation_distance=distance,return_angles=0,magnification=mag)
%matplotlib widget
fig, axes = plt.subplots(1, 2, figsize=(12, 4))
x_min = np.min(p_xnew)
x_max = np.max(p_xnew)
y_min = np.min(p_ynew)
y_max = np.max(p_ynew)
p3 = axes[0].imshow(np.abs(Fwave),extent = [x_min,x_max,y_min,y_max])
axes[0].set_title('Amplitude ', fontsize=14)
p4 = axes[1].imshow(np.unwrap(np.angle(Fwave)),extent = [x_min,x_max,y_min,y_max])
axes[1].set_title('Phase ', fontsize=14)
plt.colorbar(p3,ax = axes[0])
plt.colorbar(p4,ax = axes[1])
plt.savefig('fresnel_wavefrontdet.png')
%matplotlib widget
fig, axes = plt.subplots(1, 2, figsize=(12, 4))
x_min = np.min(p_xdef)
x_max = np.max(p_xdef)
y_min = np.min(p_ydef)
y_max = np.max(p_ydef)
p3 = axes[0].imshow(np.abs(wavefront_defocus),extent = [x_min,x_max,y_min,y_max])
axes[0].set_title('Amplitude ', fontsize=14)
p4 = axes[1].imshow(np.unwrap(np.angle(wavefront_defocus)),extent = [x_min,x_max,y_min,y_max])
axes[1].set_title('Phase ', fontsize=14)
plt.colorbar(p3,ax = axes[0])
plt.colorbar(p4,ax = axes[1])
plt.savefig('fresnel_wavefrontdet.png')
%matplotlib widget
fig, axes = plt.subplots(1, 2, figsize=(12, 4))
x_min = np.min(p_xdet)
x_max = np.max(p_xdet)
y_min = np.min(p_ydet)
y_max = np.max(p_ydet)
p3 = axes[0].imshow(np.abs(wavefront_det),extent = [x_min,x_max,y_min,y_max])
axes[0].set_title('Amplitude ', fontsize=14)
p4 = axes[1].imshow(np.unwrap(np.angle(wavefront_det)),extent = [x_min,x_max,y_min,y_max])
axes[1].set_title('Phase ', fontsize=14)
plt.colorbar(p3,ax = axes[0])
plt.colorbar(p4,ax = axes[1])
plt.savefig('fresnel_wavefrontdet.png')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17353823088455772, 'fraction_numerical': 0.041604197901049474, 'mean_word_length': 9.187022900763358, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '339747', 'license': 'Apache-2.0', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1252, 'n_words': 134, 'path': 'Tomo_sim/Fraunhofer diffraction and projection.ipynb', 'repo_name': 'ltang320/PXST-Development', 'size': '2668'}