Giter VIP home page Giter VIP logo

Comments (2)

FredvanGoor avatar FredvanGoor commented on June 6, 2024

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

from lightpipes.

JGatUBordeaux avatar JGatUBordeaux commented on June 6, 2024

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.

Figure_1

from lightpipes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.