<commit_before>import numpy as np


def fbm(n, H=0.5, L=1, method="daviesharte"):
    """
    returns fbm, fgn, times

    Creates a discretely sampled fractional Brownian motion (fbm) realization
    with n increments, Hurst parameter H and length L. Returns a 1 x (n+1)
    length array of values, since B(t=0) = 0, with the fractional Gaussian
    noise realization as a 1 x n length array of values and a 1 x (n+1) array
    of time values corresponding to the fbm realization. Uses one of three
    exact methods of generating a fbm (default is daviesharte)

    args:
        n (int): The number of increments for the fbm.
        H (float): Hurst parameter, between 0 and 1 exclusive.
        L (float): The length of the realization, nonnegative.
    returns:
        fbm (list(float)): A fbm realization from t=0 to t=L of length n+1.
        fgn (list(float)): The corresponding fgn realization of length n.
        t (list(float)): A list of time values associated with the fbm.
    raises:
        TypeError: if the input n is nonnegative or non-integer
        ValueError: if the Hurst parameter is outside (0,1) or L is negative
    """
    if method in ('daviesharte', 'hosking', 'cholesky'):
        fbm_realization = eval(method)
    else:
        raise ValueError('Method must be \'daviesharte\', \'hosking\' or \
                        \'cholesky\'')

    return fbm_realization(n, H, L)


def autocovariance(H, k):
    """
    Autocovariance function for fractional Gaussian noise.
    args:
        H (float): Hurst parameter, between 0 and 1 exclusive.
        k (float): Distance between increments.
    returns:
        (float): The autocovariance for a fgn for parameters H, k

    """
    return 0.5 * (abs(k - 1) ** (2 * H) - 2 * abs(k) ** (2 * H) +
                  abs(k + 1) ** (2 * H))
<commit_msg>small fix<commit_after>import numpy as np


def fbm(n, H=0.5, L=1, method="daviesharte"):
    """
    returns fbm, fgn, times

    Creates a discretely sampled fractional Brownian motion (fbm) realization
    with n increments, Hurst parameter H and length L. Returns a 1 x (n+1)
    length array of values, since B(t=0) = 0, with the fractional Gaussian
    noise realization as a 1 x n length array of values and a 1 x (n+1) array
    of time values corresponding to the fbm realization. Uses one of three
    exact methods of generating a fbm (default is daviesharte)

    args:
        n (int): The number of increments for the fbm.
        H (float): Hurst parameter, between 0 and 1 exclusive.
        L (float): The length of the realization, nonnegative.
    returns:
        fbm (list(float)): A fbm realization from t=0 to t=L of length n+1.
        fgn (list(float)): The corresponding fgn realization of length n.
        t (list(float)): A list of time values associated with the fbm.
    raises:
        TypeError: if the input n is nonnegative or non-integer
        ValueError: if the Hurst parameter is outside (0,1) or L is negative
            of if the method is invalid.
    """
    if method in ('daviesharte', 'hosking', 'cholesky'):
        fbm_realization = eval(method)
    else:
        raise ValueError('Method must be \'daviesharte\', \'hosking\' or \
                        \'cholesky\'')

    return fbm_realization(n, H, L)


def autocovariance(H, k):
    """
    Autocovariance function for fractional Gaussian noise.
    args:
        H (float): Hurst parameter, between 0 and 1 exclusive.
        k (float): Distance between increments.
    returns:
        (float): The autocovariance for a fgn for parameters H, k

    """
    return 0.5 * (abs(k - 1) ** (2 * H) - 2 * abs(k) ** (2 * H) +
                  abs(k + 1) ** (2 * H))

{'fraction_non_alphanumeric': 0.09705325763719924, 'fraction_numerical': 0.014057853473911868, 'mean_word_length': 2.5071090047393363, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6750351', 'n_tokens_mistral': 1165, 'n_tokens_neox': 1090, 'n_words': 481}