Exemplo n.º 1
0
def sample2():
    """
    Here's the transmitted intensity versus wavelength through a single-layer
    film which has some complicated wavelength-dependent index of refraction.
    (I made these numbers up, but in real life they could be read out of a
    graph / table published in the literature.) Air is on both sides of the
    film, and the light is normally incident.
    """
    #index of refraction of my material: wavelength in nm versus index.
    material_nk_data = array([[200, 2.1+0.1j],
                              [300, 2.4+0.3j],
                              [400, 2.3+0.4j],
                              [500, 2.2+0.4j],
                              [750, 2.2+0.5j]])
    material_nk_fn = interp1d(material_nk_data[:,0].real,
                              material_nk_data[:,1], kind='quadratic')
    d_list = [inf, 300, inf] #in nm
    lambda_list = linspace(200, 750, 400) #in nm
    T_list = []
    for lambda_vac in lambda_list:
        n_list = [1, material_nk_fn(lambda_vac), 1]
        T_list.append(coh_tmm('s', n_list, d_list, 0, lambda_vac)['T'])
    plt.figure()
    plt.plot(lambda_list, T_list)
    plt.xlabel('Wavelength (nm)')
    plt.ylabel('Fraction of power transmitted')
    plt.title('Transmission at normal incidence')
Exemplo n.º 2
0
def sample1():
    """
    Here's a thin non-absorbing layer, on top of a thick absorbing layer, with
    air on both sides. Plotting reflected intensity versus wavenumber, at two
    different incident angles.
    """
    # list of layer thicknesses in nm
    d_list = [inf, 100, 300, inf]
    # list of refractive indices
    n_list = [1, 2.2, 3.3+0.3j, 1]
    # list of wavenumbers to plot in nm^-1
    ks = linspace(0.0001, .01, num=400)
    # initialize lists of y-values to plot
    Rnorm = []
    R45 = []
    for k in ks:
		# For normal incidence, s and p polarizations are identical.
		# I arbitrarily decided to use 's'.
        Rnorm.append(coh_tmm('s', n_list, d_list, 0, 1/k)['R'])
        R45.append(unpolarized_RT(n_list, d_list, 45*degree, 1/k)['R'])
    kcm = ks * 1e7 #ks in cm^-1 rather than nm^-1
    plt.figure()
    plt.plot(kcm, Rnorm, 'blue', kcm, R45, 'purple')
    plt.xlabel('k (cm$^{-1}$)')
    plt.ylabel('Fraction reflected')
    plt.title('Reflection of unpolarized light at 0$^\circ$ incidence (blue), '
              '45$^\circ$ (purple)')
Exemplo n.º 3
0
def sample6():
    """
    An example reflection plot with a surface plasmon resonance (SPR) dip.
    Compare with http://doi.org/10.2320/matertrans.M2010003 ("Spectral and
    Angular Responses of Surface Plasmon Resonance Based on the Kretschmann
    Prism Configuration") Fig 6a
    """
    # list of layer thicknesses in nm
    d_list = [inf, 5, 30, inf]
    # list of refractive indices
    n_list = [1.517, 3.719+4.362j, 0.130+3.162j, 1]
    # wavelength in nm
    lam_vac = 633
    # list of angles to plot
    theta_list = linspace(30*degree, 60*degree, num=300)
    # initialize lists of y-values to plot
    Rp = []
    for theta in theta_list:
        Rp.append(coh_tmm('p', n_list, d_list, theta, lam_vac)['R'])
    plt.figure()
    plt.plot(theta_list/degree, Rp, 'blue')
    plt.xlabel('theta (degree)')
    plt.ylabel('Fraction reflected')
    plt.xlim(30, 60)
    plt.ylim(0, 1)
    plt.title('Reflection of p-polarized light with Surface Plasmon Resonance\n'
              'Compare with http://doi.org/10.2320/matertrans.M2010003 Fig 6a')
Exemplo n.º 4
0
def sample4():
    """
    Here is an example where we plot absorption and Poynting vector
    as a function of depth.
    """
    d_list = [inf, 100, 300, inf] #in nm
    n_list = [1, 2.2+0.2j, 3.3+0.3j, 1]
    th_0 = pi/4
    lam_vac = 400
    pol = 'p'
    coh_tmm_data = coh_tmm(pol, n_list, d_list, th_0, lam_vac)

    ds = linspace(-50, 400, num=1000) #position in structure
    poyn = []
    absor = []
    for d in ds:
        layer, d_in_layer = find_in_structure_with_inf(d_list, d)
        data = position_resolved(layer, d_in_layer, coh_tmm_data)
        poyn.append(data['poyn'])
        absor.append(data['absor'])
    # convert data to numpy arrays for easy scaling in the plot
    poyn = array(poyn)
    absor = array(absor)
    plt.figure()
    plt.plot(ds, poyn, 'blue', ds, 200*absor, 'purple')
    plt.xlabel('depth (nm)')
    plt.ylabel('AU')
    plt.title('Local absorption (purple), Poynting vector (blue)')
Exemplo n.º 5
0
def compute_electric_field_p_pol(device,
                                 grid_resolution_um,
                                 device_depth_um,
                                 device_depth_voxels,
                                 angle_radians,
                                 lambda_vac_um,
                                 reverse=False):
    d_list = [
        np.inf, 1, *(grid_resolution_um * np.ones(device_depth_voxels)), 1,
        np.inf
    ]
    n_list = [1, 1, *device, 1, 1]

    if reverse:
        coh_tmm_data = coh_tmm_reverse('p', n_list, d_list, angle_radians,
                                       lambda_vac_um)
    else:
        coh_tmm_data = coh_tmm('p', n_list, d_list, angle_radians,
                               lambda_vac_um)

    get_E_pts = np.linspace(1, 1 + device_depth_um, device_depth_voxels)
    Ex_data = np.zeros(device_depth_voxels, dtype=np.complex)
    Ez_data = np.zeros(device_depth_voxels, dtype=np.complex)

    for d_idx in range(0, device_depth_voxels):
        d = get_E_pts[d_idx]

        layer = 2 + d_idx
        d_in_layer = 0.5 * grid_resolution_um

        data = position_resolved(layer, d_in_layer, coh_tmm_data)

        Ex_data[d_idx] = data['Ex']
        Ez_data[d_idx] = data['Ez']

    adjoint_meausre_point_um = 1 + device_depth_um + 1
    layer, d_in_layer = find_in_structure_with_inf(d_list,
                                                   adjoint_meausre_point_um)
    data_adjoint_measure = position_resolved(layer, d_in_layer, coh_tmm_data)
    Ex_adjoint_measure = data_adjoint_measure['Ex']
    Ez_adjoint_measure = data_adjoint_measure['Ez']
    E_adjoint_measure = Ex_adjoint_measure

    if reverse:
        Ex_data = np.flip(Ex_data)
        Ez_data = np.flip(Ez_data)

    return Ex_data, Ez_data, coh_tmm_data['T'], E_adjoint_measure
"""
degree = pi/180

# list of layer thicknesses in nm
d_list = [inf, 100, 300, inf]
# list of refractive indices
n_list = [1, 2.2, 3.3+0.3j, 1]
# list of wavenumbers to plot in nm^-1
ks = linspace(0.0001, .01, num=400)
# initialize lists of y-values to plot
rnorm = []
r45 = []
for k in ks:
		# For normal incidence, s and p polarizations are identical.
		# I arbitrarily decided to use 's'.
    rnorm.append(tmm.coh_tmm('s', n_list, d_list, 0, 1/k)['R'])
    r45.append(tmm.unpolarized_RT(n_list, d_list, 45*degree, 1/k)['R'])
kcm = ks * 1e7 #ks in cm^-1 rather than nm^-1
plt.figure()
plt.plot(kcm, rnorm, 'blue', kcm, r45, 'purple')
plt.xlabel('k (cm$^{-1}$)')
plt.ylabel('Fraction reflected')
plt.title('Reflection of unpolarized light at 0$^\circ$ incidence (blue), '
          '45$^\circ$ (purple)')
plt.show() 

    

#if __name__ == '__main__':
#    main()