You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am simulating the calculation of a circular aperture beam passing through a lens and converging at the focal plane. I want to calculate what is the radius of the spot when the energy in the barrel at the focal plane is 83.9%. And calculate its times of the diffraction limit.
If the diameter of the center of the first dark ring (Airy disk) of a Fraunhofer diffraction pattern is taken as the diffraction limit diameter.Theoretically, When focused through an ideal lens to the focal plane, the measured ideal diffraction limit diameter should be $d_{difflimit} =\theta _{difflimit} *f$ = $2.44 * λ * f / D$, where λ is the wavelength, f is the focal length, and D is the diameter of the circular aperture.[1]
According to Formula 1, it can be calculated that $u_{ref}$ =0.839,when $d_{u,\mathrm{ref}}$ is taken as diffraction limit diameter metioned above
There are some details for $u_{ref}$
According to Fraunhofer diffraction theory, the far-field intensity distribution of the reference beam with radius $r$ is calculated in paraximal approximation see A.1
According to Formula 1, when $\varepsilon$ = 0, it can be calculated that c=2.44, $u_{ref}$ =0.839
So the calculation result we would expect should be $\beta = d_{simulate}/d_{therory} =1 $,where $d_{simulate}$ is the circular diameter of the region that accounts for 83.9% of the total energy in the simulation results,and $d_{therory}$ = $2.44 * F.lam * f / w$
But in practice, the code didn't work as I thought it would.
Code Parts
At first, I tried combining the Lens() and Propagate() functions.
Then ,I tried LensFarfield() Fuction
And now,I am trying use Spherical coordinates
calRediuswithPow.py is the base function I used to calculate it, there are some things wrong with its algorithm, such as the center of mass calculating itself, and the energy calculating itself, but I don't think it's going to be particularly wrong for the same field and it's propagation, and during debugging, the energy percentage was not more than 0.3% wrong
They all produce beta results that are way off compared to one, generally speaking aspherical coordinate calculations will be about 30% off, and will change greatly with focal length, and diameter of the circular hole,even if I use "ideal sampling": $dx=\frac{\lambda *z}{L}$ [2]73-74. Spherical coordinates in my example are calculated to be 0.3-0.4, which is off by 60-70%.
I'm not sure what went wrong, the radius calculations should not logically produce such a large deviation. Is there something I am not taking into account in my simulation method.
calRediuswithPow.py
use calRediuswithPow() function to calculate the radius corresponding to energy in specify bucket
fromLightPipesimport*importmatplotlibasmplimportnumpyasnpimportcopyas_copydefcalRediuswithPow(fieldIn,energyPercent=0.839):
''' Calculate the radius corresponding to the ring energy Parameters ---------- energyPercent : double fieldIn : lp.Field The input field. Returns ------- The Redius correspend to the energyPercent power. """ ---------- '''fieldIn=_copy.copy(fieldIn)
I=Intensity(fieldIn)
sumEnergy=0# sumEnergy=sum(I)sumEnergy1=0sumEnergy1=0F_row=np.size(fieldIn.field,0)
F_col=np.size(fieldIn.field,1)
foriinrange(F_row):
forjinrange(F_col):
sumEnergy+=I[i][j]
#sumEnergy2=Power(fieldIn)targetEnergy=energyPercent*sumEnergy# Y, X = fieldIn.mgrid_cartesian#Determine spot center of mass Coordinate system with array indexed x,y coordinatesx_power_sum=0y_power_sum=0foriinrange(F_row):
forjinrange(F_col):
x_power_sum+=I[i][j]*iforiinrange(F_row):
forjinrange(F_col):
y_power_sum+=I[i][j]*jx_center=x_power_sum/sumEnergyy_center=y_power_sum/sumEnergy#Calculate the approximation of the true radius using the Bisection method.# First set the maximum value of the radius to the diagonal of the matrixr_max=np.sqrt(F_row**2+F_col**2)
r_min=0girdR=binarySearchR(I,r_max,r_min,targetEnergy,x_center,y_center,F_row,F_col)
Rres=girdR*fieldIn.dxreturnRresdefbinarySearchR(intensityIn,r_max,r_min,targetEnergy,x_center,y_center,F_row,F_col):
''' Bisection method to approximate the real radius (the fitting effect is a bit poor, later can be changed to a point by point cascade outward expansion) The error is close to 0.3% '''whiler_min<=r_max:
r_mid=(r_min+(r_max-r_min)/2)
midEnergy=calPowerWithRadius(intensityIn,F_row,F_col,x_center,y_center,r_mid)
ifmidEnergy==targetEnergy:
returnr_midelifmidEnergy>targetEnergy:
r_max=r_mid-1else:
r_min=r_mid+1#closereturnr_mid#TODO:Sort, compute distance from center of mass for all cells, put into set sort, set mapdefcalPowerWithRadius(intensityIn,F_row,F_col,x_center,y_center,radius):
''' Calculate the power within a specified radius '''powerRes=0foriinrange(F_row):
forjinrange(F_col):
if ((i-x_center)**2+(j-y_center)**2)<=radius**2:
powerRes+=intensityIn[i][j]
returnpowerRes
LensAndLensFarfieldTry.py
try combine Lens() and Propagate() And try LensFarfield()
fromLightPipesimport*importmatplotlibasmplimportnumpyasnpimportcalRediuswithPowmpl.use('TkAgg')
importmatplotlib.pyplotasplt#import Utils# wavelength = 500*nm# size = 7*mm# N = 100# w0 = 1*mm# f = 1*m# z = 1*mwavelength=1000*nmN=3000#2840size=125*mmf=5.5*mz=fw0=1*mm# dx = wavelength*z/size# N = int(size/dx)F=Begin(size, wavelength, N)
F=CircAperture(R=50*mm,Fin=F)
F=Lens(F, f)
# F = Fresnel(F, z)# F = Forvard(F, z)F=Propagate(F, f)
# F2=LensFresnel(f2,f,F2);# F=LensFarField(F,f)# F=Forward(F)#############################Beita calculate start###############################################d=100*mmFToCalB=FDpow=calRediuswithPow.calRediuswithPow(FToCalB,0.839)*2DTherory=2.44*FToCalB.lam*f/dbeita=Dpow/DTheroryprint('The Beita is :',beita)
#############################Beita calculate end###############################################
Hello, @FredvanGoor
I am simulating the calculation of a circular aperture beam passing through a lens and converging at the focal plane. I want to calculate what is the radius of the spot when the energy in the barrel at the focal plane is 83.9%. And calculate its times of the diffraction limit.
If the diameter of the center of the first dark ring (Airy disk) of a Fraunhofer diffraction pattern is taken as the diffraction limit diameter.Theoretically, When focused through an ideal lens to the focal plane, the measured ideal diffraction limit diameter should be$d_{difflimit} =\theta _{difflimit} *f$ = $2.44 * λ * f / D$ , where λ is the wavelength, f is the focal length, and D is the diameter of the circular aperture.[1]
Formula 1
According to Formula 1, it can be calculated that$u_{ref}$ =0.839,when $d_{u,\mathrm{ref}}$ is taken as diffraction limit diameter metioned above
There are some details for$u_{ref}$
According to Fraunhofer diffraction theory, the far-field intensity distribution of the reference beam with radius$r$ is calculated in paraximal approximation see A.1
Let$I(r)=0$ , the positional equation to be satisfied by the zero radius of the circular beam intensity is given in Eq. (A.2).
According to Formula 1, when$\varepsilon$ = 0, it can be calculated that c=2.44, $u_{ref}$ =0.839
So the calculation result we would expect should be$\beta = d_{simulate}/d_{therory} =1 $ ,where $d_{simulate}$ is the circular diameter of the region that accounts for 83.9% of the total energy in the simulation results,and $d_{therory}$ = $2.44 * F.lam * f / w$
But in practice, the code didn't work as I thought it would.
Code Parts
At first, I tried combining the Lens() and Propagate() functions.
Then ,I tried LensFarfield() Fuction
And now,I am trying use Spherical coordinates
calRediuswithPow.py is the base function I used to calculate it, there are some things wrong with its algorithm, such as the center of mass calculating itself, and the energy calculating itself, but I don't think it's going to be particularly wrong for the same field and it's propagation, and during debugging, the energy percentage was not more than 0.3% wrong
They all produce beta results that are way off compared to one, generally speaking aspherical coordinate calculations will be about 30% off, and will change greatly with focal length, and diameter of the circular hole,even if I use "ideal sampling":$dx=\frac{\lambda *z}{L}$ [2]73-74. Spherical coordinates in my example are calculated to be 0.3-0.4, which is off by 60-70%.
I'm not sure what went wrong, the radius calculations should not logically produce such a large deviation. Is there something I am not taking into account in my simulation method.
calRediuswithPow.py
use calRediuswithPow() function to calculate the radius corresponding to energy in specify bucket
LensAndLensFarfieldTry.py
try combine Lens() and Propagate() And try LensFarfield()
TrySphericalCoordinates.py
Try use Spherical Coordinatesto calculate
Others
Spherical coordinates is a little hard to understand, for example I don't know how to set f1 and z. @ldoyle 's xplanation confused me even more
End
Thanks for your reading!
I've been puzzling over these calculations for a long time, so if you have time please help me!
References
[1] Hecht E. Optics[M]. 5.Boston: Pearson Education, Inc.,2017: vi, 480-484.
[2] Voelz D G.Computational fourier optics: a MATLAB tutorial[J],2011.
The text was updated successfully, but these errors were encountered: