def fig2_seb(path, fig=None, ax=None, t_start=None):
    sim = fls.load_sim_for_plot(path, merge_missing_params=True)

    path_file = os.path.join(path, "spect_energy_budg.h5")
    f = h5py.File(path_file, "r")

    k_f = _k_f(sim.params)
    # eps = _eps(sim, t_start)
    eps, E, ts, tmax = epsetstmax(path)
    if t_start is None:
        t_start = ts
    imin_plot = _index_where(f["times"][...], t_start)
    khE = (f["khE"][...] + 0.1) / k_f
    transfers = 0
    for key in ("Tq_AAA", "Tq_GAAs", "Tq_GAAd", "Tq_AGG", "Tq_GGG"):
        transfers += f[key][imin_plot:].mean(0) / eps

    Pi_tot = cumsum_inv(transfers) * sim.oper.deltak

    print(eps)
    ax.axhline(1.0, color="k", ls=":")

    ax.set_xlabel("$k/k_f$")
    ax.set_ylabel(r"$\Pi(k)/\epsilon$")
    ax.set_xscale("log")
    ax.set_yscale("linear")
    ax.plot(khE, Pi_tot, "k", linewidth=2, label=r"$\Pi$")

    ax.set_ylim([-0.1, 1.1])
def fig7_spectra(path, fig, ax, Fr, c, t_start, run_nb, n_colors=10):
    sim = fls.load_sim_for_plot(path, merge_missing_params=True)
    kh, E_tot, EK, EA = _mean_spectra(sim, t_start)
    eps = _eps(sim, t_start)
    k_f = _k_f(sim.params)

    #     norm = (kh ** (-2) *
    #             sim.params.c2 ** (1. / 6) *
    #             eps ** (5. / 9) *
    #             k_f ** (4. / 9))
    o = 2
    L_f = pl.pi / k_f
    norm = (L_f * Fr**0.5)**(o / 3 - 1) * eps**(o / 3) * kh**-2
    color_list = sns.color_palette(n_colors=n_colors)

    kh_f = kh / k_f
    ax.plot(
        kh_f,
        E_tot / norm,
        # "k",
        c=color_list[run_nb],
        # c="k",
        # linestyle=next(style),
        linewidth=1,
        label=f"$c = {c}$",
    )

    # ax.plot(kh_f, EK / norm, 'r', linewidth=2, label='$E_K$')
    # ax.plot(kh_f, EA / norm, 'b', linewidth=2, label='$E_A$')

    if run_nb == 0:
        s1 = slice(_index_where(kh_f, 3), _index_where(kh_f, 80))
        s2 = slice(_index_where(kh_f, 30), _index_where(kh_f, 200))
        ax.plot((kh_f)[s1], 0.7 * (kh_f**-2 / norm)[s1], "k-", linewidth=1)
        ax.text(10, 0.2, "$k^{-2}$")
        # ax.plot((kh_f)[s2], (kh_f ** -1.5 / norm)[s2], 'k-', linewidth=1)
        # ax.text(70, 1.5, '$k^{-3/2}$')
    ax.set_xscale("log")
    ax.set_yscale("log")

    ax.set_xlabel("$k/k_f$")
    ax.set_ylabel(_label())
    # ax.legend()
    rev_legend(ax, loc=1, fontsize=8)
    fig.tight_layout()
Beispiel #3
0
def fig2_seb(path, fig=None, ax=None, t_start=None):
    sim = fls.load_sim_for_plot(path, merge_missing_params=True)

    path_file = os.path.join(path, "spect_energy_budg.h5")
    f = h5py.File(path_file, "r")

    k_f = _k_f(sim.params)
    # eps = _eps(sim, t_start)
    eps, E, ts, tmax = epsetstmax(path)
    if t_start is None:
        t_start = ts
    imin_plot = _index_where(f["times"][...], t_start)
    khE = (f["khE"][...] + 0.1) / k_f
    transferEKr = f["transfer2D_EKr"][imin_plot:].mean(0) / eps
    transferEKd = f["transfer2D_EKd"][imin_plot:].mean(0) / eps
    transferEAr = f["transfer2D_EAr"][imin_plot:].mean(0) / eps
    transferEAd = f["transfer2D_EAd"][imin_plot:].mean(0) / eps
    # transferEPd = f['transfer2D_EPd'][imin_plot:].mean(0) / eps

    PiEKr = cumsum_inv(transferEKr) * sim.oper.deltak
    PiEKd = cumsum_inv(transferEKd) * sim.oper.deltak
    PiEAr = cumsum_inv(transferEAr) * sim.oper.deltak
    PiEAd = cumsum_inv(transferEAd) * sim.oper.deltak
    # PiEPd = cumsum_inv(transferEPd) * sim.oper.deltak

    print(eps)
    ax.axhline(1.0, color="k", ls=":")
    PiEK = PiEKr + PiEKd
    PiEA = PiEAr + PiEAd
    PiE = PiEK + PiEA

    ax.set_xlabel("$k/k_f$")
    ax.set_ylabel(r"$\Pi(k)/\epsilon$")
    ax.set_xscale("log")
    ax.set_yscale("linear")
    ax.plot(khE, PiE, "k", linewidth=2, label=r"$\Pi$")
    ax.plot(khE, PiEK, "r:", linewidth=2, label=r"$\Pi_K$")
    ax.plot(khE, PiEA, "b--", linewidth=2, label=r"$\Pi_A$")

    ax.set_ylim([-0.1, 1.1])
    ax.legend()
Beispiel #4
0
 def slice_where(R, r1, r2):
     i1 = _index_where(R, r1)
     i2 = _index_where(R, r2)
     return slice(i1, i2)