Commit 44db9726 authored by Lucas Laplanche's avatar Lucas Laplanche
Browse files

erreur dans tmm meshgrid

parent 4d3ee0fa
...@@ -8,6 +8,7 @@ import plot as plt ...@@ -8,6 +8,7 @@ import plot as plt
import quantum as qt import quantum as qt
import scipy.io import scipy.io
import super_lattice_structure as st import super_lattice_structure as st
from globals import T
...@@ -31,6 +32,12 @@ def reflectivity(bypass_dbr=True, start_wavelength=820e-9, stop_wavelength=880e- ...@@ -31,6 +32,12 @@ def reflectivity(bypass_dbr=True, start_wavelength=820e-9, stop_wavelength=880e-
plt.plot_reflectivity(wavelength, r) plt.plot_reflectivity(wavelength, r)
def reflectivity_meshgrid(temperature=T, bypass_dbr=True, start_wavelength=820e-9, stop_wavelength=880e-9, electric_field=0., n_points=100):
wavelength = np.linspace(start_wavelength, stop_wavelength, num=n_points)
time, r = op.reflectivity_meshgrid(bypass_dbr, electric_field, wavelength, temperature)
plt.plot_reflectivity_heatmap(wavelength, time, r)
def electromagnetic_amplitude(bypass_dbr=True, electric_field=0., wavelength=850e-9): def electromagnetic_amplitude(bypass_dbr=True, electric_field=0., wavelength=850e-9):
......
...@@ -3,6 +3,7 @@ from scipy.linalg import expm ...@@ -3,6 +3,7 @@ from scipy.linalg import expm
from tqdm import tqdm from tqdm import tqdm
import pandas_tools as pt
import super_lattice_structure as st import super_lattice_structure as st
from globals import C, EPS0, HEV, N0, NGAAS, T from globals import C, EPS0, HEV, N0, NGAAS, T
from sqw_lengyel_absorption import gaas_sqw_absorption_at_wavelength from sqw_lengyel_absorption import gaas_sqw_absorption_at_wavelength
...@@ -10,7 +11,7 @@ from sqw_lengyel_absorption import gaas_sqw_absorption_at_wavelength ...@@ -10,7 +11,7 @@ from sqw_lengyel_absorption import gaas_sqw_absorption_at_wavelength
def algaas_super_lattice_refractive_index(super_lattice, electric_field, wavelength): def algaas_super_lattice_refractive_index(super_lattice, electric_field, wavelength, temperature=T):
for i in range(len(super_lattice)): for i in range(len(super_lattice)):
name = super_lattice.at[i, 'name'] name = super_lattice.at[i, 'name']
al = super_lattice.at[i, 'al'] al = super_lattice.at[i, 'al']
...@@ -31,7 +32,7 @@ def algaas_super_lattice_refractive_index(super_lattice, electric_field, wavelen ...@@ -31,7 +32,7 @@ def algaas_super_lattice_refractive_index(super_lattice, electric_field, wavelen
# if refractive index has never been calculated # if refractive index has never been calculated
if calculated_qw_layers.empty: if calculated_qw_layers.empty:
# refractive index value # refractive index value
n = afromovitz_varshni_real_algaas_refractive_index(al, wavelength) n = afromovitz_varshni_real_algaas_refractive_index(al, wavelength, temperature=temperature)
# confinement barrier aluminium content # confinement barrier aluminium content
al = confinement_barrier_mean_al_content(super_lattice, i) # [1] al = confinement_barrier_mean_al_content(super_lattice, i) # [1]
...@@ -57,7 +58,7 @@ def algaas_super_lattice_refractive_index(super_lattice, electric_field, wavelen ...@@ -57,7 +58,7 @@ def algaas_super_lattice_refractive_index(super_lattice, electric_field, wavelen
# layer is NOT a quantum well # layer is NOT a quantum well
else: else:
# refractive index value # refractive index value
n = afromovitz_varshni_real_algaas_refractive_index(al, wavelength) n = afromovitz_varshni_real_algaas_refractive_index(al, wavelength, temperature=temperature)
na = super_lattice.at[i, 'na'] na = super_lattice.at[i, 'na']
nd = super_lattice.at[i, 'nd'] nd = super_lattice.at[i, 'nd']
...@@ -136,6 +137,26 @@ def reflection(n, d, wavelength): ...@@ -136,6 +137,26 @@ def reflection(n, d, wavelength):
return np.abs( ((N0*e_m -h_m) / (N0*e_m +h_m))**2 ) 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): def absorption(n, d, wavelength):
# element matrix # element matrix
m = np.identity(2) m = np.identity(2)
...@@ -171,6 +192,44 @@ def reflectivity(bypass_dbr, electric_field, wavelength): ...@@ -171,6 +192,44 @@ def reflectivity(bypass_dbr, electric_field, wavelength):
return r return r
def reflectivity_meshgrid(bypass_dbr, electric_field, wavelength, temperature):
# get the dimension of the dataframe
df = st.structure_eam(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(bypass_dbr=bypass_dbr)
sl = 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 afromovitz_real_algaas_refractive_index(al, wavelength): def afromovitz_real_algaas_refractive_index(al, wavelength):
...@@ -225,8 +284,8 @@ def afromovitz_simplified_real_algaas_refractive_index(al, wavelength): ...@@ -225,8 +284,8 @@ def afromovitz_simplified_real_algaas_refractive_index(al, wavelength):
return n return n
def afromovitz_varshni_real_algaas_refractive_index(al, wavelength): def afromovitz_varshni_real_algaas_refractive_index(al, wavelength, temperature=T):
t_c = T -273.15 t_c = temperature -273.15
e = HEV*C/wavelength e = HEV*C/wavelength
e_1 = -0.000402347826086942*t_c +3.65714869565217 e_1 = -0.000402347826086942*t_c +3.65714869565217
...@@ -411,23 +470,23 @@ def scattering_matrix_layer(vi, vg, xi): ...@@ -411,23 +470,23 @@ def scattering_matrix_layer(vi, vg, xi):
return s return s
def redheffer_star_product(sa, sb): def redheffer_star_product(sg, si):
ba = np.matmul(sb[0, 0], sa[1, 1]) ig = np.matmul(si[0, 0], sg[1, 1])
ab = np.matmul(sa[1, 1], sb[0, 0]) gi = np.matmul(sg[1, 1], si[0, 0])
d = np.matmul(sa[0, 1], np.linalg.inv(np.identity(2) -ba)) d = np.matmul(sg[0, 1], np.linalg.inv(np.identity(2) -ig))
f = np.matmul(sb[1, 0], np.linalg.inv(np.identity(2) -ab)) f = np.matmul(si[1, 0], np.linalg.inv(np.identity(2) -gi))
sab = np.array([[ s = np.array([[
sa[0, 0] +np.matmul(np.matmul(d, sb[0, 0]), sa[1, 0]), sg[0, 0] +np.matmul(np.matmul(d, si[0, 0]), sg[1, 0]),
np.matmul(d, sb[0, 1]) np.matmul(d, si[0, 1])
], [ ], [
np.matmul(f, sa[1, 0]), np.matmul(f, sg[1, 0]),
sb[1, 1] +np.matmul(np.matmul(f, sa[1, 1]), sb[0, 1]) si[1, 1] +np.matmul(np.matmul(f, sg[1, 1]), si[0, 1])
]]) ]])
return sab return s
def em_amplitude_smm(super_lattice, wavelength): def em_amplitude_smm(super_lattice, wavelength):
...@@ -474,12 +533,6 @@ def em_amplitude_smm(super_lattice, wavelength): ...@@ -474,12 +533,6 @@ def em_amplitude_smm(super_lattice, wavelength):
# update global scattering matrix # update global scattering matrix
s_global = redheffer_star_product(s_global, s_i) s_global = redheffer_star_product(s_global, s_i)
# calculate transmitted and reflected fields
e_ref = np.matmul( s_global[0, 0], np.array([1., 0.]) )
e_trm = np.matmul( s_global[1, 0], np.array([1., 0.]) )
amplitude = np.abs(e_ref[0] +e_trm[0])**2
e = np.append(e, amplitude)
# compute reflection side scattering matrix # compute reflection side scattering matrix
# s_reflection = # s_reflection =
...@@ -517,3 +570,12 @@ def confinement_barrier_mean_al_content(super_lattice, i): ...@@ -517,3 +570,12 @@ def confinement_barrier_mean_al_content(super_lattice, i):
return al return al
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
\ No newline at end of file
...@@ -99,6 +99,22 @@ def cut_in_equal_layers_thickness(super_lattice, step): ...@@ -99,6 +99,22 @@ def cut_in_equal_layers_thickness(super_lattice, step):
def add_depth_column(super_lattice):
# check wether the depth column exist
if not 'depth' in super_lattice:
super_lattice.insert(super_lattice.shape[1], 'depth', value=np.nan)
# calculate the depth of every layer
for i in range(super_lattice.shape[0]):
super_lattice.at[i, 'depth'] = super_lattice.loc[0:i, 'thickness'].sum()
return super_lattice
def fexp(number): def fexp(number):
(sign, digits, exponent) = Decimal(number).as_tuple() (sign, digits, exponent) = Decimal(number).as_tuple()
return len(digits) + exponent - 1 return len(digits) + exponent - 1
......
...@@ -318,6 +318,15 @@ def plot_reflectivity(wavelength, r): ...@@ -318,6 +318,15 @@ def plot_reflectivity(wavelength, r):
fig.show() fig.show()
def plot_reflectivity_heatmap(wavelength, time, r):
fig = go.Figure(data=
go.Heatmap(x=time, y=wavelength, z=r, ))
# show the figure
fig.show()
def plot_psie(lz=0.01e-9): def plot_psie(lz=0.01e-9):
......
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