Commit 95923a33 authored by Lucas Laplanche's avatar Lucas Laplanche
Browse files

Merge remote-tracking branch 'origin/master'

parents aac18c2a f65e4f53
......@@ -275,6 +275,25 @@ def benchmark_refractive_index():
def surface_fit_550_test():
# import data
data = np.load('data/550C_AlGaAs_refractive_indices/indices_arrays.npz')
al = data['al_array']
wavelength = data['wavelength_array']
n = data['n_array']
n_calc = np.zeros([wavelength.shape[0], al.shape[0]])
for i in range(wavelength.shape[0]):
for j in range(al.shape[0]):
n_calc[i, j] = np.real(op.almuneau_complex_550C_algaas_refractive_index(al[j], wavelength[i]))
plt.plot_2_std_heatmaps(al, wavelength, n, al, wavelength, n_calc)
def oes_test():
time, wavelength, peaks, data_mean_sample, data_empty, data_diff = oe.import_data_march_2021()
data_mean_sample = oe.temporal_mean(data_mean_sample)
......
......@@ -29,7 +29,9 @@ NALOX = 1.6 # oxided Al refractive index
# refractive indices at 550°C
# loads al_array, wavelength_array, n_array (real part) and k_array (imaginary part)
REFRA_DATA_550 = np.load('data/550C_AlGaAs_refractive_indices/indices_arrays.npz')
REFRA_DATA_550 = np.load('data/550C_AlGaAs_refractive_indices/indices_arrays.npz', allow_pickle=True)
# loads n and k coefficients to use with polyval in polynomial_fit
REFRA_MODEL_550 = np.load('data/550C_AlGaAs_refractive_indices/model.npz', allow_pickle=True)
# distributed Bragg Reflectors constants @ 850nm
......
import numpy as np
from globals import C, HEV, NALOX, N0, REFRA_DATA_550, T
from globals import C, HEV, NALOX, N0, REFRA_MODEL_550, T
from sqw_lengyel_absorption import gaas_sqw_absorption_at_wavelength
......@@ -144,22 +144,18 @@ def almuneau_complex_550C_algaas_refractive_index(al, wavelength, temperature=55
print('error : temperature out of range')
if 'refra_data_550' in globals() :
if 'refra_model_550' in globals() :
pass
else :
global refra_data_550
refra_data_550 = REFRA_DATA_550
global refra_model_550
refra_model_550 = REFRA_MODEL_550
idx_al = find_nearest_index(al, refra_data_550['al_array'])
idx_wavelength = find_nearest_index(wavelength, refra_data_550['wavelength_array'])
n = 1j * np.polynomial.polynomial.polyval2d(al, wavelength, refra_model_550['k'])
n += np.polynomial.polynomial.polyval2d(al, wavelength, refra_model_550['n'])
n = refra_data_550['n_array'][idx_wavelength, idx_al]
k = refra_data_550['k_array'][idx_wavelength, idx_al]
return n + 1j * k
return n
......
......@@ -135,6 +135,20 @@ def cut_sl_at_time(sl, time):
return sl_cut
def cut_sl_at_first_layer_named(sl, name):
# get index of corresponding layer
idx = sl.loc[sl['name'].str.contains(name)].head().index.values[0]
# copy and remove the unneeded
sl_cut = sl.loc[0:idx]
# reset the indices so the following lines can work
sl_cut = sl_cut.reset_index(drop=True)
return sl_cut
......
......@@ -4,15 +4,17 @@ OBJECTIFS
Faire le fit du FTIR.
Vérifier les recettes avec Alexandre
Faire l'épitaxie.
ACCOMPLI
Nettoyer le code de la structure python.
Faire les calculs VCSEL EAM avec oxydation eam.
Réinstaller crystal XE et faire les recettes EAM-VCSELs.
Corriger le tmm !!!!!!!!!
Corriger le scattering tmm !!!!!!!!!
Vérifier les recettes avec Alexandre
Faire l'épitaxie.
ECHOUÉ
......
......@@ -562,6 +562,23 @@ def plot_std_heatmap(x, y, r):
fig.show()
def plot_2_std_heatmaps(x1, y1, r1, x2, y2, r2):
# define xaxes, yaxes
fig = go.Figure(data=
go.Heatmap(x=x1, y=y1, z=r1, colorscale='jet'))
# show the figure
fig.show()
fig = go.Figure(data=
go.Heatmap(x=x2, y=y2, z=r2, colorscale='jet'))
# show the figure
fig.show()
def plot_reflectivity_heatmap(time, wavelength, r):
fig = go.Figure(data=
go.Heatmap(x=time, y=wavelength, z=r, colorscale='jet'))
......
import numpy as np
def generate_550C_polynomial_regression():
# this function generate a polynomial function that fit the x y response
# to use it store the coefficients in m, store them
# and call it using :
# zz = polyval2d(xx, yy, m)
# import data
data = np.load('data/550C_AlGaAs_refractive_indices/indices_arrays.npz')
al = data['al_array']
wavelength = data['wavelength_array']
n = data['n_array']
k = data['k_array']
# reshape the arrays
al, wavelength, n = reshape_xyz_matrices_into_vectors(al, wavelength, n)
k = np.reshape(k, k.shape[0] * k.shape[1])
# Fit a 3rd order, 2d polynomial
n = polyfit2d(al, wavelength, n)
k = polyfit2d(al, wavelength, k)
# save the coeffs
np.savez('data/550C_AlGaAs_refractive_indices/model.npz', n=n, k=k, allow_pickle=True)
def polyfit2d(x, y, z, deg=np.array([4, 4])):
# create the vandermonde matrix which the least square will be applied on
vander = np.polynomial.polynomial.polyvander2d(x, y, deg)
# least square regression
# c contains the coefficient
# must be used by calling the function polyval
c = np.linalg.lstsq(vander, z)
return c
def reshape_xyz_matrices_into_vectors(x, y, z):
# x, y, z must be numpy arrays
# x, y must be vectors of lenght n and m
# z must be a nxm matrix
# get the length of x and y
x_length = x.shape[0]
y_length = y.shape[0]
total_length = x_length * y_length
# reshape z matrix into a vector
z = np.reshape(z, total_length)
# reshape x as a vector [x1 x2 x3 ... xn x1 x2 x3 ... xn]
x_new = np.zeros([total_length])
for i in range(y_length):
for j in range(x_length):
x_new[i * x_length +j] = x[j]
x = x_new
# reshape y as a vector [y1 y1 y1 ... y2 y2 y2 ... yn yn yn]
y_new = np.zeros([total_length])
for i in range(y_length):
for j in range(x_length):
y_new[i * x_length + j] = y[i]
y = y_new
return x, y, z
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