macro.py 1.85 KB
Newer Older
Lucas Laplanche's avatar
maj    
Lucas Laplanche committed
1
2
3
4
import numpy as np
from tqdm import tqdm


5
import calculation as cl
Lucas Laplanche's avatar
maj    
Lucas Laplanche committed
6
7
import optic as op
import plot as plt
Lucas Laplanche's avatar
maj    
Lucas Laplanche committed
8
import scipy.io
Lucas Laplanche's avatar
maj    
Lucas Laplanche committed
9
import super_lattice_structure as st
10
11
12
13
14
15
16
17




def eams_heatmaps():
    cl.reflectivity_heatmap(bypass_dbr=False,
                            n_wavelength=1080,
                            n_time=1920,
Lucas Laplanche's avatar
maj    
Lucas Laplanche committed
18
                            r_file_name='heatmap_r_eam_1')
19
20
21
    cl.reflectivity_heatmap(bypass_dbr=True,
                            n_wavelength=1080,
                            n_time=1920,
Lucas Laplanche's avatar
maj    
Lucas Laplanche committed
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
                            r_file_name='heatmap_r_eam_2')


def reflectivity_eam_vcsel_clad_heatmap():
    n_pts = 30
    l_eam_clad =np.linspace(15, 20, num=n_pts)
    l_vcsel_clad =np.linspace(7, 11, num=n_pts)
    r = np.zeros([n_pts, n_pts])

    for i in tqdm(range(n_pts)):
        for j in range(n_pts):
            # wavelength in [m]
            # wavelength must be a numpy array
            sl = st.structure_eam_vcsel(l_eam_clad=l_eam_clad[i],
                                        l_vcsel_clad=l_vcsel_clad[j],
                                        grading_type='linear slope',
                                        mqw_alloy_type='mean')
            sl = op.algaas_super_lattice_refractive_index(sl, 0., 850e-9, lengyel=True)

            n = sl['refractive_index'].to_numpy(dtype=np.complex128)
            d = sl['thickness'].to_numpy(dtype=float)

            r[j, i] = op.reflection(n, d, 850e-9)

Lucas Laplanche's avatar
maj    
Lucas Laplanche committed
46
47
48
49
50
51
52
53
54
55
56
57
58
    plt.plot_std_heatmap(l_eam_clad, l_vcsel_clad, r)


def structure_for_matlab(vcsel_only=True, bypass_dbr=False, wavelength=850e-9):
    sl = st.structure_eam_vcsel(vcsel_only=vcsel_only, bypass_dbr=bypass_dbr)
    sl = op.algaas_super_lattice_refractive_index(sl, 0., wavelength)

    lz = sl['thickness'].to_numpy(dtype=float)
    n = sl['refractive_index'].apply(np.real).to_numpy(dtype=float)

    scipy.io.savemat('eam_vcsel_n_lz.mat', dict(n=n, lz=lz))