opticspy / lightpipes

LightPipes for Python, "Pure Python version"
https://opticspy.github.io/lightpipes/
BSD 3-Clause "New" or "Revised" License
227 stars 52 forks source link

Direct Integration (Fresnel) of Circ Aperture + Lens doesn't lead to (clean) Airy? #46

Open concord647 opened 3 years ago

concord647 commented 3 years ago

Hi!

I am trying to simulate a spatial filter with LightPipes with an input beam size of 10 mm and a pinhole size of around 10 μm, thus the only way to account for vastly different sampling demands seems to be direct integration of the fresnel integral.

I implemented this with LightPipes, however I was not able to produce a "clean" airy disc in the focal plane for the ideal situation of an monochromatic plane wave (const. Amplitude) over a circular aperture of 10 mm. The focal length of the lens is 150 mm, however the phase behind the lens seems to be sampled accuratly enough (see figures).

From the figures it seems to me as we are slightly "out of focus" in the focal plane. The script producing these results is attached. Is this an issue of implementation in LightPipes, an expected result or am I doing something wrong?

Also this is of course very heavy on computation. I was wondering if there is any way to "back-propagate" from the focal plane (after applying a pinhole filter) to a collimated beam using the Spherical Coordinates - Method (6.7 in the manual)?

Absolute field in focus: image

1D central linecut in focus: image

Unwrapped phase in focus (central linecut): image

Unwrapped phase directly behind lens (central linecut): image

Field behind Aperture: image

Code:


from LightPipes import *

N = 1400
wvl = 532*nm
size = 10.5*mm
focal_length = 150*mm

r_aperture = 5e-3

size_fourierPlane = 50e-6
N_fourierPlane = 96

F_init = Begin(size, wvl, N)
F1 = CircAperture(F_init, r_aperture)
F2 = Lens(F1, focal_length)
F3 = Forward(F2, focal_length, size_fourierPlane, N_fourierPlane)
FredvanGoor commented 3 years ago

Direct integration is very time consuming. You should use the trick with spherical coordinates to simulate the Airy disk in the focus of a lens. See the manual: https://opticspy.github.io/lightpipes/manual.html#spherical-coordinates

concord647 commented 3 years ago

Hi Fred,

thank you very much for your reply - and for providing such a neat package of course.

Yes, it is indeed very time consuming. However, I need to propagate the field not only to the focus but also through the focus to the 2f-Plane, as in a 4f-Configuration. I couldn't figure out a way to do this using the trick with sperical coordinates. Is it possible?

Anyways, I wouldn't mind the long computation time of the direct integration method, if the results are correct. However I am still wondering about the resulting airy disc in the focal plane as shown in my original post. I adapted the source code of the spherical coordinates-example to match the physical parameters of the code shown above and this is the result:

grafik

in direct comparison to the result obtained with direct integration (as shown earlier): grafik

Do you see a reason why the first minimum shouldn't go down to zero?

Jackzeng999 commented 3 years ago

Hi Fred, I also meet the problem to get the Airy side-lobs as theory. In the code of LensFresnel_Convert_f10cm.py, you use as F2=Lens(f1,0,0,F); F2=LensFresnel(f2,f,F2); but commands are defined Lens(Fin, f, x_shift=0.0, y_shift=0.0) and LensFresnel(Fin, f, z). Are they OK in both ways?

Thanks a lot.

ldoyle commented 3 years ago

Dear @Jackzeng999, your question is regarding the argument order, correct? We changed this in LightPipes 2.0 so that the Field is always first (new way). This allows many optional arguments with default values, since you can just leave them out. Up to version 1.2, the field was always last, so optional arguments was tricky. All functions (expect new functions introduced in 2.0 or later) were made backward compatible and detect if Field is first or last. The example still uses the old style. Regarding the f1 and f2 parameter, this should be clear from the manual how both lenses (a phase only lens and one geometrical spherical coord lens) combined give the focal strength f.

@concord647 and @Jackzeng999 concerning the non-existent first minimum: This is indeed strange and I have no immediate explanation for it. This is only a guess and might be completely wrong, but could this be the evidence of spherical abberrations?

@concord647 concerning the spatial filter: A PhD colleague of mine tried to do the same and successfully implemented the downscaling, filtering and upscaling using the geometrical spherical coords command. Think of the command not as a lens, but just as a geometrical transform. Imagine you want to propagate from the focal plane (size=100um) to a distance of 99mm and a size of 10mm. Apply first a Lens(F, f=1*mm) and then a LensFresnel(F, f=-1*mm, z=99*mm) and then Convert to get to the output plane. The first Lens command compensates the phase that will be added by LensFresnel since we just want to use it's geometric propagation, not it's focussing/defocussing effect. Sketch it out, hopefully it will become clear (intercept theorem). I can elaborate if the question is still relevant.

Best, Lenny