def read_dist(file):
    """Read in a distribution

    # Distribution of StackScore values at Harvard, 2015-06-24
    #
    #record_count     stackscore        fraction_of_records
    13560805        1       0.98078307
    76281   2       0.00551701
    48500   3       0.00350775
    24538   4       0.00177471
    ...
    140     100     0.00001013
    """
    fh = open(file, 'r')
    dist = {}
    total = 0
    for line in fh.readlines():
        if (line.startswith('#')):
            continue
        (count,stackscore,frac) = line.split()
        count = int(count)
        stackscore = int(stackscore)
        if (stackscore<1 or stackscore>100):
            raise Exception("Stackscore out of range in: %s" % line)
        dist[stackscore] = count
        total += count
    return(dist,total)