def compute_empirical_pvalue(value, surrogates):
    """Compute the empirical p-value from a distribution of surrogates.

    Parameters
    ----------
    value : float
        Test value.
    surrogates : 1d array
        Distribution of surrogates.

    Returns
    -------
    float
        The empirical p-value.

    Examples
    --------
    Compute empirical p-value of value given surrogates is 100 samples from normal distribution.

    >>> value = 0.9
    >>> surrogates = np.random.normal(size=100)
    >>> pval = compute_empirical_pvalue(value, surrogates)
    """

    return sum(surrogates > value) / len(surrogates)