Exemplo n.º 1
0
def test_empty_ds():
    ds = Docstring(None)
    ds.replace_block('summary', ['The is the new summary.'])

    ds.remove_parameters('x')

    new = Parameter('w', 'ndarray', ['An array input.'])
    ds.insert_parameters('y', new)
    assert str(ds) == 'None'
Exemplo n.º 2
0
def test_remove_parameter():
    ds = Docstring(good)
    ds.remove_parameters('x')
    assert 'x : int' not in str(ds)

    ds = Docstring(good)
    ds.remove_parameters(['x', 'y'])
    assert 'x : int' not in str(ds)
    assert 'y : float' not in str(ds)

    with pytest.raises(ValueError):
        Docstring(good).remove_parameters(['w'])

    ds = remove_parameters(good, 'x')
    assert 'x : int' not in ds
    assert isinstance(ds, str)
Exemplo n.º 3
0
        rem = num
    else:
        if n is None:
            n = N - D + 1
        input = np.zeros(n, float)
        input[0] = 1
        quot = signal.lfilter(num, den, input)
        num_approx = signal.convolve(den, quot, mode="full")
        if len(num) < len(num_approx):  # 1d only ?
            num = np.concatenate((num, np.zeros(len(num_approx) - len(num))))
        rem = num - num_approx
    return quot, rem


_generate_sample_doc = Docstring(arma_generate_sample.__doc__)
_generate_sample_doc.remove_parameters(["ar", "ma"])
_generate_sample_doc.replace_block("Notes", [])
_generate_sample_doc.replace_block("Examples", [])


class ArmaProcess(object):
    r"""
    Theoretical properties of an ARMA process for specified lag-polynomials.

    Parameters
    ----------
    ar : array_like
        Coefficient for autoregressive lag polynomial, including zero lag.
        Must be entered using the signs from the lag polynomial representation.
        See the notes for more information about the sign.
    ma : array_like
Exemplo n.º 4
0
        rem = num
    else:
        if n is None:
            n = N - D + 1
        input = np.zeros(n, float)
        input[0] = 1
        quot = signal.lfilter(num, den, input)
        num_approx = signal.convolve(den, quot, mode='full')
        if len(num) < len(num_approx):  # 1d only ?
            num = np.concatenate((num, np.zeros(len(num_approx) - len(num))))
        rem = num - num_approx
    return quot, rem


_generate_sample_doc = Docstring(arma_generate_sample.__doc__)
_generate_sample_doc.remove_parameters(['ar', 'ma'])
_generate_sample_doc.replace_block('Notes', [])
_generate_sample_doc.replace_block('Examples', [])


class ArmaProcess(object):
    r"""
    Theoretical properties of an ARMA process for specified lag-polynomials.

    Parameters
    ----------
    ar : array_like
        Coefficient for autoregressive lag polynomial, including zero lag.
        See the notes for some information about the sign.
    ma : array_like
        Coefficient for moving-average lag polynomial, including zero lag.