forked from mariapubillfont/RT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reflections_ITU_model.py
32 lines (27 loc) · 1.42 KB
/
reflections_ITU_model.py
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
import numpy as np
def getReflectionCoefficients_multiLayer(k_0, layerThickness, polaritzation, complexPermittivity, incidentAngle):
nLayers = len(layerThickness)
eta_n = complexPermittivity
k_n = k_0*np.sqrt(eta_n)
incidenceAngle_n = np.arcsin(np.sin(incidentAngle)/np.sqrt(eta_n))
N = nLayers
# % Initialize
A = np.ones(N, dtype=np.complex_)
B = np.zeros(N, dtype=np.complex_)
F = np.ones(N, dtype=np.complex_)
G = np.zeros(N, dtype=np.complex_)
##Calculate backwards from last layer to first
for i in range(N-2,-1,-1):
W = np.cos(incidenceAngle_n[i+1])/np.cos(incidenceAngle_n[i])*np.sqrt(eta_n[i]/eta_n[i+1])
Y = np.cos(incidenceAngle_n[i+1])/np.cos(incidenceAngle_n[i])*np.sqrt(eta_n[i+1]/eta_n[i])
A[i] = 0.5*np.exp(1j*k_n[i]*layerThickness[i]/np.cos(incidenceAngle_n[i]))*(A[i+1]*(1+Y)+B[i+1]*(1-Y))
B[i] = 0.5*np.exp(-1j*k_n[i]*layerThickness[i]/np.cos(incidenceAngle_n[i]))*(A[i+1]*(1-Y)+B[i+1]*(1+Y))
F[i] = 0.5*np.exp( 1j*k_n[i]*layerThickness[i]*np.cos(incidenceAngle_n[i]))*(F[i+1]*(1+W)+G[i+1]*(1-W))
G[i] = 0.5*np.exp(-1j*k_n[i]*layerThickness[i]*np.cos(incidenceAngle_n[i]))*(F[i+1]*(1-W)+G[i+1]*(1+W))
if polaritzation == 'TE':
r = B[0]/A[0] #reflection and transmission for TE polaritzation
t = 1/A[0]
else:
r = G[0]/F[0] #reflection and transmission for TM polartization
t = 1/F[0]
return t