Skip to content
Snippets Groups Projects
make_figures.py 1.46 KiB
Newer Older
vlabarre's avatar
vlabarre committed
import sys
from runpy import run_path

import matplotlib.pyplot as plt

print("import util")

vlabarre's avatar
vlabarre committed
from util import (
    has_to_be_made,
    has_to_save,
    here,
    paths_all,
    paths_all_proj,
    paths_all_ratio_one,
)
vlabarre's avatar
vlabarre committed


def make_fig(name, source=None):
    if source is None:
        source = f"save_{name}.py"
    fig_name = f"fig_{name}.png"
    if has_to_be_made(fig_name, source):
        print(f"Calling {source} to make {fig_name}")
vlabarre's avatar
vlabarre committed
        run_path(str(here / source))


def make_table(name, source=None):
    if source is None:
        source = f"save_table_{name}.py"
    if has_to_be_made(f"table_{name}.tex", source):
        print(f"Calling {source} to make {name}")
vlabarre's avatar
vlabarre committed
        run_path(str(here / source))


vlabarre's avatar
vlabarre committed
print(paths_all_ratio_one)
vlabarre's avatar
vlabarre committed
make_table("better_simuls")
make_table("better_simuls_ratio_one")

make_fig("ratio_E_vs_Fh")

vlabarre's avatar
vlabarre committed
sys.argv.append("")
sys.argv[-1] = 0
make_fig("seb_regimes_L_projNone", "save_seb_regimes.py")
vlabarre's avatar
vlabarre committed
del sys.argv[-1]

vlabarre's avatar
vlabarre committed
sys.argv.append("")
sys.argv[-1] = 1
make_fig("seb_regimes_L_projpoloidal", "save_seb_regimes.py")
vlabarre's avatar
vlabarre committed
del sys.argv[-1]

make_fig("nonlinear_regimes_L", "save_nonlinear_regimes.py")
vlabarre's avatar
vlabarre committed
make_fig(
    "spectra_slices_omega_kh_kz_regimes_L",
vlabarre's avatar
vlabarre committed
    "save_spectra_slices_omega_kh_kz_regimes.py",
)
vlabarre's avatar
vlabarre committed
make_fig("delta_omega_spectra")

vlabarre's avatar
vlabarre committed
make_fig("ratio_E_vs_Fh_ratio_one")
make_fig("seb_transition_ratio_one")
make_fig("nonlinear_ratio_one")
make_fig("spectra_kh_kz_ratio_one")
vlabarre's avatar
vlabarre committed
make_fig("spectra_kh_kz_ratio_one_2D")
vlabarre's avatar
vlabarre committed

if not has_to_save:
    plt.show()