def t2_spe_vs_n(): n_list = np.append(np.linspace(1, 1.45, num=25), np.linspace(1.45, 1.55, num=50)) n_list = np.append(n_list, np.linspace(1.55, 2, num=25)) # n_list = [1, 1.33, 1.37, 1.47] spe_list = [] leaky_list = [] guided_list = [] for n in n_list: print('Evaluating n={:g}'.format(n)) # Create structure st = LifetimeTmm() st.set_vacuum_wavelength(lam0) st.add_layer(0, sio2) st.add_layer(d_etds, edts) st.add_layer(0, n) st.info() # Calculate spontaneous emission of layer 0 (1st) result = st.calc_spe_structure() leaky = result['leaky']['avg'] try: guided = result['guided']['avg'] except KeyError: guided = 0 # Average over layer leaky = np.mean(leaky) guided = np.mean(guided) # Append to list leaky_list.append(leaky) guided_list.append(guided) spe_list.append(leaky + guided) # Convert lists to arrays n_list = np.array(n_list) leaky_list = np.array(leaky_list) guided_list = np.array(guided_list) spe_list = np.array(spe_list) fig, (ax1, ax2, ax3) = plt.subplots(3, 1, sharex='col', sharey='none') ax1.plot(n_list, spe_list, '.-', label='leaky + guided') ax2.plot(n_list, leaky_list, '.-', label='leaky') ax3.plot(n_list, guided_list, '.-', label='guided') ax3.set_xlim(1, 2) ax1.set_title('Average Spontaneous Emission Rate for Random Orientated Dipole in T2.') ax1.set_ylabel('$\Gamma / \Gamma_0$') ax2.set_ylabel('$\Gamma / \Gamma_0$') ax2.set_xlabel('n') ax1.legend() ax2.legend() ax3.legend() plt.tight_layout() if SAVE: plt.savefig('../Images/t2_vs_n.png', dpi=300) np.savez('../Data/t2_vs_n', n=n_list, spe=spe_list, guided=guided_list, leaky=leaky_list) 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()