6.4.4. XYZ masks
[1]:
from diffractio import degrees, np, um, mm
from diffractio.scalar_masks_XY import Scalar_mask_XY
from diffractio.scalar_masks_XYZ import Scalar_mask_XYZ
[2]:
# change to pv.set_jupyter_backend('trame') for dynamic images.
import pyvista as pv
pv.set_jupyter_backend('static')
6.4.4.1. Sphere
[ ]:
length = 100*um
numdataX = 128
numdataZ = 128
x0 = np.linspace(-length/2, length/2, numdataX)
y0 = np.linspace(-length/2, length/2, numdataX)
z0 = np.linspace(-length/2, length/2, numdataX)
wavelength = 0.55*um
uxyz = Scalar_mask_XYZ(
x=x0, y=y0, z=z0, wavelength=wavelength, n_background=1., info='')
uxyz.sphere( r0=(0*um, 0*um, 0*um), radius=(20*um, 30*um, 40*um), refractive_index=2)
uxyz.draw_XYZ(kind= "refractive_index", drawing= "projections")
6.4.4.2. Square
[4]:
length = 100*um
x0 = np.linspace(-length/2, length/2, 128)
y0 = np.linspace(-length/2, length/2, 128)
z0 = np.linspace(-length/2, length/2, 128)
wavelength = 0.55*um
uxyz = Scalar_mask_XYZ(
x=x0, y=y0, z=z0, wavelength=wavelength, n_background=1., info='')
uxyz.cube(
r0=(0*um, 0*um, 0*um),
size=(50*um, 50*um, 50*um),
refractive_index=2)
uxyz.draw_XYZ(kind= "refractive_index", drawing= "projections")
6.4.4.3. Cylinder
[5]:
size = 100*um
x0 = np.linspace(-size/2, size/2, 128)
y0 = np.linspace(-size/2, size/2, 128)
z0 = np.linspace(-size/2, size/2, 128)
wavelength = 0.55*um
uxyz = Scalar_mask_XYZ(
x=x0, y=y0, z=z0, wavelength=wavelength, n_background=1., info='')
uxyz.cylinder(r0=(0*um, 0*um, 0*um),
radius=(25*um, 25*um),
length=25*um,
refractive_index=2)
uxyz.draw_XYZ(kind= "refractive_index", drawing= "projections")
6.4.4.4. Aspheric_lens
[6]:
size = 1000*um
x0 = np.linspace(-size/2, size/2, 128)
y0 = np.linspace(-size/2, size/2, 128)
z0 = np.linspace(-size/2, size/2, 128)
wavelength = 0.55*um
uxyz = Scalar_mask_XYZ(
x=x0, y=y0, z=z0, wavelength=wavelength, n_background=1., info='')
a=[(0, 1e-12), (0, 0), (0, 0), (0, 0), (0, 0), (0, 0)]
rotation = dict(kind = 'axis', point=(0,50,0), axis=(0,1,0), angle=10*degrees)
uxyz.clear_refractive_index()
focal, ipasa = uxyz.aspheric_lens(
r0=(0 * um, 0 * um, 0*um),
refractive_index=4,
cx=(1 / (.5 * mm), 1 / (.4 * mm)),
Qx=(0, 0),
a=a,
thickness=0.1 * mm,
diameter=1 * mm,
mask=(50 * um, 1 + 2.05j),
rotation=rotation,
)
uxyz.draw_XYZ(kind= "refractive_index", drawing= "projections", opacity=0.1)
6.4.4.5. Lens
[ ]:
x0 = np.linspace(-500 * um, 500 * um, 128)
y0 = np.linspace(-500 * um, 500 * um, 128)
z0 = np.linspace(-500 * um, 500 * um, 128)
wavelength = .5 * um
rotation = None
rotation = dict(kind = 'axis', point=(0,0,0), axis=(0,1,0), angle=25*degrees)
txyz = Scalar_mask_XYZ(
x=x0, y=y0, z=z0, wavelength=wavelength, n_background=1., info='')
focal, _ = txyz.lens(r0=(0,0,-0.125*mm), diameter = 1*mm, radii = (1.5*mm, -1.5*mm), thickness= 0.25*mm,
refractive_index= 2, rotation=rotation)
txyz.draw_XYZ(kind= "refractive_index", drawing= "projections")
6.4.4.6. STL file
[8]:
# provide info about size of frame, and part is enclosed in this size
length = 200*um
num_x = 128
num_y = 128
num_z = 128
x0 = np.linspace(-length/2, length/2, numdataX)
y0 = np.linspace(-length/2, length/2, numdataX)
z0 = np.linspace(-length/2, length/2, numdataZ)
wavelength = 0.55*um
uxyz = Scalar_mask_XYZ(
x=x0, y=y0, z=z0, wavelength=wavelength)
uxyz.stl(filename="Meissner_Tetrahedron.stl", refractive_index=1.5)
uxyz.draw_XYZ(kind= "refractive_index", drawing= "projections", filename='n_cylinder.png')
[9]:
# size acquired in .stl file. Dx, Dy and Dz are over_size.
length = 100*um
x0 = np.linspace(-length/2, length/2, 128)
y0 = np.linspace(-length/2, length/2, 128)
z0 = np.linspace(-length/2, length/2, 128)
wavelength = 0.55*um
uxyz = Scalar_mask_XYZ(x=x0, y=y0, z=z0, wavelength=wavelength)
uxyz.stl(filename="Meissner_Tetrahedron.stl", Dx=(5,5), Dy=(5,5), Dz=(5,5), refractive_index=1.5)
uxyz.draw_XYZ(kind= "refractive_index", drawing= "projections", filename='n_cylinder.png')