import json


def read_frequencies(frequencies_file):
    """Returns a dictionary of frequencies and their parameters indexed by strain
    name from a given auspice tip frequencies file.

    """
    with open(frequencies_file) as fh:
        frequencies_json = json.load(fh)

    parameters = {}
    frequencies = {}

    for key, values in frequencies_json.items():
        if "frequencies" in values:
            frequencies[key] = values["frequencies"]
        else:
            parameters[key] = values

    return frequencies, parameters