def test(): # Create structure st = LifetimeTmm() st.set_vacuum_wavelength(lam0) # st.add_layer(1e3, si) st.add_layer(1900, sio2) st.add_layer(100, si) st.add_layer(20, sio2) st.add_layer(100, si) # st.add_layer(1900, sio2) st.add_layer(1e3, air) st.info() st.set_polarization('TM') st.set_field('H') st.set_leaky_or_guiding('guiding') alpha = st.calc_guided_modes(normalised=True) st.set_guided_mode(alpha[0]) result = st.calc_field_structure() z = result['z'] z = st.calc_z_to_lambda(z) E = result['field'] # Normalise fields # E /= max(E) plt.figure() plt.plot(z, abs(E) ** 2) for z in st.get_layer_boundaries()[:-1]: z = st.calc_z_to_lambda(z) plt.axvline(x=z, color='k', lw=1, ls='--') plt.show()
def t2_leaky(): """ T2 EDTS layer next to air. """ # Create structure st = LifetimeTmm() st.set_vacuum_wavelength(lam0) st.add_layer(2 * lam0, sio2) st.add_layer(d_etds, edts) st.add_layer(2 * lam0, air) st.info() # Calculate spontaneous emission for leaky and guided modes result = st.calc_spe_structure_leaky(th_pow=9) z = result['z'] z = st.calc_z_to_lambda(z) spe = result['spe'] # Plot spontaneous emission rates fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, sharex='col', sharey='row', figsize=(15, 7)) ax1.plot(z, spe['TE'], label='TE') ax1.plot(z, spe['TM_p'], label='TM') ax1.plot(z, spe['TE'] + spe['TM_p'], label='TE + TM') ax2.plot(z, spe['TE_lower_full'] + spe['TM_p_lower_full'], label='Fully radiative lower outgoing') ax2.plot(z, spe['TE_lower_partial'] + spe['TM_p_lower_partial'], label='Partially radiative lower outgoing') ax2.plot(z, spe['TE_upper'] + spe['TM_p_upper'], label='Fully radiative upper outgoing') ax3.plot(z, spe['TM_s'], label='TM') ax4.plot(z, spe['TM_s_lower_full'], label='Fully radiative lower outgoing') ax4.plot(z, spe['TM_s_lower_partial'], label='Partially radiative lower outgoing') ax4.plot(z, spe['TM_s_upper'], label='Fully radiative upper outgoing') # Plot internal layer boundaries for z in st.get_layer_boundaries()[:-1]: ax1.axvline(st.calc_z_to_lambda(z), color='k', lw=1, ls='--') ax2.axvline(st.calc_z_to_lambda(z), color='k', lw=1, ls='--') ax3.axvline(st.calc_z_to_lambda(z), color='k', lw=1, ls='--') ax4.axvline(st.calc_z_to_lambda(z), color='k', lw=1, ls='--') # ax1.set_ylim(0, 4) # ax3.set_ylim(0, 6) # ax1.set_title('Spontaneous Emission Rate. LHS n=3.48, RHS n=1.') ax1.set_ylabel('$\Gamma / \Gamma_0$') ax3.set_ylabel('$\Gamma /\Gamma_0$') ax3.set_xlabel('z/$\lambda$') ax4.set_xlabel('z/$\lambda$') ax1.legend(title='Horizontal Dipoles', fontsize='small') ax2.legend(title='Horizontal Dipoles', fontsize='small') ax3.legend(title='Vertical Dipoles', fontsize='small') ax4.legend(title='Vertical Dipoles', fontsize='small') fig.tight_layout() if SAVE: plt.savefig('../Images/t2_leaky.png', dpi=300) plt.show()
def t2_fig4(): """ Silicon to air semi-infinite half spaces. """ # Create structure st = LifetimeTmm() st.set_vacuum_wavelength(lam0) st.add_layer(2 * lam0, sio2) st.add_layer(d_etds, edts) st.add_layer(2 * lam0, air) st.info() # Calculate spontaneous emission over whole structure result = st.calc_spe_structure_leaky(th_pow=9) z = result['z'] spe = result['spe'] # Convert z into z/lam0 and center z = st.calc_z_to_lambda(z) # Plot spontaneous emission rates fig, (ax1, ax2) = plt.subplots(1, 2, sharey='row', figsize=(15, 5)) ax1.plot(z, (spe['TM_p_lower'] + spe['TE_lower']) / (spe['TE'] + spe['TM_p']), label='Lower') ax1.plot(z, (spe['TM_p_upper'] + spe['TE_upper']) / (spe['TE'] + spe['TM_p']), label='Upper') ax2.plot(z, (spe['TM_s_lower']) / spe['TM_s'], label='Lower') ax2.plot(z, (spe['TM_s_upper']) / spe['TM_s'], label='Upper') # Plot internal layer boundaries for z in st.get_layer_boundaries()[:-1]: ax1.axvline(st.calc_z_to_lambda(z), color='k', lw=1, ls='--') ax2.axvline(st.calc_z_to_lambda(z), color='k', lw=1, ls='--') # ax1.set_ylim(0, 1.1) # ax1.set_title('Spontaneous Emission Rate. LHS n=3.48, RHS n=1.') ax1.set_ylabel('$\Gamma / \Gamma_0$') ax1.set_xlabel('z/$\lambda$') ax2.set_xlabel('z/$\lambda$') ax1.legend(title='Horizontal Dipoles') ax2.legend(title='Vertical Dipoles') fig.tight_layout() if SAVE: plt.savefig('../Images/t2_fig4.png', dpi=300) plt.show()
def test2(): # Create structure st = LifetimeTmm() st.set_vacuum_wavelength(lam0) # st.add_layer(1e3, si) st.add_layer(1900, sio2) st.add_layer(100, si) st.add_layer(20, sio2) st.add_layer(100, si) st.add_layer(1e3, air) st.info() result = st.calc_spe_structure_guided() z = result['z'] spe = result['spe'] # Convert z into z/lam0 and center z = st.calc_z_to_lambda(z) fig, (ax1, ax2) = plt.subplots(2, 1, sharex='col', sharey='none') ax1.plot(z, spe['TE'], label='TE') ax1.plot(z, spe['TM_p'], label='TM') ax1.plot(z, spe['TE'] + spe['TM_p'], label='TE + TM') ax2.plot(z, spe['TM_s'], label='TM') for z in st.get_layer_boundaries()[:-1]: ax1.axvline(st.calc_z_to_lambda(z), color='k', lw=1, ls='--') ax2.axvline(st.calc_z_to_lambda(z), color='k', lw=1, ls='--') # ax1.set_ylim(0, 4) # ax2.set_ylim(0, 6) ax1.set_title('Spontaneous Emission Rate. Core n=3.48, Cladding n=1.') ax1.set_ylabel('$\Gamma / \Gamma_0$') ax2.set_ylabel('$\Gamma /\Gamma_0$') ax2.set_xlabel('z/$\lambda$') size = 12 ax1.legend(title='Horizontal Dipoles', prop={'size': size}) ax2.legend(title='Vertical Dipoles', prop={'size': size}) fig.tight_layout() if SAVE: plt.savefig('../Images/creatore_fig5.png', dpi=300) plt.show()
def t2(): """ T2 EDTS layer next to air. """ # Create structure st = LifetimeTmm() st.set_vacuum_wavelength(lam0) st.add_layer(2 * lam0, sio2) st.add_layer(d_etds, edts) st.add_layer(2 * lam0, air) st.info() # Calculate spontaneous emission for leaky and guided modes result = st.calc_spe_structure(th_pow=9) z = result['z'] z = st.calc_z_to_lambda(z) # Plot results fig, (ax1, ax2) = plt.subplots(2, 1, sharex='col', sharey='none') ax1.plot(z, result['leaky']['avg'], label='leaky') try: ax2.plot(z, result['guided']['avg'], label='guided') except KeyError: pass # Plot internal layer boundaries for z in st.get_layer_boundaries()[:-1]: z = st.calc_z_to_lambda(z) ax1.axvline(z, color='k', lw=1, ls='--') ax2.axvline(z, color='k', lw=1, ls='--') # ax1.set_title('Spontaneous emission rate at boundary for semi-infinite media. LHS n=1.57.') ax1.set_ylabel('$\Gamma / \Gamma_0$') ax2.set_ylabel('$\Gamma / \Gamma_0$') ax2.set_xlabel('Position z ($\lambda$/2$\pi$)') ax1.legend() ax2.legend() plt.tight_layout() if SAVE: plt.savefig('../Images/t2.png', dpi=300) plt.show()
def purcell_factor(): """ T2 next to two mediums. Leaky and guided separate plots. Evaluate purcell factor for randomly orientated dipole averaged over film thickness. """ # Medium 1 # Create structure st = LifetimeTmm() st.set_vacuum_wavelength(lam0) st.add_layer(2 * lam0, sio2) st.add_layer(d_etds, edts) st.add_layer(2 * lam0, air) st.info() # Calculate spontaneous emission for leaky and guided modes result = st.calc_spe_structure(th_pow=11) z = result['z'] z = st.calc_z_to_lambda(z) # Plot results fig, (ax1, ax2) = plt.subplots(2, 1, sharex='col', sharey='none') ax1.plot(z, result['leaky']['avg'], label='leaky, air') try: ax2.plot(z, result['guided']['avg'], label='guided, air') except KeyError: pass spe_air = result['leaky']['avg'] + result['guided']['avg'] # Medium 2 # Create structure st = LifetimeTmm() st.set_vacuum_wavelength(lam0) st.add_layer(2 * lam0, sio2) st.add_layer(d_etds, edts) st.add_layer(2 * lam0, water) st.info() # Calculate spontaneous emission for leaky and guided modes result = st.calc_spe_structure(th_pow=11) z = result['z'] z = st.calc_z_to_lambda(z) # Plot results ax1.plot(z, result['leaky']['avg'], label='leaky, water') try: ax2.plot(z, result['guided']['avg'], label='guided, water') except KeyError: pass spe_water = result['leaky']['avg'] + result['guided']['avg'] fp = np.mean(spe_water) / np.mean(spe_air) print('Purcell Factor: {:e}'.format(fp)) # Plot internal layer boundaries for z in st.get_layer_boundaries()[:-1]: z = st.calc_z_to_lambda(z) ax1.axvline(z, color='k', lw=1, ls='--') ax2.axvline(z, color='k', lw=1, ls='--') # ax1.set_title('Spontaneous emission rate at boundary for semi-infinite media. LHS n=1.57.') ax1.set_ylabel('$\Gamma / \Gamma_0$') ax2.set_ylabel('$\Gamma / \Gamma_0$') ax2.set_xlabel('Position z ($\lambda$)') ax1.legend() ax2.legend() plt.tight_layout() if SAVE: plt.savefig('../Images/T2_purcell_factor.png', dpi=300) fig, ax1 = plt.subplots() z = result['z'] ax1.plot(z, spe_air, label='Air') ax1.plot(z, spe_water, label='Water') # Plot internal layer boundaries for z in st.get_layer_boundaries()[:-1]: z = st.calc_z_to_lambda(z) ax1.axvline(z, color='k', lw=1, ls='--') ax1.set_ylabel('$\Gamma / \Gamma_0$') ax1.set_xlabel('Position z ($\lambda$)') # ax1.get_xaxis().get_major_formatter().set_useOffset(False) ax1.legend() plt.tight_layout() if SAVE: plt.savefig('../Images/T2_purcell_factor_total.png', dpi=300) plt.show()