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

def method_2_metal_profile_addition_routines_main(inp_dict):

    #print("")
    #print("************************************************")
    #print("Currently metal profile addition is not implementes in ASTRO-Mocks")
    #print("Modify function method_2_metal_profile_addition_routines_main() in")
    #print("File : ASTRO_MOCKS_routines/step_04_optical_depth_calculation_METALS/method_2_metal_profile/method_2_metal_profile_addition_routines.py")
    #print("Exiting the code ...")
    #print("************************************************")
    #print("")
    #exit()

    # Include function that creates the metal line flux
    # Comment above 8 lines
    dat       = np.loadtxt("test_weavify_spectrum.dat")
    user_wave = dat[:, 0]
    user_flux = dat[:, 1]
    #--------------------------------------------
    flux_key_name        = "Flux_resamp_arr"
    lambda_key_name      = "lambda_arr_obs"
    inp_dict_Flux        = inp_dict["inp_dict_Flux"]
    lambda_arr           = inp_dict_Flux[lambda_key_name]
    Flux_arr_inp         = inp_dict_Flux[flux_key_name]
    wave_diff            = np.abs(user_wave-lambda_arr)
    assert np.amax(wave_diff) < 1e-8
    Flux_arr             = Flux_arr_inp * user_flux

    inp_dict_Flux.update({flux_key_name:Flux_arr})
    inp_dict.update({"inp_dict_Flux":inp_dict_Flux})
    return inp_dict


