10.16. Backpropagation

With RS and CZT propagation algorithms, a value for z < 0 is available. This means that we are computing backward propagation.

[1]:
from diffractio import np, plt
from diffractio import um, mm, degrees
from diffractio.diffractio import Diffractio
from diffractio.utils_drawing import draw_several_fields

10.16.1. X frame

[2]:
x0 = np.linspace(-250*um, 250*um, 10000)
z0 = np.linspace(0, 500*um, 512)
wavelength = .5*um
[3]:
u0 = Diffractio('scalar', 'source', x=x0, wavelength=wavelength)
u0.plane_wave()

t0 = Diffractio('scalar', 'mask', x=x0, wavelength=wavelength)
t0.slit(x0=0, size=100*um)

u1 = t0 * u0
u1.draw()

z_propagation = .3*mm

#Forward propagation
u2 = t0.RS(z=z_propagation, new_field=True, verbose=True)
u2.draw()

u3 = u2.RS(z=-z_propagation, new_field=True, verbose=True)
u3.draw()

# draw_several_fields([u1, u2, u3], titles=['u1', 'u2', 'u3'])
Good result: factor 7.80
Good result: factor 7.80
../../_images/source_functioning_backpropagation_5_1.png
../../_images/source_functioning_backpropagation_5_2.png
../../_images/source_functioning_backpropagation_5_3.png

When light escapes from the lateral surface, that is, the intensity output field is not null at the edges, the back-propagated field does not match the input field.

[4]:
u0 = Diffractio('scalar', 'source', x=x0, wavelength=wavelength)
u0.plane_wave()

t0 = Diffractio('scalar', 'mask', x=x0, wavelength=wavelength)
t0.slit(x0=0, size=200*um)

u1 = t0 * u0
u1.draw()

z_propagation = 50*mm

#Forward propagation
u2 = t0.RS(z=z_propagation, new_field=True, verbose=True)
u2.draw()

u3 = u2.RS(z=-z_propagation, new_field=True, verbose=True)
u3.draw()

# draw_several_fields([u1, u2, u3], titles=['u1', 'u2', 'u3'])
Good result: factor 854.03
Good result: factor 854.03
../../_images/source_functioning_backpropagation_7_1.png
../../_images/source_functioning_backpropagation_7_2.png
../../_images/source_functioning_backpropagation_7_3.png

We can obtain similar results with the CZT algorithm

[5]:
u0 = Diffractio('scalar', 'source', x=x0, wavelength=wavelength)
u0.plane_wave()

t0 = Diffractio('scalar', 'mask', x=x0, wavelength=wavelength)
t0.slit(x0=0, size=100*um)

u1 = t0 * u0
u1.draw()

z_propagation = 1*mm

#Forward propagation
u2 = u1.CZT(z=z_propagation, xout=x0)
u2.draw()

u3 = u2.CZT(z=-z_propagation, xout=x0)
u3.draw()


../../_images/source_functioning_backpropagation_9_0.png
../../_images/source_functioning_backpropagation_9_1.png
../../_images/source_functioning_backpropagation_9_2.png

10.17. XY frame

[6]:
x0 = np.linspace(-250*um, 250*um, 512)
y0 = np.linspace(-250*um, 250*um, 512)
wavelength = .5*um
[7]:
u0 = Diffractio('scalar', 'source', x=x0, y=y0, wavelength=wavelength)
u0.plane_wave()

t0 = Diffractio('scalar', 'mask', x=x0, y=y0,  wavelength=wavelength)
t0.square(r0=(0,0), size=200*um)

u1 = t0 * u0

z_propagation = 5*mm

#Forward propagation
u2 = t0.RS(z=z_propagation, new_field=True, verbose=True)

u3 = u2.RS(z=-z_propagation, new_field=True, verbose=True)

draw_several_fields([u1, u2, u3], titles=['u1', 'u2', 'u3'])
Good result: factor 5.07
../../_images/source_functioning_backpropagation_12_1.png
[8]:
u0 = Diffractio('scalar', 'source', x=x0, y=y0, wavelength=wavelength)
u0.plane_wave()

t0 = Diffractio('scalar', 'mask', x=x0, y=y0,  wavelength=wavelength)
t0.square(r0=(0,0), size=200*um)

u1 = t0 * u0

z_propagation = 5*mm

#Forward propagation
u2 = t0.CZT(z=z_propagation)

u3 = u2.CZT(z=-z_propagation)

draw_several_fields([u1, u2, u3], titles=['u1', 'u2', 'u3'])
../../_images/source_functioning_backpropagation_13_0.png