import numpy as np
import matplotlib.pyplot as plt
from math import log10

def step_04_metal_addition_main(inp_dict_org,flag_flux_method="n"):


    if flag_flux_method == "n":
        if "METAL" in inp_dict_org["flag_tau"].upper():

            flag_metal_method = inp_dict_org["flag_metal_method"]

            if (flag_metal_method == "cloudy_interpolation"): # Metal addition is done using Optical Depths
                from ASTRO_MOCKS_routines.step_04_optical_depth_calculation_METALS.method_1_cloudy_interpolation.\
                method_1_generate_tau_metal_by_cloudy_interpolation import \
                method_1_generate_tau_metal_by_cloudy_interpolation_main

                inp_dict_org = method_1_generate_tau_metal_by_cloudy_interpolation_main(inp_dict_org)

    elif flag_flux_method == "y":

        if "METAL" in inp_dict_org["flag_absorber"].upper():

            flag_metal_method = inp_dict_org["flag_metal_method"]


            if (flag_metal_method.lower() == "metal_profile"): # Metal addition is done using fluxes
                from ASTRO_MOCKS_routines.step_04_optical_depth_calculation_METALS.method_2_metal_profile.\
                method_2_metal_profile_addition_routines import method_2_metal_profile_addition_routines_main


                inp_dict_org = method_2_metal_profile_addition_routines_main(inp_dict_org)

    return inp_dict_org
