Closed JGatUBordeaux closed 3 years ago
Hi Jerome, It is very nice that you use LightPipes to teach your students. I did the same... Below is a script that compares the LightPipes result with the analytical result.
import matplotlib.pyplot as plt
import numpy as np
from LightPipes import *
size=30*mm
labda=500*nm
N=500
w0=1*mm
F=Begin(size,labda,N)
X,Y=F.mgrid_cartesian
F=GaussBeam(F,w0)
z=1000.0*cm
Fz=Fresnel(F,z)
Iz=Intensity(Fz)
#Analytical formulas:
ZR=np.pi*w0*w0/labda #Rayleigh length
w=w0*np.sqrt(1+(z/ZR)**2) #Beam waist at z
Ianalytical=((w0/w)**2)*np.exp(-2*(X/w)**2) + 0.02 #Analytical formula for TEM00 Gauss at z (I added an offset to compare in the plot)
plt.plot(X,Ianalytical,color='red') #analytical result
plt.plot(X,Iz[250],color='blue') #LightPipes result
plt.show()
As far I can see the results are the same. Please check your code (and mine!) Fred van Goor
Dear Fred,
In fact i found the error in my code (pb in the loop to calculate the field)!...lockdown is not good for coding! Thx again for your answer. regards, j.
Hello,
First thanks a lot for allowing people to use your code freely. I want to use it for some practicals for master students at my university.
I try to get familiar with the code and I performed a simple test: take a TEM00 gaussian beam and let is propagate freely. For each propagation step i fit the intensity profile and extract the beam waist. I then compare it to the analytical formula of the waist (w = w0sqrt(1+(lamdaz/(Pi*w02))2) for this kind of beam with a given wavelength and initial waist (i.e. the 2 parameters given in the F = GaussBeam(R, F) line code). The thing is that i get very different results from the analytical formula and the results provided by LightPipes. So i was wondering, maybe there is something obvious I missed? or when you defined a Gaussian beam with the command GaussBeam, at what point this is supposed to correponds? i guess the waist, (when the beam is equivalent to a plane wave?)
I thank you by advance for your reply and help best regards, jerome