Commit 98052511 authored by Lucas Laplanche's avatar Lucas Laplanche
Browse files

TMM avec matrice scattering fonctionnel

parent 7a1efef6
......@@ -10,9 +10,12 @@ OBJECTIFS
Vérifier les recettes avec Alexandre
ACCOMPLI
Faire les calculs VCSEL EAM avec oxydation eam.
Réinstaller crystal XE et faire les recettes EAM-VCSELs.
Corriger le tmm !!!!!!!!!
ECHOUÉ
......
......@@ -4,12 +4,12 @@ from tqdm import tqdm
import optic as op
import pandas_tools as pt
import super_lattice_structure as st
from globals import N0, NGAAS
def element_matrix(n, d, wavelength):
# equation (1.11)
k0 = 2*np.pi/wavelength
......@@ -36,26 +36,6 @@ def reflection(n, d, wavelength):
return np.abs( ((N0*e_m -h_m) / (N0*e_m +h_m))**2 )
def reflection_with_intermediary_values(n, d, wavelength):
# reflection array
r = np.zeros(np.size(n))
# element matrix
m = np.identity(2)
for i in range(np.size(n)):
m = np.matmul(m, element_matrix(n[i], d[i], wavelength))
# electromagnetic field element amplitude
[e_m, h_m] = np.matmul(m, np.array([1, NGAAS])) # eta_s = NGAAS since theta = 0
# reflection
r[i] = np.abs(((N0 * e_m - h_m) / (N0 * e_m + h_m)) ** 2)
return r
def absorption(n, d, wavelength):
# element matrix
m = np.identity(2)
......@@ -91,45 +71,6 @@ def reflectivity(bypass_dbr,
return r
def reflectivity_meshgrid(bypass_dbr, electric_field, wavelength, temperature):
# get the dimension of the dataframe
df = st.structure_eam_vcsel(eam_only=True, bypass_dbr=bypass_dbr)
dim = df.shape[0]
# create empty reflection map
r_meshgrid = np.zeros((len(wavelength), dim))
# add the depth column
pt.add_depth_column(df)
# extract the depth column
depth = df['depth'].to_numpy()
growth_speed = 1. # [um/h]
growth_speed *= 1e-6 # [m/h]
growth_speed /= 3600. # [m/s]
# calculate the layer epitaxial time
time = growth_speed * depth
# wavelength in [m]
# wavelength must be a numpy array
for i in tqdm(range(len(wavelength))):
sl = st.structure_eam_vcsel(eam_only=True, bypass_dbr=bypass_dbr)
sl = op.algaas_super_lattice_refractive_index(sl, electric_field, wavelength[i], temperature)
n = sl['refractive_index'].to_numpy(dtype=np.complex128)
d = sl['thickness'].to_numpy(dtype=np.complex128)
# reflection array
r = reflection_with_intermediary_values(n, d, wavelength[i])
# insert the reflection array
# into the corresponding wavelength column of the reflection map
fill_array_row(r_meshgrid, r, i)
return time, r_meshgrid
def scattering_matrix_global():
......@@ -198,12 +139,11 @@ def em_amplitude_scattering_matrix(super_lattice, wavelength, normalize=True):
# here since theta = 0, kx = ky = 0
q_global = np.array([[0., 1.],
[-1., 0.]])
eigen_g = 1j * np.identity(2)
eigen_g = -1j * np.identity(2)
v_global = eigen_g @ q_global
# initialize global scattering matrix
s_global_ini = scattering_matrix_global()
s_global = np.zeros((n_layers, 2, 2, 2, 2), dtype=np.complex128)
# empty electromagnetic field
e = np.zeros(n_layers)
......@@ -211,6 +151,8 @@ def em_amplitude_scattering_matrix(super_lattice, wavelength, normalize=True):
# empty matrices
eigen_i = np.zeros((n_layers, 2, 2), dtype=np.complex128)
v_i = np.zeros((n_layers, 2, 2), dtype=np.complex128)
s_global = np.zeros((n_layers, 2, 2, 2, 2), dtype=np.complex128)
x_i = np.zeros((n_layers, 2, 2), dtype=np.complex128)
# loop forward through layers
......@@ -219,19 +161,19 @@ def em_amplitude_scattering_matrix(super_lattice, wavelength, normalize=True):
k_zt_i = super_lattice.at[i, 'refractive_index']
l = super_lattice.at[i, 'thickness']
k_z_i = k_0 * k_zt_i
# k_z_i = k_0 * k_zt_i
eigen_i[i] = 1j * k_zt_i * np.identity(2)
q_i = np.array([[0., k_zt_i**2],
[-k_zt_i**2, 0.]])
v_i[i] = np.matmul(q_i, np.linalg.inv(eigen_i[i]))
x_i = expm(1j * k_z_i * l * np.identity(2))
v_i[i] = q_i @ np.linalg.inv(eigen_i[i])
x_i[i] = expm(eigen_i[i] * k_0 * l)
# calculate scattering matrix for layer i
s_i = scattering_matrix_layer(v_i[i], v_global, x_i)
s_i = scattering_matrix_layer(v_i[i], v_global, x_i[i])
# update global scattering matrix
if i==0:
if i==0 :
s_global[i] = redheffer_star_product(s_global_ini, s_i)
else:
s_global[i] = redheffer_star_product(s_global[i -1], s_i)
......@@ -253,7 +195,7 @@ def em_amplitude_scattering_matrix(super_lattice, wavelength, normalize=True):
# iterator from n to 0
di = n_layers -i -1
e_kl = eigen_i[di]
e_kl = x_i[di]
e_mkl = fractional_matrix_power(e_kl, -1.)
el_i = np.array([[e_kl, np.zeros((2, 2))],
[np.zeros((2, 2)), e_mkl]])
......@@ -293,15 +235,6 @@ def em_amplitude_scattering_matrix(super_lattice, wavelength, normalize=True):
def fill_array_row(m, v, i):
# m is a matrix of shape [len(v), ?]
for x in range(len(v)):
m[i, x] = v[x]
return m
def concatenate_2x2x2x2_to_4x4(arr):
m1 = np.concatenate([arr[0][0], arr[0][1]], axis=1)
m2 = np.concatenate([arr[1][0], arr[1][1]], axis=1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment