def mp2q(p, q):
    """Compute the MP2Q measure.

    Args:
        p (np.ndarray): The unpartitioned repertoire
        q (np.ndarray): The partitioned repertoire
    """
    p, q = flatten(p), flatten(q)
    entropy_dist = 1 / len(p)
    return sum(entropy_dist * np.nan_to_num((p ** 2) / q * np.log(p / q)))
Compute the MP2Q measure.

    Args:
        p (np.ndarray): The unpartitioned repertoire
        q (np.ndarray): The partitioned repertoire