def all_phases_positive(pha):
    """
    Converts an array of phases to be positive definite.

    :param pha : 1-dimensional ndarray
    The phases to be modified.

    :return:
    pha: 1-dimensional ndarray
    Positive definite version of pha.
    """

    while not (pha >= 0).all():  # make sure that all elements are >=0
        pha[pha < 0] = pha[pha < 0] + 1.0
    return pha