def func(x): return np.sum(OE.ImageViaPSF(X1, Y1, E1, ASF, norm=x)) - np.sum(I1)
y = np.linspace(-ROI_rad, ROI_rad, Ny) [X1, Y1] = np.meshgrid(x, y) R1 = np.sqrt(X1**2 + Y1**2) # Generating Data ============================================================= E1 = GB.PointSourceVec(1, R1[:, :], 0, w0, k) I1 = GB.BeamInt(E1, P) # Generating the PSF, ASF = sqrt(PSF) and generating the Image ================ ASF = OE.ASF(X1, Y1, Rad_airy, kind='airy') def func(x): return np.sum(OE.ImageViaPSF(X1, Y1, E1, ASF, norm=x)) - np.sum(I1) norm = optimize.fsolve(func, 1 / np.sum(ASF)) I1_blur = OE.ImageViaPSF(X1, Y1, E1, ASF, norm=norm) figure = plotAll3(11, X1, Y1, I1, (norm * ASF), I1_blur, ROI_rad, 1, 1, NA=NA) cwd = os.getcwd() os.chdir(startUp.saveDir) figure.set_size_inches(10, 5) figure.savefig('ImageBlur_uniformDisk.png') os.chdir(cwd) # %% Input Field: Atomic ring under constant intensity probe ################## # Define Array ================================================================ w0 = 100 # radius of the flat beam beam [um] ROI_rad = 1.5 * max(w0, Rad_airy) # radius of ROI, defines small ROI [um] x = np.linspace(-ROI_rad, ROI_rad, Nx) y = np.linspace(-ROI_rad, ROI_rad, Ny)