7.2. Reflection and refraction
7.2.1. Refection and refraction at a surface
[1]:
from diffractio import degrees, mm, plt, sp, um, np
from diffractio.scalar_masks_X import Scalar_mask_X
from diffractio.scalar_masks_XZ import Scalar_mask_XZ
from diffractio.scalar_sources_X import Scalar_source_X
[2]:
x0 = np.linspace(-100 * um, 100 * um, 2048)
z0 = np.linspace(-100 * um, 100 * um, 2048)
wavelength = 5 * um
u0 = Scalar_source_X(x=x0, wavelength=wavelength)
u0.gauss_beam(A=1, x0=0 * um, z0=100 * um, w0=15 * um, theta=0 * degrees)
u1 = Scalar_mask_XZ(x=x0, z=z0, wavelength=wavelength, n_background=1)
u1.incident_field(u0)
u1.semi_plane(r0=(0, 0), refractive_index=1.5, angle=60 * degrees)
u1.draw_refractive_index()
[3]:
u1.WPM(verbose=False)
[4]:
u1.draw(kind='phase', draw_borders=True)
[5]:
u1.draw(kind='intensity', logarithm=1e1, draw_borders=True)
7.2.2. Refraction
[23]:
x0 = np.linspace(-110 * um, 110 * um, 2048)
z0 = np.linspace(-110 * um, 110 * um, 2048)
wavelength = 1 * um
u0 = Scalar_source_X(x=x0, wavelength=wavelength)
u0.gauss_beam(A=1, x0=25 * um, z0=150 * um, w0=40 * um, theta=0 * degrees)
u1 = Scalar_mask_XZ(x=x0, z=z0, wavelength=wavelength)
u1.incident_field(u0)
u1.layer(r0=(50, 0), depth=80 * um, refractive_index=2, angle=45 * degrees)
u1.draw_refractive_index()
[24]:
u1.WPM(verbose=False)
[25]:
u1.draw(kind='intensity', draw_borders=True)
[26]:
%matplotlib widget
[27]:
u1.draw_profiles_interactive(
kind='intensity', logarithm=False, normalize=False)
7.2.3. Total reflection
[11]:
%matplotlib inline
[12]:
x0 = np.linspace(-100 * um, 100 * um, 2048)
z0 = np.linspace(-100 * um, 100 * um, 2048)
wavelength = 5 * um
u0 = Scalar_source_X(x=x0, wavelength=wavelength)
u0.gauss_beam(A=1, x0=0 * um, z0=100 * um, w0=15 * um, theta=0 * degrees)
u1 = Scalar_mask_XZ(x=x0, z=z0, wavelength=wavelength, n_background=1.5)
u1.incident_field(u0)
u1.semi_plane(r0=(0, 0), refractive_index=1, angle=60 * degrees)
u1.draw_refractive_index()
[13]:
u1.WPM(verbose=False)
[14]:
u1.draw(kind='phase', draw_borders=True)
plt.ylim(ymin=-60)
plt.xlim(xmax=75)
[15]:
u1.draw(kind='intensity', logarithm=True, draw_borders=True)
plt.xlim(-50, 50)
plt.ylim(-30, 30)
7.2.4. Total reflection at a layer
[16]:
x0 = np.linspace(-150 * um, 300 * um, 2048)
z0 = np.linspace(-150 * um, 500 * um, 2048)
wavelength = 1 * um
u0 = Scalar_source_X(x=x0, wavelength=wavelength)
u0.gauss_beam(
A=1, x0=-100 * um, z0=150 * um, w0=15 * um, theta=0 * degrees)
u1 = Scalar_mask_XZ(x=x0, z=z0, wavelength=wavelength)
u1.incident_field(u0)
u1.layer(
r0=(50, 0), depth=100 * um, refractive_index=1.5, angle=60 * degrees)
u1.draw_refractive_index()
u1.smooth_refractive_index(type_filter=2, pixels_filtering=3)
[17]:
u1.BPM(verbose=False)
u1.draw(kind='intensity', logarithm=True, draw_borders=True)
[18]:
u1.draw(kind='intensity', logarithm=True, draw_borders=True)
plt.xlim(-100, 0)
plt.ylim(-125, -65)
[19]:
%matplotlib widget
[20]:
u1.draw_profiles_interactive(
kind='intensity', logarithm=False, normalize=False)