1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
import numpy as np
import matplotlib.pyplot as plt
import random
#--------------------------------------------------------------------------------------------------------------
# Détermination de ma matrice de transfert pour une couche
#--------------------------------------------------------------------------------------------------------------
def matriceCouche(lambda_0,ni,thetai,pola,n,e):
""" calcule la matrice d'une couche. L'argument pola vaut 1 pour une onde TE et 0 pour une onde TM """
cosinus = np.sqrt(1-(ni/n*np.sin(thetai))**2)
if pola == 1 : p = n*cosinus #calcule cos(theta_t) grace a snell descartes et relation sin² et cos²
else : p = cosinus/n
phi = 2*np.pi/lambda_0*n*e*cosinus
j = complex(0,1)
M = np.array([[ np.cos(phi) , (np.sin(phi)/p)*j ], [ (p*np.sin(phi))*j , np.cos(phi) ]])
return M
#--------------------------------------------------------------------------------------------------------------
# Determination de la matrice de transfert pour N couches
#--------------------------------------------------------------------------------------------------------------
def matriceMultiCouches(lambda_0,ni,thetai,pola,couches):
""" La structure mutlicouche est décrite par une matrice(2xN)dont chaque ligne donne l'indice et
l'épaisseur de la couche correspondante. La fonction calcule la matrice de la structure """
M = np.array([[1,0],[0,1]])
s = couches.shape
nc = s[0]
for k in range(0,nc):
M = np.dot(M,matriceCouche(lambda_0,ni,thetai,pola,couches[k,0],couches[k,1]))
return M
#--------------------------------------------------------------------------------------------------------------
# Calcule des coefficients r et t grace aux coefficients de Fresnel
#--------------------------------------------------------------------------------------------------------------
def coefficientsRT(lambda_0,ni,thetai,nt,pola,couches):
""" calcule le coeceficient de réflexion et de transmission"""
if pola==1 :
pi = ni*np.cos(thetai)
pt = nt*np.sqrt(1-(ni/nt*np.sin(thetai))**2)
else :
pi = np.cos(thetai)/ni
pt = np.sqrt(1-(ni/nt*np.sin(thetai))**2)/nt
m = matriceMultiCouches(lambda_0,ni,thetai,pola,couches)
a = (m[0,0]+m[0,1]*pt)*pi
b = m[1,0]+m[1,1]*pt
r = (a-b)/(a+b)
if pola==1 : t = 2*pi/(a+b)
else : t = 2*pi/(a+b)*ni/nt
return r,t
#--------------------------------------------------------------------------------------------------------------
def coefficientsRTpuissances(lambda_0,ni,thetai,nt,pola,couches):
""" calcule les coeficients de réflexion et de transmission des puissances"""
r,t = coefficientsRT(lambda_0,ni,thetai,nt,pola,couches)
R = abs(r)**2
if pola == 1 :
pi = ni*np.cos(thetai)
pt = nt*np.sqrt(1-(ni/nt*np.sin(thetai))**2)
else :
pi = np.cos(thetai)/ni
pt = np.sqrt(1-(ni/nt*np.sin(thetai))**2)/nt
T = pt/pi*(abs(t))**2
return R,T
#--------------------------------------------------------------------------------------------------------------
def coefRT(lambda_0,ni,listThetai,nt,pola,couches):
""" le calcul des coeficients de réflexion et de transmission pour une liste d'angles d'incidence """
n_p = len(listThetai)
r1 = np.zeros(n_p)
t1 = np.zeros(n_p)
#r1 = [0 for i in range(n_p)]
#t1 = [0 for i in range(n_p)]
for i in range(1,n_p):
r1[i],t1[i] = coefficientsRT(lambda_0,ni,listThetai[i],nt,pola,couches)
return r1, t1
#--------------------------------------------------------------------------------------------------------------
def coefRTpuissances(lambda_0,ni,listThetai,nt,pola,couches):
""" le calcul des coeficients de réflexion et de transmission puissance pour une liste d'angles d'incidence """
n_p = len(listThetai)
r2 = np.zeros(n_p)
t2 = np.zeros(n_p)
for i in range(1,n_p):
r2[i], t2[i] = coefficientsRTpuissances(lambda_0,ni,listThetai[i],nt,pola,couches)
return r2,t2
#--------------------------------------------------------------------------------------------------------------
#test
#--------------------------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------------------------
#Tracé
#--------------------------------------------------------------------------------------------------------------
ni = 1
n_air = 1
n_chitine = 1.5
lambda_0 = 600e-9
pola = 1
#couches = np.array([[ n_chitine, random.uniform(0.217e-12, 0.217e-9)],[n_air, random.uniform(0.217e-12, 0.217e-9)], [n_chitine, random.uniform(0.217e-12, 0.217e-9)]])
angles = np.linspace(0,90,90)
couches = np.array([[n_chitine, 0.25]])
re,te = coefRTpuissances(1,1,angles*np.pi/180,np.sqrt(1.5),1, couches)
rm,tm = coefRTpuissances(1,1,angles*np.pi/180,np.sqrt(1.5),0, couches)
plt.figure("Reflexion de la multicouches")
plt.plot(angles,re, label='TE')
plt.plot(angles,rm, label='TM')
plt.xlabel("thetai")
plt.ylabel('R')
plt.legend()
plt.grid()
plt.show() |
Partager