def read_output(filename):
    """Reads in a Tarquin txt results file and returns a dict of the information

    Parameters
    ----------
    filename : txt file
        The filename to read from

    Returns
    -------
    result : dict

    """
    with open(filename) as fin:
        data = fin.read()
        metabolite_fits = {}
        fit_quality = {}
        sections = data.split('\n\n')
        metabolite_lines = sections[0].splitlines()[2:]
        for line in metabolite_lines:
            name, concentration, pc_sd, sd = line.split()
            metabolite_fits[name] = {'concentration': concentration, 'sd':
                pc_sd}
        lines = sections[1].splitlines()[2:]
        for line in lines:
            key, value = line.split(':')
            fit_quality[key.strip()] = float(value.strip())
        return {'metabolite_fits': metabolite_fits, 'quality': fit_quality}
