Commit 7d7dd379 authored by David Hendriks's avatar David Hendriks
Browse files

Updated some plot functions to better display the masseas

parent d9fe273f
Loading
Loading
Loading
Loading
+25 −5
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ from binarycpython.utils.custom_logging_functions import binary_c_log_code
# These are kept to the minimum necessary for each plotting routine.

CUSTOM_LOGGING_STRING_MASSES = """
Printf("MASS_PLOTTING %30.12e %g %g %g %g\\n",
Printf("MASS_PLOTTING %30.12e %g %g %g %g %g %g\\n",
    //
    stardata->model.time, // 1
    
@@ -48,7 +48,9 @@ Printf("MASS_PLOTTING %30.12e %g %g %g %g\\n",
    stardata->common.zero_age.mass[1], //

    stardata->star[0].mass,
    stardata->star[1].mass
    stardata->star[1].mass,
    stardata->star[0].core_mass[ID_core(stardata->star[0].stellar_type)],
    stardata->star[1].core_mass[ID_core(stardata->star[1].stellar_type)]
);
"""

@@ -341,7 +343,7 @@ def plot_masses(df, show_stellar_types: bool = False, show_plot: bool = True):
    )

    # Mass 1
    fig.axes[0].plot(df["time"], df["mass_1"], label="star 1")
    fig.axes[0].plot(df["time"], df["mass_1"], label="star 1", color='red')
    fig.axes[0].axhline(
        df["pms_mass_1"].values.tolist()[0],
        color="red",
@@ -350,17 +352,33 @@ def plot_masses(df, show_stellar_types: bool = False, show_plot: bool = True):
        label="Initial mass 1",
        alpha=0.5,
    )
    fig.axes[0].plot(
        df["time"], df["core_mass_1"],
        color="red",
        linestyle="-.",
        linewidth=2,
        label="Core mass 1",
        alpha=0.5,
    )

    # mass 2
    fig.axes[0].plot(df["time"], df["mass_2"], color="orange", label="star 2")
    fig.axes[0].axhline(
        df["pms_mass_2"].values.tolist()[0],
        color="red",
        color="orange",
        linestyle="--",
        linewidth=2,
        label="Initial mass 2",
        alpha=0.5,
    )
    fig.axes[0].plot(
        df["time"], df["core_mass_2"],
        color="orange",
        linestyle="-.",
        linewidth=2,
        label="Core mass 2",
        alpha=0.5,
    )

    # Make up
    fig.axes[0].set_title("Stellar mass evolution")
@@ -484,6 +502,8 @@ def parse_function_masses(output: str):
        "pms_mass_2",
        "mass_1",
        "mass_2",
        "core_mass_1",
        "core_mass_2",
    ]

    # Go over the output.