import numpy as np
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt

def continuum_placement_routines_main(inp_dict):

    flag_cont_method = inp_dict["flag_cont_method"]

    if flag_cont_method is None:
        from WEAVEify_routines.step_05_continuum_placement_from_template.\
        method_0_no_continuum.no_continuum import no_continuum_main

        inp_dict = no_continuum_main(inp_dict)

    elif flag_cont_method.upper() == "PCA":
        from WEAVEify_routines.step_05_continuum_placement_from_template.\
        method_2_principle_component_generation.continuum_placement_using_pca \
        import continuum_placement_using_pca_main

        inp_dict = continuum_placement_using_pca_main(inp_dict)



    elif flag_cont_method.upper() == "TEMPLATE":

        from WEAVEify_routines.step_05_continuum_placement_from_template.\
        method_1_squad_sample_continuum_template.squad_sample_continuum_template \
        import squad_sample_continuum_template_main

        # Select the QSO continuum Template from Library
        flag_cont_template = "SQUAD_DR1"

        # "y" if you want to select template randomly from Library
        flag_cont_random   = "n"

        # Integer or None, Select None if flag_cont_random is set to "y"
        cont_template_num  = 41

        inp_dict.update({"flag_cont_template":flag_cont_template,\
                         "cont_template_num":cont_template_num,\
                         "flag_cont_random":flag_cont_random})


        inp_dict = squad_sample_continuum_template_main(inp_dict)


    return inp_dict


