for z, var, mu, std, varcs, svarcs in zip(redshifts, conf_interval_variance, means, conf_interval_width, var_cumsum, std_cumsum):
            output.write(f"{z:<12.4f} {var:<12.4f} {mu:<12.4f} {std:<12.4f} {varcs:<12.4f} {svarcs:<12.4f}\n")










if __name__ == "__main__":
    colours = np.array(
        list(
            map(mpl.colors.to_hex, cmasher.rainforest(np.linspace(0.15, 0.80, 4)))

            )
        )

    plot_style_dict = {
        "RefL0100N1504": ("#000000", 3, "-"),
        "RefL0025N0376": (colours[2], 2, ":"),
        "RefL0025N0752": (colours[1], 2, "--"),
        "RefL0050N0752": (colours[0], 2, ":"),
        "RecalL0025N0752": (colours[3], 2, "--"),

    }


Пример #2
0
def plot_statistic(data_files, stat_type, output_format=".png"):

    colours = np.array(
        list(
            map(mpl.colors.to_hex,
                cmasher.rainforest(np.linspace(0.15, 0.80, 4)))))
    #colours = ["#FFB300", "#803E75", "#FF6800", "#A6BDD7", "#C10020", "#D39B85", "#817066"]
    #color_list = ["#000000", "#FFB300", "#803E75", "#FF6800", "#A6BDD7", "#C10020", "#D39B85", "#817066"]
    plot_style_dict = {
        "RefL0100N1504": ("#000000", 3, "-"),
        "RefL0025N0376": (colours[2], 2, ":"),
        "RefL0025N0752": (colours[1], 2, "--"),
        "RefL0050N0752": (colours[0], 2, ":"),
        "RecalL0025N0752": (colours[3], 2, "--"),
        #"NoAGNL0050N0752": (colours[0], 2, "-"),
        #"AGNdT9L0050N0752": (colours[1], 2, "-"),
        #"FBZL0050N0752": (colours[2], 2, "--"),
        #"FBconstL0050N0752": (colours[3], 2, "--"),
        #"FBsigmaL0050N0752": (colours[4], 2, "--"),
    }

    # plot_style_dict = {
    #     "RandGaussL0100": ("#000000", 3, "-"),
    #     "RandGaussL0025": (colours[1], 2, "--"),
    # }

    data_dict = {
        "mean": {
            "col":
            None,
            "output_name":
            "All_Sims_mean_v_redshift",
            "ylabel":
            "$\langle \mathrm{DM_{cosmic}} \\rangle\ \left[\mathrm{pc\ cm^{-3}} \\right]$"
        },
        "median": {
            "col":
            2,
            "output_name":
            "All_Sims_median_v_redshift",
            "ylabel":
            "$\mathrm{Median\ DM_{cosmic}}\ \left[\mathrm{pc\ cm^{-3}} \\right]$"
        },
        "variance": {
            "col": 3,
            "output_name": "All_Sims_variance_v_redshift",
            "ylabel": "$\sigma_{Var}^2\ \left[\mathrm{pc\ cm^{-3}} \\right]$"
        },
        "sigma_var": {
            "col": 4,
            "output_name": "All_Sims_sigma_var_v_redshift",
            "ylabel":
            "$\sigma_\mathrm{Var}\ \left[\mathrm{pc\ cm^{-3}} \\right]$"
        },
        "ci_width": {
            "col":
            7,
            "output_name":
            "All_Sims_ci_width_v_redshift",
            "ylabel":
            "\\textrm{Confidence Interval Width}\ $\left[\mathrm{pc\ cm^{-3}} \\right]$"
        },
        "sigma_ci": {
            "col": 8,
            "output_name": "All_Sims_sigma_ci_v_redshift",
            "ylabel":
            "$\sigma_\mathrm{CI}\ \left[\mathrm{pc\ cm^{-3}} \\right]$"
        },
        "f_ng": {
            "col":
            None,
            "output_name":
            "All_Sims_fng_v_redshift",
            "ylabel":
            "$f_\mathrm{NG} =  1 - \sigma_\mathrm{CI}/\sigma_\mathrm{Var}$",
        },
        "sigma_ci_mean": {
            "col": None,
            "output_name": "All_Sims_sigma_ci_mean_v_redshift",
            "ylabel":
            "$\sigma_\mathrm{CI}/\langle \mathrm{DM_{cosmic}} \\rangle$",
        },
        "sigma_var_mean": {
            "col":
            None,
            "output_name":
            "All_Sims_sigma_var_mean_v_redshift",
            "ylabel":
            "$\sigma_\mathrm{Var}/\langle \mathrm{DM_{cosmic}} \\rangle$",
        },
        "sigma_ci_median": {
            "col": None,
            "output_name": "All_Sims_sigma_ci_median_v_redshift",
            "ylabel": "$\sigma_\mathrm{CI}/\mathrm{Median\ DM_{cosmic}}$",
        },
        "sigma_var_median": {
            "col": None,
            "output_name": "All_Sims_sigma_var_median_v_redshift",
            "ylabel": "$\sigma_\mathrm{Var}/\mathrm{Median\ DM_{cosmic}}$",
        },
    }

    plt.rcParams.update(set_rc_params(usetex=True))
    fig, ax = plt.subplots(ncols=1, nrows=1, constrained_layout=True)

    for filename in data_files:
        sim_name = filename.split("_")[2]
        if sim_name:
            data = np.loadtxt(filename, unpack=True, skiprows=2)
            L100stat = interpolate.interp1d(data[0],
                                            data[1],
                                            fill_value="extrapolate")

    for filename in data_files:
        sim_name = filename.split("_")[2]

        data = np.loadtxt(filename, unpack=True, skiprows=2)

        redshifts = data[0]
        if (sim_name in ["RefL0025N0376"]) and (stat_type
                                                in ["sigma_ci", "sigma_var"]):
            ax.plot(redshifts,
                    stat * np.sqrt(2),
                    color="grey",
                    linewidth=1,
                    linestyle=":",
                    alpha=0.8)
            ax.plot(redshifts,
                    stat * 2,
                    color="grey",
                    linewidth=1,
                    linestyle=":",
                    alpha=0.8)

        if isinstance(data_dict[stat_type]["col"], int):
            data_col = data_dict[stat_type]["col"]
            stat = data[data_col]
        else:
            if stat_type == "mean":
                print("TEST")
                stat = data[1]
                figg, axx = plt.subplots(ncols=1,
                                         nrows=2,
                                         constrained_layout=True)
                lcolor, lwidth, lstyle = plot_style_dict[sim_name]

                print(stat)
                axx[0].plot(
                    redshifts,
                    stat,
                    color=lcolor,
                    linewidth=lwidth,
                    linestyle=lstyle,
                    label=f"\\textrm{{{sim_name}}}",
                )
                new_stat = L100stat(redshifts)

                axx[1].plot(
                    redshifts,
                    (stat - new_stat) / new_stat,
                    color=lcolor,
                    linewidth=lwidth,
                    linestyle=lstyle,
                )

                lcolor, lwidth, lstyle = plot_style_dict[sim_name]
                p13 = acosmo.Planck13
                ax_twin = math_tools.cosmology.make_lookback_time_axis(
                    axx[0], cosmo=p13, z_range=(redshifts[0], redshifts[-1]))
                ax_twin.set_xlabel("$\mathrm{Lookback\ Time\ [Gyr]}$")

                axx[0].legend()
                axx[1].set_xlabel("\\textrm{{Redshift}}")
                axx[0].set_ylabel(data_dict[stat_type]["ylabel"])
                print(
                    f"./analysis_plots/shuffled/TEST_{data_dict[stat_type]['output_name']}{output_format}"
                )
                plt.savefig(
                    f"./analysis_plots/shuffled/TEST_{data_dict[stat_type]['output_name']}{output_format}"
                )

            if stat_type == "f_ng":
                stat = 1 - (data[data_dict["sigma_ci"]["col"]] /
                            data[data_dict["sigma_var"]["col"]])
                ax.set_ylim(0, 1)

            elif stat_type == "sigma_ci_mean":
                stat = data[data_dict["sigma_ci"]["col"]] / data[
                    data_dict["mean"]["col"]]

            elif stat_type == "sigma_var_mean":
                stat = data[data_dict["sigma_var"]["col"]] / data[
                    data_dict["mean"]["col"]]

            elif stat_type == "sigma_ci_median":
                stat = data[data_dict["sigma_ci"]["col"]] / data[
                    data_dict["median"]["col"]]

            elif stat_type == "sigma_var_median":
                stat = data[data_dict["sigma_var"]["col"]] / data[
                    data_dict["median"]["col"]]

        lcolor, lwidth, lstyle = plot_style_dict[sim_name]

        ax.plot(
            redshifts,
            stat,
            color=lcolor,
            linewidth=lwidth,
            linestyle=lstyle,
            label=f"\\textrm{{{sim_name}}}",
        )

    p13 = acosmo.Planck13
    ax_twin = math_tools.cosmology.make_lookback_time_axis(
        ax, cosmo=p13, z_range=(redshifts[0], redshifts[-1]))
    ax_twin.set_xlabel("$\mathrm{Lookback\ Time\ [Gyr]}$")

    ax.legend()
    ax.set_xlabel("\\textrm{{Redshift}}")
    ax.set_ylabel(data_dict[stat_type]["ylabel"])
    print(
        f"./analysis_plots/shuffled/{data_dict[stat_type]['output_name']}{output_format}"
    )
    plt.savefig(
        f"./analysis_plots/shuffled/{data_dict[stat_type]['output_name']}{output_format}"
    )
Пример #3
0
def plot_resolution_tests():
    file1 = "RefL0025N0376_Log_Normal_Fit_Mean_Std.txt"
    file2 = "RefL0025N0752_Log_Normal_Fit_Mean_Std.txt"
    file3 = "RecalL0025N0752_Log_Normal_Fit_Mean_Std.txt"
    file4 = "RefL0100N1504_log_normal_fit_mean_std_percent.txt"
    file5 = "RefL0050N0752_log_normal_fit_mean_std_percent.txt"
    vartest = "/home/abatten/ADMIRE_ANALYSIS/ADMIRE_RefL0100N1504/all_snapshot_data/output/T4EOS/correlation_varience_test.txt"

    var_data = np.loadtxt(vartest, skiprows=1, unpack=True)
    redshift = var_data[0]
    std_cumsum = var_data[5]

    z1, mean1, std1, per1 = np.loadtxt(file1, unpack=True, skiprows=1)
    z2, mean2, std2, per2 = np.loadtxt(file2, unpack=True, skiprows=1)
    z3, mean3, std3, per3 = np.loadtxt(file3, unpack=True, skiprows=1)
    z4, mean4, std4, per4 = np.loadtxt(file4, unpack=True, skiprows=1)
    z5, mean5, std5, per5 = np.loadtxt(file5, unpack=True, skiprows=1)

    var_data = np.loadtxt(vartest, skiprows=1, unpack=True)
    redshift = var_data[0]
    std_cumsum = var_data[5]

    filename = "RefL0100N1504_log_normal_fit_mean_std_percent.txt"
    redshift, mean, std, percent = np.loadtxt(filename,
                                              unpack=True,
                                              skiprows=1)

    fig = plt.figure(figsize=(16, 12), constrained_layout=True)
    gs = fig.add_gridspec(7, 1, wspace=0.0, hspace=0.0)
    ax1 = fig.add_subplot(gs[0:4, 0])
    ax2 = fig.add_subplot(gs[4:5, 0], sharex=ax1)
    ax3 = fig.add_subplot(gs[5:6, 0], sharex=ax1)
    ax4 = fig.add_subplot(gs[6:7, 0], sharex=ax1)
    plt.setp(ax1.get_xticklabels(), visible=False)
    plt.setp(ax2.get_xticklabels(), visible=False)
    plt.setp(ax3.get_xticklabels(), visible=False)
    #ax1.spines['bottom'].set_linewidth(0)

    w_pad, h_pad, wspace, hspace = fig.get_constrained_layout_pads()
    #fig.set_constrained_layout_pads(w_pad=0, h_pad=0, wspace=0, hspace=0)

    axin = ax1.inset_axes([0.55, 0.1, 0.35, 0.35])
    axin.set_xlim(2.6, 3)
    axin.set_ylim(2600, 3000)
    axin.xaxis.set_tick_params(labelsize=8)
    axin.yaxis.set_tick_params(labelsize=8)
    # Fit the Data with linear and Non-linear
    #fit_linear = curve_fit(linear, redshift, mean, bounds=([0, 0], [1200, 1e-10]))
    #fit_fz = curve_fit(f_function, redshift, mean)

    colours = np.array(
        list(
            map(mpl.colors.to_hex,
                cmasher.rainforest(np.linspace(0.20, 0.80, 4)))))[[3, 2, 1, 0]]
    colours = np.append(colours, "#000000")

    #mean_linear_fit = linear(redshift, fit_linear[0][0], fit_linear[0][1])
    #mean_fz_fit = f_function(redshift, fit_fz[0][0])
    #mean_linear_1000 = linear(redshift, 1000, 0)
    #mean_linear_1200 = linear(redshift, 1200, 0)
    #mean_linear_855 = linear(redshift, 855, 0)
    ax1.plot(z1,
             mean1,
             color=colours[0],
             label="$\mathrm{RefL0025N0376}\ <\mathrm{DM}>$",
             linewidth=2)
    ax1.plot(z2,
             mean2,
             color=colours[1],
             label="$\mathrm{RefL0025N0752}\ <\mathrm{DM}>$",
             linewidth=2)
    ax1.plot(z5,
             mean5,
             color=colours[3],
             label="$\mathrm{RefL0050N0752}\ <\mathrm{DM}>$",
             linewidth=2)
    ax1.plot(z3,
             mean3,
             color=colours[2],
             label="$\mathrm{RecalL0025N0752}\ <\mathrm{DM}>$",
             linewidth=2)
    ax1.plot(z4,
             mean4,
             color=colours[4],
             label="$\mathrm{RefL0100N1504}\ <\mathrm{DM}>$",
             linewidth=2)

    axin.plot(z1, mean1, color=colours[0], linewidth=2)
    axin.plot(z2, mean2, color=colours[1], linewidth=2)
    axin.plot(z3, mean3, color=colours[2], linewidth=2)
    axin.plot(z4, mean4, color=colours[4], linewidth=2)
    axin.plot(z5, mean5, color=colours[3], linewidth=2)

    #colours = ["#67a9cf", "#ef8a62"]
    #colours = ["#0571b0", "#ca0020"]

    #ax1.plot(redshift, mean_fz_fit, color=colours[0], linewidth=3, label=r'$\mathrm{Non\textnormal{-}linear\ fit:\ <DM>} = \alpha F(z); \alpha=923.47$')
    #ax1.plot(redshift, mean_linear_fit, colours[1], linewidth=3, label=r'$\mathrm{Linear\ fit:\ <DM>} = \beta z; \beta=1004.4$')
    #ax1.plot(redshift, mean_linear_1000, colours[1], linestyle=":", linewidth=2, label=r'$\mathrm{<DM>} = 1000 z$')
    #ax1.plot(redshift, mean_linear_1200, colours[1], linestyle="--", linewidth=1, label=r'$\mathrm{<DM>} = 1200 z$')
    #ax1.plot(redshift, mean_linear_855, colours[1], linestyle="-.", linewidth=1, label=r'$\mathrm{<DM>} = 855 z$')

    #axin.plot(redshift, mean_fz_fit, colours[0], linewidth=3)
    #axin.plot(redshift, mean_linear_fit, colours[1], linewidth=3)
    #axin.plot(redshift, mean_linear_1000, colours[1], linestyle=":", linewidth=2)
    #axin.plot(redshift, mean_linear_1200, colours[1], linestyle="--", linewidth=1)
    #axin.plot(redshift, mean_linear_855, colours[1], linestyle="-.", linewidth=1)

    ax2.plot(np.linspace(-1, 4, 100),
             np.zeros(100),
             "black",
             linestyle=":",
             linewidth=1)
    #ax2.plot(np.linspace(-1, 4, 100), np.zeros(100), "black", linewidth=1)
    ax2.plot(redshift,
             mean4 - mean1[::4],
             color=colours[0],
             linestyle='-',
             linewidth=3,
             label="RefL0100N1504 - RefL0025N0376")
    ax2.plot(redshift,
             mean4 - mean5[::2],
             color=colours[3],
             linestyle='-',
             linewidth=3,
             label="RefL0100N1504 - RefL0050N0752")
    #ax2.plot(redshift, mean - mean_linear_fit, color=colours[1], linestyle="-", linewidth=3)
    #ax2.plot(redshift, mean - mean_linear_1000, colours[1], linestyle=":", linewidth=2)
    #ax2.plot(redshift, mean - mean_linear_1200, colours[1], linestyle="--", linewidth=1)
    #ax2.plot(redshift, mean - mean_linear_855, colours[1], linestyle="-.", linewidth=1)

    ax3.plot(np.linspace(-1, 4, 100),
             np.zeros(100),
             "black",
             linestyle=":",
             linewidth=1)
    ax3.plot(z2, mean2 - mean1, color=colours[1], linestyle='-', linewidth=3)

    ax4.plot(np.linspace(-1, 4, 100),
             np.zeros(100),
             "black",
             linestyle=":",
             linewidth=1)
    ax4.plot(z3, mean3 - mean2, color=colours[2], linestyle='-', linewidth=3)

    ax1.set_ylabel(
        "$\mathrm{Expectation\ Value}$\n$<\mathrm{DM}>\ \left[\mathrm{pc\ cm^{-3}}\\right]$"
    )
    ax2.set_ylabel(
        "$\mathrm{Residuals}$\n $\left[\mathrm{pc\ cm^{-3}}\\right]$",
        multialignment='center')
    ax3.set_ylabel(
        "$\mathrm{Residuals}$\n $\left[\mathrm{pc\ cm^{-3}}\\right]$",
        multialignment='center')
    ax4.set_ylabel(
        "$\mathrm{Residuals}$\n $\left[\mathrm{pc\ cm^{-3}}\\right]$",
        multialignment='center')
    ax4.set_xlabel("Redshift")

    ax2.set_ylim(-200, 200)
    ax3.set_ylim(-100, 100)
    ax4.set_ylim(-100, 100)
    ax2.set_xlim(-0.04, 3.04)
    ax1.legend(frameon=False, fontsize=14)
    ax2.legend(frameon=False, fontsize=14)
    #plt.tight_layout()
    ax1.indicate_inset_zoom(axin)
    #plt.savefig('dmz_relation_RefL0100N1504_mean_fit_linear_fz.png', dpi=175)

    #    fig = plt.figure(constrained_layout=True, figsize=(8,6))
    #    gs = fig.add_gridspec(8, 16, wspace=0.0, hspace=0.0)
    #    ax1 = fig.add_subplot(gs[0:9, :9])
    #    ax2 = fig.add_subplot(gs[0:2, 9:], sharex=ax1)
    #    ax3 = fig.add_subplot(gs[3:5, 9:], sharex=ax2)
    #    ax4 = fig.add_subplot(gs[6:8, 9:], sharex=ax2)
    #
    #    ax2_2 = ax2.twinx()
    #    ax3_2 = ax3.twinx()
    #    ax4_2 = ax4.twinx()
    #
    #    plt.setp(ax2_2.get_yticklabels(), visible=False)
    #    plt.setp(ax3_2.get_yticklabels(), visible=False)
    #    plt.setp(ax4_2.get_yticklabels(), visible=False)
    #
    #
    #    #ax1.spines['bottom'].set_linewidth(0)
    #
    #    ax1.set_xlabel("Redshift")
    #    ax1.set_ylabel(r"$\mathrm{<DM>\ [pc\ cm^{-3}]}$")
    #
    #
    #    ax2_2.set_ylabel("Volume Resolution")
    #    ax3_2.set_ylabel("Particle Resolution")
    #    ax4_2.set_ylabel("Physics Calibration")
    #
    #
    #    w_pad, h_pad, wspace, hspace = fig.get_constrained_layout_pads()
    #    fig.set_constrained_layout_pads(w_pad=0, h_pad=0, wspace=0, hspace=0)
    #
    #
    #    RefL25N752 = models[0]
    #    RecalL25N752 = models[1]
    #
    #
    #plt.tight_layout()
    plt.savefig("TESTING_RESOLUTION_TESTS.png")
Пример #4
0
file3 = "RecalL0025N0752_Log_Normal_Fit_Mean_Std.txt"
file4 = "RefL0100N1504_log_normal_fit_mean_std_percent.txt"
file5 = "RefL0050N0752_log_normal_fit_mean_std_percent.txt"


z1, mean1, std1, per1 = np.loadtxt(file1, unpack=True, skiprows=1)
z2, mean2, std2, per2 = np.loadtxt(file2, unpack=True, skiprows=1)
z3, mean3, std3, per3 = np.loadtxt(file3, unpack=True, skiprows=1)
z4, mean4, std4, per4 = np.loadtxt(file4, unpack=True, skiprows=1)
z5, mean5, std5, per5 = np.loadtxt(file5, unpack=True, skiprows=1)

z4 = z4 + math_tools.cosmology.cMpc_to_z(100)
#colours = ['#ef8a62', '#67a9cf', '#666666']
#colours = ['#1b9e77','#d95f02','#7570b3']
colours = ['#1b9e77','#d95f02','#7570b3','#e7298a']
colours = np.array(list(map(mpl.colors.to_hex, cmasher.rainforest(np.linspace(0.20, 0.80, 4)))))[[3, 2, 1, 0]]
colours = np.append(colours, "#000000")
print(colours)


###########################################################
###########################################################
# PLOT <DM> vs Redshift
###########################################################
###########################################################
plt.plot(z1, mean1, label="RefL0025N0376", color=colours[0])
plt.plot(z2, mean2, label="RefL0025N0752", color=colours[1])
plt.plot(z5, mean5, label="RefL0050N0752", color=colours[3])
plt.plot(z3, mean3, label="RecalL0025N0752", color=colours[2])
plt.plot(z4, mean4, label="RefL0100N1504", color=colours[4], linewidth=2)
Пример #5
0
def plot_statistic(data_files, stat_type, output_format=".png"):

    colours = np.array(
        list(
            map(mpl.colors.to_hex,
                cmasher.rainforest(np.linspace(0.15, 0.80, 4)))))
    #colours = ["#FFB300", "#803E75", "#FF6800", "#A6BDD7"]#, "#C10020", "#D39B85", "#817066"]
    #color_list = ["#000000", "#FFB300", "#803E75", "#FF6800", "#A6BDD7", "#C10020", "#D39B85", "#817066"]
    #plot_style_dict = {
    #    "RefL0100N1504": ("#000000", 3, "-"),
    #    "RefL0025N0376": (colours[2], 2, ":"),
    #    "RefL0025N0752": (colours[1], 2, "--"),
    #    "RefL0050N0752": (colours[0], 2, ":"),
    #    "RecalL0025N0752": (colours[3], 2, "--"),

    #}

    # plot_style_dict = {
    #     "RandGaussL0100": ("#000000", 3, "-"),
    #     "RandGaussL0025": (colours[1], 2, "--"),
    #}

    plot_style_dict = {
        "Scrambled": ("#000000", 2, "-"),
        "Transformed": (colours[1], 2, "--"),
    }

    data_dict = {
        "mean": {
            "col":
            1,
            "output_name":
            "ALL_SIMS_mean_v_redshift",
            "ylabel":
            "$\langle \mathrm{DM_{cosmic}} \\rangle\ \left[\mathrm{pc\ cm^{-3}} \\right]$"
        },
        "median": {
            "col":
            2,
            "output_name":
            "ALL_SIMS_median_v_redshift",
            "ylabel":
            "$\mathrm{Median\ DM_{cosmic}}\ \left[\mathrm{pc\ cm^{-3}} \\right]$"
        },
        "variance": {
            "col": 3,
            "output_name": "shuffled_unshuffled_variance_v_redshift",
            "ylabel": "$\sigma_G^2\ \left[\mathrm{pc\ cm^{-3}} \\right]$"
        },
        "sigma_g": {
            "col": 4,
            "output_name": "shuffled_unshuffled_sigma_var_v_redshift",
            "ylabel":
            "$\sigma_\mathrm{Var}\ \left[\mathrm{pc\ cm^{-3}} \\right]$"
        },
        "ci_width": {
            "col":
            7,
            "output_name":
            "shuffled_unshuffled_ci_width_v_redshift",
            "ylabel":
            "\\textrm{Confidence Interval Width}\ $\left[\mathrm{pc\ cm^{-3}} \\right]$"
        },
        "sigma_ci": {
            "col": 8,
            "output_name": "shuffled_unshuffled_sigma_ci_v_redshift",
            "ylabel":
            "$\sigma_\mathrm{CI}\ \left[\mathrm{pc\ cm^{-3}} \\right]$"
        },
        "sigma_ci_sigma_g": {
            "col":
            None,
            "output_name":
            "shuffled_unshuffled_fng_v_redshift",
            "ylabel":
            "$f_\mathrm{NG} =  1 - \sigma_\mathrm{CI}/\sigma_\mathrm{Var}$",
        },
        "sigma_ci_mean": {
            "col": None,
            "output_name": "shuffled_unshuffled_sigma_ci_mean_v_redshift",
            "ylabel":
            "$\sigma_\mathrm{CI}/\langle \mathrm{DM_{cosmic}} \\rangle$",
        },
        "sigma_g_mean": {
            "col":
            None,
            "output_name":
            "shuffled_unshuffled_sigma_var_mean_v_redshift",
            "ylabel":
            "$\sigma_\mathrm{Var}/\langle \mathrm{DM_{cosmic}} \\rangle$",
        },
        "sigma_ci_median": {
            "col": None,
            "output_name": "shuffled_unshuffled_sigma_ci_median_v_redshift",
            "ylabel": "$\sigma_\mathrm{CI}/\mathrm{Median\ DM_{cosmic}}$",
        },
        "sigma_g_median": {
            "col": None,
            "output_name": "shuffled_unshuffled_sigma_var_median_v_redshift",
            "ylabel": "$\sigma_\mathrm{Var}/\mathrm{Median\ DM_{cosmic}}$",
        },
    }

    plt.rcParams.update(set_rc_params(usetex=True))
    fig, ax = plt.subplots(ncols=1, nrows=1, constrained_layout=True)

    for idx, filename in enumerate(data_files):
        #sim_name = filename.split("_")[2]
        if idx == 0:
            sim_name = "Scrambled"
        else:
            sim_name = "Transformed"

        data = np.loadtxt(filename, unpack=True, skiprows=2)

        redshifts = data[0]

        if isinstance(data_dict[stat_type]["col"], int):
            data_col = data_dict[stat_type]["col"]
            stat = data[data_col]
        else:
            if stat_type == "sigma_ci_sigma_g":
                stat = 1 - (data[data_dict["sigma_ci"]["col"]] /
                            data[data_dict["sigma_g"]["col"]])

            elif stat_type == "sigma_ci_mean":
                stat = data[data_dict["sigma_ci"]["col"]] / data[
                    data_dict["mean"]["col"]]

            elif stat_type == "sigma_g_mean":
                stat = data[data_dict["sigma_g"]["col"]] / data[
                    data_dict["mean"]["col"]]

            elif stat_type == "sigma_ci_median":
                stat = data[data_dict["sigma_ci"]["col"]] / data[
                    data_dict["median"]["col"]]

            elif stat_type == "sigma_g_median":
                stat = data[data_dict["sigma_g"]["col"]] / data[
                    data_dict["median"]["col"]]

        lcolor, lwidth, lstyle = plot_style_dict[sim_name]

        ax.plot(
            redshifts,
            stat,
            color=lcolor,
            linewidth=lwidth,
            linestyle=lstyle,
            label=f"\\textrm{{{sim_name}}}$\ \mathrm{{Maps}}$",
        )

    plt.legend()
    ax.set_xlabel("\\textrm{{Redshift}}")
    ax.set_ylabel(data_dict[stat_type]["ylabel"])
    plt.savefig(
        f"analysis_plots/shuffled_vs_unshuffled/L0100N1504/{data_dict[stat_type]['output_name']}{output_format}"
    )