def deconvolve(signal, divisor):
num = atleast_1d(signal)<EOL>den = atleast_1d(divisor)<EOL>N = len(num)<EOL>D = len(den)<EOL>if D > N:<EOL><INDENT>quot = []<EOL>rem = num<EOL><DEDENT>else:<EOL><INDENT>input = ones(N - D + <NUM_LIT:1>, float)<EOL>input[<NUM_LIT:1>:] = <NUM_LIT:0><EOL>quot = lfilter(num, den, input)<EOL>rem = num - convolve(den, quot, mode='<STR_LIT>')<EOL><DEDENT>return quot, rem<EOL>
Deconvolves `divisor` out of `signal`.

    Returns the quotient and remainder such that
    ``signal = convolve(divisor, quotient) + remainder``

    Parameters
    ----------
    signal : array_like
        Signal data, typically a recorded signal
    divisor : array_like
        Divisor data, typically an impulse response or filter that was
        applied to the original signal

    Returns
    -------
    quotient : ndarray
        Quotient, typically the recovered original signal
    remainder : ndarray
        Remainder

    Examples
    --------
    Deconvolve a signal that's been filtered:

    >>> from scipy import signal
    >>> original = [0, 1, 0, 0, 1, 1, 0, 0]
    >>> impulse_response = [2, 1]
    >>> recorded = signal.convolve(impulse_response, original)
    >>> recorded
    array([0, 2, 1, 0, 2, 3, 1, 0, 0])
    >>> recovered, remainder = signal.deconvolve(recorded, impulse_response)
    >>> recovered
    array([ 0.,  1.,  0.,  0.,  1.,  1.,  0.,  0.])

    See also
    --------
    numpy.polydiv : performs polynomial division (same operation, but
                    also accepts poly1d objects)