calculation.py 4.14 KB
Newer Older
Lucas Laplanche's avatar
Lucas Laplanche committed
1
import numpy as np
2
from scipy.interpolate import splrep, splev
Lucas Laplanche's avatar
Lucas Laplanche committed
3
4


5
from globals import T
Lucas Laplanche's avatar
Lucas Laplanche committed
6
7
8
import oes as oe
import optic as op
import pandas_tools as pt
9
import plot as plt
Lucas Laplanche's avatar
Lucas Laplanche committed
10
import quantum as qt
11
import scipy.io
Lucas Laplanche's avatar
Lucas Laplanche committed
12
import super_lattice_structure as st
13
import vertex_70 as vtx
Lucas Laplanche's avatar
piou  
Lucas Laplanche committed
14
15
16
17




Lucas Laplanche's avatar
Lucas Laplanche committed
18
def refra_doping(bypass_dbr=True, electric_field=0., wavelength=850e-9):
Lucas Laplanche's avatar
piou  
Lucas Laplanche committed
19
    sl = st.structure_eam(bypass_dbr=bypass_dbr)
Lucas Laplanche's avatar
Lucas Laplanche committed
20
    sl = op.algaas_super_lattice_refractive_index(sl, electric_field, wavelength)
21
    plt.plot_refra_doping(sl)
Lucas Laplanche's avatar
Lucas Laplanche committed
22
23


Lucas Laplanche's avatar
Lucas Laplanche committed
24
def al_doping(bypass_dbr=True):
Lucas Laplanche's avatar
Lucas Laplanche committed
25
    sl = st.structure_eam(bypass_dbr=bypass_dbr)
26
    plt.plot_al_doping(sl)
Lucas Laplanche's avatar
Lucas Laplanche committed
27
28
29
30




Lucas Laplanche's avatar
Lucas Laplanche committed
31
def reflectivity(bypass_dbr=True, start_wavelength=820e-9, stop_wavelength=880e-9, electric_field=0., n_points=100):
Lucas Laplanche's avatar
Lucas Laplanche committed
32
    wavelength = np.linspace(start_wavelength, stop_wavelength, num=n_points)
Lucas Laplanche's avatar
Lucas Laplanche committed
33
    r = op.reflectivity(bypass_dbr, electric_field, wavelength)
34
    plt.plot_reflectivity(wavelength, r)
Lucas Laplanche's avatar
Lucas Laplanche committed
35
36


Lucas Laplanche's avatar
Lucas Laplanche committed
37
38
39
40
41
42
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)


Lucas Laplanche's avatar
Lucas Laplanche committed
43
44


Lucas Laplanche's avatar
Lucas Laplanche committed
45
46
def electromagnetic_amplitude(bypass_dbr=True, electric_field=0., wavelength=850e-9):
    sl = st.structure_eam(bypass_dbr=bypass_dbr)
Lucas Laplanche's avatar
Lucas Laplanche committed
47
    sl = op.algaas_super_lattice_refractive_index(sl, electric_field, wavelength)
48
    sl = pt.cut_in_equal_layers_thickness(sl, 1e-9)
Lucas Laplanche's avatar
Lucas Laplanche committed
49
    em = op.em_amplitude_smm(sl, wavelength)
50
    sl.insert(sl.shape[1], 'electromagnetic_amplitude', value=em)
51
    plt.plot_refra_em(sl)
Lucas Laplanche's avatar
Lucas Laplanche committed
52
53
54
55
56


def zandberg_electromagnetic_amplitude(electric_field=0., wavelength=1e-6):
    sl = st.structure_zandbergen()
    sl = op.algaas_super_lattice_refractive_index(sl, electric_field, wavelength)
57
    sl = pt.cut_in_equal_layers_thickness(sl, 1e-9)
58
59
    em = op.em_amplitude_smm(sl, wavelength)
    sl.insert(sl.shape[1], 'electromagnetic_amplitude', value=em)
60
    plt.plot_refra_em(sl)
Lucas Laplanche's avatar
Lucas Laplanche committed
61
62
63
64




Lucas Laplanche's avatar
Lucas Laplanche committed
65
def ftir_reflectivity(filename='eam_2', document_folder=True, linux=True):
66
    # import data
Lucas Laplanche's avatar
Lucas Laplanche committed
67
    wavelength, r = vtx.import_vertex_70_data(filename, document_folder=document_folder, linux=linux)
68
69
70
71
72
73
74

    # smooth the curve (I know it is cheating but ftir currently is out of service, so data is disgusting)
    bspl = splrep(wavelength, r, s=4.5)
    r = splev(wavelength, bspl)

    #  correct data
    r_max = np.max(r)
Lucas Laplanche's avatar
Lucas Laplanche committed
75
    r = r * 0.96 / r_max
76
77
78
79
80
81
82

    # plot
    plt.plot_reflectivity(wavelength, r)




Lucas Laplanche's avatar
Lucas Laplanche committed
83
def mqw_psi(lz=0.01e-9, electric_field=0., wavelength=850e-9):
84
85
    sl = st.structure_eam(air=False, top_dbr=False, bot_dbr=False, shared_dbr=False, contact=False, substrate=False, amount_qw=5)
    sl = pt.cut_in_equal_layers_thickness(sl, 1e-11)
86
    v_e, v_hh, eig_e, psi_e, eig_hh, psi_hh = qt.solve_schrodinger(sl)
87
88
89
    np.savez_compressed('v_e', v_e)
    np.savez_compressed('v_hh', v_hh)
    np.savez_compressed('eig_e', eig_e)
90
    np.savez_compressed('psi_e', psi_e[0, :])
91
92
    np.savez_compressed('eig_hh', eig_hh)
    np.savez_compressed('psi_hh', psi_hh[0, :])
93
    plt.plot_psie()
Lucas Laplanche's avatar
roucoul    
Lucas Laplanche committed
94
95


96
97
def benchmark_refractive_index():
    al = np.array([0.0, 0.2, 0.4, 0.6, 0.8, 1.0])
Lucas Laplanche's avatar
Lucas Laplanche committed
98
    wavelength = np.arange(500e-9, 1500e-9, 1e-9)
99
    indices_array = np.empty([al.size, wavelength.size])
100

101
    for x in range(al.size):
102
103
104
        n = np.array([])

        for w in wavelength:
105
            n = np.append(n, op.afromovitz_varshni_real_algaas_refractive_index(al[x], w))
106

107
108
        indices_array[x] = n
        name = 'indices_array_' +str(x) +'.mat'
109
110
111
112
113
114
115
        scipy.io.savemat(name, mdict={'arr': n})

    name = 'al_array.mat'
    scipy.io.savemat(name, mdict={'arr': al})
    name = 'wavelength_array.mat'
    scipy.io.savemat(name, mdict={'arr': wavelength})

116
117
    plt.plot_refra_bench(al, wavelength, indices_array)

118

Lucas Laplanche's avatar
roucoul    
Lucas Laplanche committed
119
120


Lucas Laplanche's avatar
Lucas Laplanche committed
121
def oes_test():
Lucas Laplanche's avatar
roucoul    
Lucas Laplanche committed
122
123
124
125
    time, wavelength, peaks, data_mean_sample, data_empty, data_diff = oe.import_data_march_2021()
    data_mean_sample = oe.temporal_mean(data_mean_sample)
    data_empty = oe.temporal_mean(data_empty)
    data_diff = oe.temporal_mean(data_diff)
126
127
    plt.plot_eos_spectrum_gold_plate(wavelength, data_mean_sample, data_empty, data_diff)