# How does scipy.signal.deconvolve work?

The deconvolve(signal, divisor) function of scipy

> Deconvolves divisor out of signal. Returns the quotient and remainder such that signal = convolve(divisor, quotient) + remainder


The core codes of deconvolve are

num = atleast_1d(signal)
den = atleast_1d(divisor)
N = len(num)
D = len(den)
input = ones(N - D + 1, float)
input[1:] = 0
quot = lfilter(num, den, input)


It's quite different from any deconvolve methods I ever know, such as the frequency spectrum division.

Can anyone explain those behind the codes?

The deconvolution operation in the code is just finding the impulse response of a filter made up of a numerator which is the signal to be deconvolved and a denominator which is (effectively) the filter to do the deconvolution.

As far as deconvolution algorithms go, it is a little simplistic.