Ejemplo n.º 1
0
ii = np.arange(nlayers)
phi = 2 * np.pi / pitch * ii * step
eps_angles = np.zeros(
    shape=(nlayers, 3), dtype="float32"
)  #in case we compiled for float32, this has to be float not duouble
eps_angles[..., 1] = np.pi / 2  #theta angle - in plane director
eps_angles[..., 2] = phi

d = np.ones((nlayers, ), "float32") * (thickness / nlayers)

n = [no, no, ne]

#: layer thickness time wavenumber
kd = 2 * np.pi / wavelengths * step
#: input epsilon -air
eps_in = dtmm.refind2eps(nin)
#: layer epsilon
eps_layer = dtmm.refind2eps(n)
eps_layers = np.array([eps_layer] * nlayers, dtype="complex64")
#: substrate epsilon
eps_out = dtmm.refind2eps(nout)
#: ray beta parameters; beta is nin*np.sin(theta)
beta = 0.
phi = 0.

#stack = d,eps_layers, eps_angles

#cmat = dtmm.tmm.stack_mat(stack,kd, beta = beta, phi = phi)

#build field matrices
a, f, fi = dtmm.tmm.alphaffi(beta, phi, eps_layers, eps_angles)
Ejemplo n.º 2
0

def beam_waist(z, w0, k):
    z0 = w0**2 * k / 2.
    return w0 * (1 + (z / z0)**2)**0.5


window = dtmm.window.gaussian_beam(shape, w0, dtmm.k0(600, 50), n=n, z=0)
field, w, p = dtmm.illumination_data(shape, [w],
                                     pixelsize=50,
                                     n=n,
                                     window=window,
                                     jones=(1, 0))

ks = dtmm.k0(w, p)
epsv = dtmm.refind2eps([n] * 3)

power = dtmm.field2intensity(field)
plt.subplot(121)
plt.imshow(power[0])
plt.title("z=0")

waist = []
z = np.linspace(-512, 512, 13)

for d in z:
    dmat = dtmm.diffract.field_diffraction_matrix(shape,
                                                  ks,
                                                  d=d,
                                                  epsv=epsv,
                                                  betamax=1.)
Ejemplo n.º 3
0
import dtmm
import numpy as np
dtmm.conf.set_verbose(1)

THICKNESS =  100
#: pixel size in nm
PIXELSIZE = 200
#: compute box dimensions
NLAYERS, HEIGHT, WIDTH = 1,96,96
#: illumination wavelengths in nm
WAVELENGTHS = np.linspace(400,700,9)

#: some experimental data
BETA = 0.4

epsv = dtmm.refind2eps([4,4,4]) #high reflective index medium, to increase reflections.
epsa = (0.,0.,0.)

optical_data = [(THICKNESS, epsv, epsa)]

window = dtmm.aperture((HEIGHT, WIDTH),0.2,1)

#illumination data is focused at the top (exit) surface (actual focus = focus * ref_ind = 25*4=100)
field_data_in = dtmm.illumination_data((HEIGHT, WIDTH), WAVELENGTHS, window = window,
                      beta = BETA,  pixelsize = PIXELSIZE,focus = 25.,n=1) 

#illumination filed is defined in vacuum, so we make input and output medium with n = 1.
field_data_out = dtmm.transfer_field(field_data_in, optical_data, beta = BETA,  phi = 0.,
            reflection = 2, diffraction =1, npass = 3, method = "2x2",nin = 1, nout = 1)

#we are viewing computed data in vacuum, so set n = 1.
Ejemplo n.º 4
0
wavelength = 550
#: thickness of layer in microns
thickness = 2.
#: refractive indices of the anisotropic layer
n = [1.5, 1.5, 1.5]
#n = [np.sqrt(-10+0.32j)]*3#silver
#: euler angles of the optical axes (will make effect for anisotropic)
eps_angles = np.array(
    [0, 0.2, 0.4], dtype="float32"
)  #in case we compiled for float32, this has to be float not duouble
#: refractive indices if the substrate
nout = [1.] * 3
#: phase retardation - layer thickness times wavenumber
kd = 2 * np.pi / wavelength * thickness * 1000.
#: input epsilon -air
eps_in = dtmm.refind2eps([1., 1., 1.])
#: layer epsilon
eps_layer = dtmm.refind2eps(n)
#: substrate epsilon
eps_out = dtmm.refind2eps(nout)
#: ray beta parameters; beta is nin*np.sin(theta)
betas = np.array(
    np.linspace(0.0, 0.9999, 1000), dtype="float32"
)  #in case we compiled for float32, this has to be float not duouble
#: phi angle of the input light - will make a diffference for anisotropic layer
phi = 0.0

_phi = 0

pol1 = (-np.sin(_phi), np.cos(_phi))
pol2 = (np.cos(_phi), np.sin(_phi))
Ejemplo n.º 5
0
_phi =  np.linspace(0, np.pi/2, nlayers)
eps_angles = np.zeros(shape = (nlayers+2,3), dtype = "float32") #in case we compiled for float32, this has to be float not duouble
eps_angles[1:-1,1] = np.pi/2 #theta angle - in plane director
eps_angles[1:-1,2] = _phi

d = np.ones((nlayers+2,),"float32") 
d[0] = 0 #first layer is zero thickness
d[-1] = 0 #last too...

n = [no,no,ne] 

#: layer thickness times wavenumber
kd = 2*np.pi/wavelengths[:,None]* step * d
#: input epsilon -air
eps_in = dtmm.refind2eps([nin]*3)
#: layer epsilon
eps_layer = dtmm.refind2eps(n)
eps_values = np.array([eps_layer]*(nlayers+2), dtype = "complex64")
eps_values[0] =  dtmm.refind2eps([nin]*3)
eps_values[-1] =  dtmm.refind2eps([nout]*3)


#stack = d,eps_values, eps_angles

#cmat = tmm.stack_mat(stack,kd, beta = beta, phi = phi)

#build field matrices
a,f,fi = tmm.alphaffi(beta,phi,eps_values, eps_angles)

fout = f[-1]
Ejemplo n.º 6
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Plot material example"""

import dtmm
data = dtmm.nematic_droplet_data((60, 128, 128),
                                 radius=30,
                                 profile="r",
                                 no=1.5,
                                 ne=1.6,
                                 nhost=1.5)
thickness, material_eps, angles = data

fig, ax = dtmm.plot_material(material_eps,
                             eps=dtmm.refind2eps([1.5, 1.5, 1.6]))
fig.show()  #you may call  matplotlib.pyplot.show() as well