3. Add surfaces to an object

Here, we show a procedure to add an structured surface to an object. The surafaces are to lenses. The first one is an Frsnel lens, and the second surface is an stardard lens.

Two examples are performed. Add the surfaces to a layer and to a biprism

[1]:
from matplotlib import rcParams
rcParams['figure.figsize']=(14,14)
[2]:
from diffractio import sp, nm, plt, np, mm, degrees, um
from diffractio.scalar_sources_X import Scalar_source_X
from diffractio.scalar_masks_XZ import Scalar_mask_XZ
from diffractio.scalar_masks_X import Scalar_mask_X
number of processors: 8
total memory        : 15.5 Gb
available memory    : 50 %
max frequency       : 3100 GHz
[3]:
x0 = np.linspace(-.15*mm, .15*mm, 2048)
z0 = np.linspace(-25*um, 400*um, 2048)
wavelength = 10*um
n_background=1
[4]:
u0 = Scalar_source_X(x0, wavelength)
u0.plane_wave()

3.1. Surfaces

[5]:
surface_1=Scalar_mask_X(x0, wavelength, n_background=1, info='')

h1=surface_1.fresnel_lens(x0=0.0, focal=.25*mm, binary=True, kind='phase', phase=sp.pi, radius=1*mm)

plt.figure(figsize=(6,2))
plt.plot(surface_1.x, h1.real);
../../../_images/source_examples_functioning_surfaces_6_0.png
[6]:
surface_2=Scalar_mask_X(x0, wavelength, n_background=1, info='')
h2=surface_2.fresnel_lens(x0=0.0, focal=-.25*mm, binary=False, kind='phase', phase=sp.pi, radius=1*mm)

plt.figure(figsize=(6,2))
plt.plot(surface_2.x, h2.real);
../../../_images/source_examples_functioning_surfaces_7_0.png
[7]:
fx1 = surface_1.x, h1*wavelength;
fx2 = surface_2.x, h2*wavelength;

3.2. Layer

[8]:
layer = Scalar_mask_XZ(x0, z0, wavelength, n_background=n_background, info='')
#lente3.biprism(r0=(0,0), length=.3*mm, height=.25*mm, refraction_index=1.5);
layer.layer(r0=(0*mm,50*um),refraction_index=1.5, depth=100*um, angle=0);
[9]:
layer.draw_refraction_index();
../../../_images/source_examples_functioning_surfaces_11_0.png
[10]:
layer.add_surfaces(fx=(fx1, fx2), refraction_index=1.5, x_sides=[-1*mm, 1*mm],
                        min_incr=0.1, angle=0*degrees);
[11]:
layer.draw_refraction_index(draw_borders=False);
layer.filter_refraction_index(pixels_filtering=2*um, draw_check=False, max_diff_filter=0.1);
../../../_images/source_examples_functioning_surfaces_13_0.png

Propagation

[12]:
layer.incident_field(u0)
[13]:
layer.clear_field()
layer.BPM(verbose=True)
Time = 1.16 s, time/loop = 0.565 ms
[14]:
layer.draw(logarithm=False, normalize='maximum', draw_borders=True);
../../../_images/source_examples_functioning_surfaces_17_0.png

3.3. Biprism

[15]:
biprism = Scalar_mask_XZ(x0, z0, wavelength, n_background=n_background, info='')
biprism.biprism(r0=(0,0), length=.3*mm, height=.25*mm, refraction_index=1.5);
[16]:
biprism.draw_refraction_index();
../../../_images/source_examples_functioning_surfaces_20_0.png
[17]:
biprism.add_surfaces(fx=(fx1, fx2), refraction_index=1.5, x_sides=[-1*mm, 1*mm],
                        min_incr=0.1, angle=0*degrees);
[18]:
biprism.draw_refraction_index(draw_borders=False);
../../../_images/source_examples_functioning_surfaces_22_0.png
[19]:
biprism.filter_refraction_index(pixels_filtering=2*um, draw_check=False, max_diff_filter=0.1);

Propagation

[20]:
biprism.incident_field(u0)
[21]:
biprism.clear_field()
biprism.BPM(verbose=True)
Time = 1.23 s, time/loop = 0.6018 ms
[22]:
biprism.draw(logarithm=False, normalize='maximum', draw_borders=True);
../../../_images/source_examples_functioning_surfaces_27_0.png