Finds the center of the three reference clusters.

    :param mds: the ``mds`` information about each samples.

    :type mds: numpy.recarray

    :returns: a tuple with a :py:class:`numpy.array` containing the centers of
              the three reference population cluster as first element, and a
              :py:class:`dict` containing the label of each of the three
              reference population clusters.

    First, we extract the ``mds`` values of each of the three reference
    populations. The, we compute the center of each of those clusters by
    computing the means.

    .. math::
        \\textrm{Cluster}_\\textrm{pop} = \\left(
            \\frac{\\sum_{i=1}^n x_i}{n}, \\frac{\\sum_{i=1}^n y_i}{n}
        \\right)

def find_ref_centers(mds):
    """Finds the center of the three reference clusters.

    :param mds: the ``mds`` information about each samples.

    :type mds: numpy.recarray

    :returns: a tuple with a :py:class:`numpy.array` containing the centers of
              the three reference population cluster as first element, and a
              :py:class:`dict` containing the label of each of the three
              reference population clusters.

    First, we extract the ``mds`` values of each of the three reference
    populations. The, we compute the center of each of those clusters by
    computing the means.

    .. math::
        \\textrm{Cluster}_\\textrm{pop} = \\left(
            \\frac{\\sum_{i=1}^n x_i}{n}, \\frac{\\sum_{i=1}^n y_i}{n}
        \\right)

    """
    # Computing the centers of each of the reference clusters
    ceu_mds = mds[mds["pop"] == "CEU"]
    yri_mds = mds[mds["pop"] == "YRI"]
    asn_mds = mds[mds["pop"] == "JPT-CHB"]

    # Computing the centers
    centers = [[np.mean(ceu_mds["c1"]), np.mean(ceu_mds["c2"])],
               [np.mean(yri_mds["c1"]), np.mean(yri_mds["c2"])],
               [np.mean(asn_mds["c1"]), np.mean(asn_mds["c2"])]]

    return np.array(centers), {"CEU": 0, "YRI": 1, "JPT-CHB": 2}