4. Examples of masks

4.1. Creating an instance

[3]:
from diffractio import sp, nm, plt, np, mm, degrees, um
from diffractio.scalar_fields_XY import Scalar_field_XY
from diffractio.scalar_sources_XY import Scalar_source_XY
from diffractio.scalar_masks_XY import Scalar_mask_XY
from diffractio.utils_drawing import draw_several_fields
number of processors: 8
total memory        : 15.5 Gb
available memory    : 44 %
max frequency       : 3100 GHz
[2]:
# size of figures
%matplotlib inline

import matplotlib
matplotlib.rcParams['figure.figsize']=[4,4]
matplotlib.rcParams['figure.dpi']=125
[3]:
wavelength=0.5*um
x0=np.linspace(-0.25*mm, 0.25*mm, 512)
y0=np.linspace(-0.25*mm, 0.25*mm, 512)

u0 = Scalar_source_XY(x=x0, y=y0, wavelength=wavelength, info='u0')

4.2. Operations with masks

4.2.1. Adding masks

[5]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.square(
    r0=(-50 * um, 0 * um), size=(50 * um, 50 * um), angle=0 * degrees)

t2 = Scalar_mask_XY(x, y, wavelength)
t2.circle(
    r0=(50 * um, 0 * um), radius=(25 * um, 25 * um), angle=0 * degrees)

t3 = t2 + t1

draw_several_fields([t1,t2,t3], titles=['1', '2','1+2'])
../../../_images/source_tutorial_scalar_XY_masks_xy_7_0.png
[6]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.square(
    r0=(0* um, 0 * um),
    size=(100 * um, 100 * um),
    angle=0 * degrees)

t2 = Scalar_mask_XY(x, y, wavelength)
t2.circle(
    r0=(80 * um, 0 * um),
    radius=(40 * um, 40 * um),
    angle=0 * degrees)

t3 = Scalar_mask_XY(x, y, wavelength)
t3.circle(
    r0=(-80 * um, 0 * um),
    radius=(40 * um, 40 * um),
    angle=0 * degrees)

t4 = t2.add(t1, 'maximum1')
t5=t4.add(t3, 'maximum1')
t5.draw(title='add');
../../../_images/source_tutorial_scalar_XY_masks_xy_8_0.png

4.2.2. Substracting masks

[7]:

num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.square(
    r0=(0 * um, 0 * um), size=(100 * um, 100 * um), angle=0 * degrees)

t2 = Scalar_mask_XY(x, y, wavelength)
t2.circle(
    r0=(0 * um, 0 * um), radius=(45 * um, 45 * um), angle=0 * degrees)

t3 = t2 - t1
t3.draw(title='substraction');
../../../_images/source_tutorial_scalar_XY_masks_xy_10_0.png

4.2.3. Binarization

[8]:
num_data = 512
length = 25 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.gray_scale(num_levels=32, levelMin=0, levelMax=1)
t1.draw(kind='intensity', has_colorbar='vertical')
plt.title('(0,1)-no binarized');
../../../_images/source_tutorial_scalar_XY_masks_xy_12_0.png
[9]:
t1.binarize(
    kind='amplitude',
    corte=None,
    level0=0.25,
    level1=.75,
    new_field=False,
    matrix=False)
t1.draw(kind='intensity', has_colorbar='vertical')
plt.suptitle('binarized');
../../../_images/source_tutorial_scalar_XY_masks_xy_13_0.png

4.3. General procedures to generate masks

4.3.1. Mask from function

[10]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.mask_from_function(
    r0=(0 * um, 0 * um),
    index=1.5,
    f1='1*degrees*self.Y',
    f2='1*degrees*self.X',
    v_globals=None,
    radius=(100 * um, 100 * um),
    mask=True)
t1.draw(kind='field');
../../../_images/source_tutorial_scalar_XY_masks_xy_16_0.png
[11]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

f1 = "np.zeros_like(self.X,dtype=float)"
f2 = "R2-h2+np.sqrt(R2**2-(self.X-x0)**2-(self.Y-y0)**2)"
v_globals = {
    'R1': 5 * mm,
    'R2': 1 * mm,
    'x0': 0 * um,
    'y0': 0 * um,
    'h1': 1 * mm,
    'h2': -1 * mm,
    'np': np,
}
index = 1.5

t1 = Scalar_mask_XY(x, y, wavelength)
t1.mask_from_function(
    r0=(0 * um, 0 * um),
    index=index,
    f1=f1,
    f2=f2,
    v_globals=v_globals,
    radius=(100 * um, 100 * um),
    mask=True)
t1.draw(kind='field')

focal = v_globals['R2'] / (index - 1)
../../../_images/source_tutorial_scalar_XY_masks_xy_17_0.png

4.3.2. Insert_array_masks

The mask is repited in x-y axis separated a certain distance

[12]:
x = np.linspace(-250 * um, 250 * um, 512)
y = np.linspace(-250 * um, 250 * um, 512)
wavelength = 1 * um

s = Scalar_mask_XY(x, y, wavelength)
s.cross(
    r0=(0 * um, 0 * um), size=(90 * um, 25 * um), angle=0 * degrees)

t1 = Scalar_mask_XY(x, y, wavelength)
num_points = t1.insert_array_masks(
    t1=s,
    space=[100 * um, 100 * um],
    margin=50 * um,
    angle=90 * degrees)
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_19_0.png

4.3.3. Widen the shape of a previous mask

[13]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.ring(
    r0=(0 * um, 0 * um),
    radius1=(50 * um, 50 * um),
    radius2=(60 * um, 60 * um),
    angle=45 * degrees)

t2=t1.widen(radius=25 * um, new_field=True, binarize=True)

draw_several_fields((t1,t2),  titles=('initial', 'widened'))
../../../_images/source_tutorial_scalar_XY_masks_xy_21_0.png

4.4. Predefinded masks

4.4.1. two_levels

[14]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.two_levels(level1=0, level2=.5, x_edge=0)
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_24_0.png

4.4.2. Edge Series

[4]:
num_pixels=512
length = 1000 * um
x0 = np.linspace(-length / 2, length / 2, num_pixels)
y0 = np.linspace(-length / 2, length / 2, num_pixels)
wavelength = 0.06238 * um

a_coef=np.array([[0,1,2],[0,100,25]])
b_coef=np.array([[0,3],[0,25]])

t2 = Scalar_mask_XY(x=x0, y=y0, wavelength=wavelength)
t2.edge_series(r0=(0,0), period=100, a_coef=a_coef, b_coef=b_coef,
                 angle= 0 * degrees, invert=False)
t2.draw();
../../../_images/source_tutorial_scalar_XY_masks_xy_26_0.png

4.4.3. slit

[15]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.slit(x0=0, size=25 * um, angle=0 * degrees)
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_28_0.png

4.4.4. sinusoidal slit

[16]:
x = np.linspace(-125 * um, 125 * um, 512)
y = np.linspace(-125 * um, 125 * um, 512)
wavelength = 1 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.sinusoidal_slit(
    x0=0 * um,
    size=50*um,
    amplitude=10 * um,
    phase=0 * degrees,
    angle=0 * degrees,
    period=20 * um)
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_30_0.png

4.4.5. slit_series

[8]:
num_data = 256
length = 1000 * um
x0 = np.linspace(-length / 2, length / 2, num_data)
y0 = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

a_coef1=np.array([[0,1,2],[0,25,25]])
a_coef2=np.array([[0,1,2],[0,25,25]])

t1 = Scalar_mask_XY(x=x0, y=y0, wavelength=wavelength)
t1.slit_series(x0=0, width=200, period1=100, period2=100, Dy=(0,0),
               a_coef1=a_coef1, a_coef2=a_coef2, angle=0*degrees)

t1.draw()
[8]:
(<Figure size 500x500 with 1 Axes>,
 <AxesSubplot:xlabel='$x  (\\mu m)$', ylabel='$y  (\\mu m)$'>,
 <matplotlib.image.AxesImage at 0x7f8ba6da9f10>)
../../../_images/source_tutorial_scalar_XY_masks_xy_32_1.png

4.4.6. double_slit

[17]:
num_data = 512
length = 50 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.double_slit(
    x0=0, size=5 * um, separation=15 * um, angle=0 * degrees)
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_34_0.png

4.4.7. triangle

[18]:
x = np.linspace(-100 * um, 100 * um, 512)
y = np.linspace(-100 * um, 100 * um, 512)
wavelength = 1 * um
t1 = Scalar_mask_XY(x, y, wavelength)

t1.triangle(r0=(0, 50*um), slope=2, height=100 * um, angle=0 * degrees)
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_36_0.png

4.4.8. square

[19]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.square(
    r0=(0 * um, 0 * um), size=(200 * um, 100 * um), angle=45 * degrees)
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_38_0.png

4.4.9. circle

[20]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.circle(r0=(0 * um, 0 * um), radius=(100 * um, 100 * um))
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_40_0.png

4.4.10. super_gauss

[21]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.super_gauss(
    r0=(0 * um, 0 * um),
    radius=(length / 3, length / 3),
    angle=45 * degrees,
    potencia=22)
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_42_0.png

4.4.11. square_circle

[22]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.square_circle(
    s=.75,
    r0=(0 * um, 0 * um),
    R1=100 * um,
    R2=100 * um,
    angle=0 * degrees)
t1.draw(kind='intensity');

../../../_images/source_tutorial_scalar_XY_masks_xy_44_0.png

4.4.12. ellipse

[23]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.circle(
    r0=(0 * um, 0 * um), radius=(100 * um, 50 * um), angle=45 * degrees)
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_46_0.png

4.4.13. angular_aperture

[12]:
num_pixels=256
length = 200 * um
x0 = np.linspace(-length / 2, length / 2, num_pixels)
y0 = np.linspace(-length / 2, length / 2, num_pixels)
wavelength = 0.6238 * um

t2 = Scalar_mask_XY(x=x0, y=y0, wavelength=wavelength)
a_coef=np.array([[0,4, 8],[50,25, 25]])
t2.angular_aperture(a_coef=a_coef, angle=0 * degrees)
t2.draw();
../../../_images/source_tutorial_scalar_XY_masks_xy_48_0.png

4.4.14. ring

[24]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.ring(
    r0=(0 * um, 0 * um),
    radius1=(50 * um, 50 * um),
    radius2=(75 * um, 105 * um),
    angle=90 * degrees)
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_50_0.png

4.4.15. rings

[7]:
num_data = 512
length = 60 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

inner_radius=np.array([5., 10, 15, 20, 25])

outer_radius=np.array([6., 12, 17, 23, 29])

t1 = Scalar_mask_XY(x, y, wavelength)
t1.rings(r0=(0,0), inner_radius=inner_radius, outer_radius=outer_radius, mask=True)
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_52_0.png

4.4.16. cross

[25]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.cross(
    r0=(0 * um, 0 * um), size=(200 * um, 75 * um), angle=0 * degrees)
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_54_0.png

4.4.17. image

[26]:
num_data = 1204
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.image(filename="spain.png", normalize=True, canal=0,
         lengthImage=True, angle=0*degrees)

t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_56_0.png

4.4.18. gray_scale

[27]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.gray_scale(num_levels=16, levelMin=0, levelMax=1)
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_58_0.png

4.4.19. hiperellipse

[28]:
x = np.linspace(-100 * um, 100 * um, 512)
y = np.linspace(-100 * um, 100 * um, 512)
wavelength = 1 * um

t1 = Scalar_mask_XY(x, y, wavelength)

t1.super_ellipse(
    r0=(0, 0),
    radius=(100 * um, 100 * um),
    angle=0 * degrees,
    n=[0.75,0.75])
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_60_0.png

4.4.20. lens

[29]:
num_data = 512
length = 400 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t0 = Scalar_mask_XY(x, y, wavelength)
t0.lens(
    r0=(0 * um, 0 * um),
    radius=(150 * um, 150 * um),
    focal=(2.5 * mm, 2.5 * mm),
    angle=0 * degrees)
t0.draw(kind='phase');
../../../_images/source_tutorial_scalar_XY_masks_xy_62_0.png

4.4.21. Fresnel lens

[30]:
# Amplitude lens
num_data = 512
length = 500 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.fresnel_lens(
    r0=(0 * um, 0 * um),
    radius=(250 * um, 250 * um),
    focal=(5 * mm, 5 * mm),
    angle=45 * degrees,
    kind='amplitude',
    phase=np.pi)
t1.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_64_0.png
[31]:
# Phase lens
num_data = 512
length = 500 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1.fresnel_lens(
    r0=(0 * um, 0 * um),
    radius=(250 * um, 250 * um),
    focal=(5 * mm, 5 * mm),
    angle=0 * degrees,
    kind='phase',
    phase=np.pi)
t1.draw(kind='phase');
../../../_images/source_tutorial_scalar_XY_masks_xy_65_0.png

4.4.22. biprism_fresnel

[32]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.biprism_fresnel(
    r0=(0 * um, 0 * um), width=100 * um, height=5 * um, n=1.5)
t1.draw(kind='phase');
../../../_images/source_tutorial_scalar_XY_masks_xy_67_0.png

4.4.23. axicon

[33]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.axicon(r0=(0 * um, 0 * um), radius=100 * um, angle=2*degrees, refraction_index=1.5, off_axis_angle=0, reflective=True)
t1.draw(kind='phase')
[33]:
(<Figure size 500x500 with 1 Axes>,
 <AxesSubplot:xlabel='$x  (\\mu m)$', ylabel='$y  (\\mu m)$'>,
 <matplotlib.image.AxesImage at 0x7f208fa03d60>)
../../../_images/source_tutorial_scalar_XY_masks_xy_69_1.png

4.4.24. grating_forked

[34]:
num_data = 1024
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t = Scalar_mask_XY(x, y, wavelength)
t.forked_grating(
    r0=(0 * um, 0 * um),
    period=10 * um,
    l=3,
    alpha=2,
    kind='amplitude',
    angle=0 * degrees)
t.draw(has_colorbar='vertical');

../../../_images/source_tutorial_scalar_XY_masks_xy_71_0.png
[35]:
num_data = 1024
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t = Scalar_mask_XY(x, y, wavelength)
t.forked_grating(
    r0=(0 * um, 0 * um),
    period=10 * um,
    l=3,
    alpha=2,
    kind='phase',
    angle=0 * degrees)
t.draw(kind='phase', has_colorbar='vertical');

../../../_images/source_tutorial_scalar_XY_masks_xy_72_0.png

4.4.25. roughness

[36]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6328 * um

t1 = Scalar_mask_XY(x, y, wavelength)
t1.roughness(t=(25 * um, 25 * um), s=1 * um)
t1.draw(kind='phase');
../../../_images/source_tutorial_scalar_XY_masks_xy_74_0.png

4.4.26. Sine grating

[37]:
x = np.linspace(-250 * um, 250 * um, 512)
y = np.linspace(-250 * um, 250 * um, 512)
wavelength = 0.6238 * um
period = 50 * um
red = Scalar_mask_XY(x, y, wavelength)
red.sine_grating(
    period=period, amp_min=0, amp_max=1, x0=0 * um, angle=0 * degrees)
red.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_76_0.png

4.4.27. Ronchi grating

[38]:
x = np.linspace(-250 * um, 250 * um, 512)
y = np.linspace(-250 * um, 250 * um, 512)
wavelength = 0.6238 * um
red = Scalar_mask_XY(x, y, wavelength)
red.ronchi_grating(
    period=100 * um, x0=0 * um, angle=0 * degrees, fill_factor=0.5)
red.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_78_0.png

4.4.28. Binary grating (amplitude + phase)

[39]:
x = np.linspace(-250 * um, 250 * um, 512)
y = np.linspace(-250 * um, 250 * um, 512)
wavelength = 0.6238 * um
red = Scalar_mask_XY(x, y, wavelength)
red.binary_grating(
    period=50 * um,
    amin=.25,
    amax=.75,
    phase=np.pi,
    x0=0,
    fill_factor=0.5,
    angle=0 * degrees)
red.draw(kind='field');
../../../_images/source_tutorial_scalar_XY_masks_xy_80_0.png

4.4.29. Blazed grating

[40]:
x = np.linspace(-250 * um, 250 * um, 512)
y = np.linspace(-250 * um, 250 * um, 512)
wavelength = 0.6238 * um
period = 100 * um
red = Scalar_mask_XY(x, y, wavelength)
red.blazed_grating(
    period=period, height=2 * um, index=1.5, x0=0, angle=0 * degrees)
red.draw(kind='phase');
../../../_images/source_tutorial_scalar_XY_masks_xy_82_0.png

4.4.30. 2D grating

[41]:
x = np.linspace(-200 * um, 200 * um, 512)
y = np.linspace(-200 * um, 200 * um, 512)
wavelength = 0.6238 * um
period = 100 * um
red = Scalar_mask_XY(x, y, wavelength)
red.grating_2D(
    r0=(period/8, period/4),
    period=period,
    amin=0,
    amax=1.,
    phase=0 * np.pi / 2,
    fill_factor=0.5,
    angle=0 * degrees)
red.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_84_0.png

4.4.31. Chess grating

[42]:
x = np.linspace(-200 * um, 200 * um, 512)
y = np.linspace(-200 * um, 200 * um, 512)
wavelength = 0.6238 * um
period = 100 * um
red = Scalar_mask_XY(x, y, wavelength)
red.grating_2D_chess(
    r0=(period/8, period/4),
    period=period,
    amin=0,
    amax=1.,
    phase=0 * np.pi / 2,
    fill_factor=0.5,
    angle=(0 * degrees))
red.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_86_0.png

4.4.32. random circle edge

[43]:
num_data = 512
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)
wavelength = 0.6238 * um

t = Scalar_mask_XY(x, y, wavelength)
t.circle_rough(
    r0=(0, 0),
    radius=100 * um,
    angle=0 * degrees,
    sigma=4 * um,
    correlation_length=.1 * um)
t.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_88_0.png

4.4.33. Random ring edge

[44]:
length = 250 * um
x = np.linspace(-length / 2, length / 2, num_data)
y = np.linspace(-length / 2, length / 2, num_data)

wavelength = 0.6238 * um

t = Scalar_mask_XY(x, y, wavelength)
t.ring_rough(
    r0=(0, 0),
    radius1=50 * um,
    radius2=100 * um,
    angle=0 * degrees,
    sigma=4 * um,
    correlation_length=.1 * um)
t.draw(kind='intensity');
../../../_images/source_tutorial_scalar_XY_masks_xy_90_0.png