import configparser


def get_config_params(config_filedir):
    """
    Loads a config file and returns it as a dictionary.
    :param config_filedir: Directory and filename of config file to load
    :return: Dictionary where keys are the names of the entries in the config file. The values associated with each key
    have the data type specified by the sections in the config file ("FLOAT", "INT", etc.)
    """

    # Load config file in ConfigParser
    config_input = configparser.ConfigParser()
    config_input.read(config_filedir)

    # Initialize dictionary
    info = {}

    # Iterate through config file sections, determine which entries are which data type based on the section they are
    # found in, and load each entry into the dictionary, where each key name is the entry name in the config file
    for section in config_input.sections():
        for (key, val) in config_input.items(section):
            if (section == "FLOAT"):
                info[key] = float(val)
            elif (section == "INT"):
                info[key] = int(val)
            elif (section == "STRING"):
                info[key] = val
            elif (section == "BOOL"):
                if val == "True":
                    info[key] = True
                else:
                    info[key] = False

    return(info)