示例#1
0
文件: polman.py 项目: mn14tm/Lifetmm
def fig4():
    """ n=3 or n=1 (air) to n=1.5 (Erbium deposition) semi-infinite half spaces.
    Plot the average total spontaneous emission rate of dipoles as a function of
    distance from the interface.
    """
    # Vacuum wavelength
    lam_vac = 1550
    # Plotting units
    units = lam_vac / (2 * pi)

    # Create plot
    f, ax = plt.subplots(figsize=(15, 7))

    for n in [1, 3]:
        print('Evaluating n={:g}'.format(n))
        # Create structure
        st = LifetimeTmm()
        st.set_vacuum_wavelength(lam_vac)
        st.add_layer(4 * units, n)
        st.add_layer(4 * units, 1.5)
        st.info()
        # Calculate spontaneous emission over whole structure
        result = st.calc_spe_structure_leaky()
        z = result['z']
        # Shift so centre of structure at z=0
        z -= st.get_structure_thickness() / 2
        spe = result['spe']['total']
        # Plot spontaneous emission rates
        ax.plot(z/units, spe, label=('n='+str(n)), lw=2)
        ax.axhline(y=n, xmin=0, xmax=0.4, ls='dotted', color='k', lw=2)

        # Plot internal layer boundaries
        for z in st.get_layer_boundaries()[:-1]:
            # Shift so centre of structure at z=0
            z -= st.get_structure_thickness() / 2
            ax.axvline(z/units, color='k', lw=2)

    ax.axhline(1.5, ls='--', color='k', lw=2)
    ax.set_title('Spontaneous emission rate at boundary for semi-infinite media. RHS n=1.5.')
    ax.set_ylabel('$\Gamma / \Gamma_0$')
    ax.set_xlabel('Position z ($\lambda$/2$\pi$)')
    plt.legend()
    plt.tight_layout()
    if SAVE:
        plt.savefig('../Images/spe_vs_n.png', dpi=300)
    plt.show()