def save_heterozygosity(heterozygosity, samples, out_prefix):
    """Saves the heterozygosity data.

    :param heterozygosity: the heterozygosity data.
    :param samples: the list of samples.
    :param out_prefix: the prefix of the output files.

    :type heterozygosity: numpy.array
    :type samples: list of tuples of str
    :type out_prefix: str

    """
    # The output file
    o_file = None
    try:
        o_file = open(out_prefix + ".het", 'wb')
    except IOError:
        msg = "{}.het: can't write file".format(out_prefix)
        raise ProgramError(msg)

    # Saving the data
    for (fid, iid), het in zip(samples, heterozygosity):
        print >>o_file, "\t".join([fid, iid, str(het)])

    # Closing the file
    o_file.close()