Reads the eigenvalues from EIGENSOFT results.

    :param i_filename: the name of the input file.

    :type i_filename: str

    :returns: a :py:class:`numpy.ndarray` array containing the eigenvalues.

def read_eigenvalues(i_filename):
    """Reads the eigenvalues from EIGENSOFT results.

    :param i_filename: the name of the input file.

    :type i_filename: str

    :returns: a :py:class:`numpy.ndarray` array containing the eigenvalues.

    """
    # The data is the first line of the result file (should begin with
    # "#eigvals"
    data = None
    with open(i_filename, "r") as i_file:
        data = re.split(
            r"\s+",
            re.sub(r"(^\s+)|(\s+$)", "", i_file.readline()),
        )
        if not data[0].startswith("#eigvals"):
            m = "{}: not a evec file".format(i_filename)
            raise ProgramError(m)
        data = np.array(data[1:], dtype=float)

    return data