A simple bragg mirror in the visible. As a default, this notebook is setup to work with binder.
In [35]:
# importing libraries
import numpy as np # numpy
import matplotlib.pyplot as plt # matplotlib pyplot
import sys # sys to add py_matrix to the path
# adding py_matrix parent folder to python path
sys.path.append('/home/main/notebooks')
import pyhc as phc # importing py_matrix
# useful parameters
f_size=20;
# inline plot magic
%matplotlib inline
In [16]:
# ref indexes
n2 = 2.5 # GaAs
n1 = 1.45 # AlAs
n_inc = 1.0 # Incidend medium
n_sub = 1.45 # Substrate
# wavelength
wl = 600
v_wl = np.linspace(400,800,100)
# thickness
b = wl/(4 * n2)
a = wl/(4 * n1)
# stacks
N=8
In [17]:
# 1dphc computation
v_R = np.array([phc.rN(a,b,n1,n2,n_inc,n_sub,N,phc.f_omega(l),0.0) for l in v_wl])
In [26]:
# reference t-matrix loading
ref_data = np.loadtxt('sio2_tio2_tmatrix.spt')
v_wl_ref = ref_data[:,0]
v_R_ref = ref_data[:,1]
Here we plot the data using matplotlib and pyplot. If you want to create new plots with different stack parameters, it's better to remove the first row in the plot command, therefore removing the reference plot.
In [34]:
# result plot
plt.figure(figsize=(12,10))
plt.plot(v_wl_ref,v_R_ref,'k',
v_wl,v_R,'ro',linewidth=2.0)
# ticks and labels
plt.xticks(fontsize=f_size)
plt.yticks(fontsize=f_size)
plt.xlabel("Wavelength (nm)", fontsize=f_size)
plt.ylabel("R", fontsize=f_size)
# legend
plt.legend(('tmatrix reference','1DPyHC'),frameon=False,fontsize=f_size-5,loc='lower center')
Out[34]: