Here is my problem: I am going to process the data coming from the system, for which I will have a good idea of ββan impulse response. Before using Python for some basic scenarios, I introduced the functions scipy.signal.convolve and scipy.signal.deconvolve. To gain some confidence in my final decision, I would like to understand their requirements and limitations.
I used the following test:
1. I built a basic signal made of two Gaussians. 2. I built a Gaussian impulse response.
3. I linked my initial signal to this impulse response.
4. I deconstructed this minimized signal.
5. I compared this last signal with my first. The result of this test depended strongly on how I determined my impulse response: either I was able to restore the original signal, or the deconvolution signal diverged greatly.
Here is the code:
I am using python 3.4.2, numpy 1.8.2 and scipy 0.14.0.
import numpy as np from scipy import signal def gauss(x, amp = 1, mean = 0, sigma = 1): return amp * np.exp(-(x - mean)**2 / (2 * sigma**2)) step = 0.1 x_os = np.arange(0, 200 + step, step) low = -5
In the previous code, the divisor argument for scipy.signal.deconvolve is y_ir. I played with parameters defining the interval at which y_ir is defined, for example. [low, up, step]. To show you what puzzles me, let's take the following three sets:
1) [-5, 5, 0.1] ,
2) [-2, 2, 0.1] ,
3) and [-2, 2, 0.5] (note that the step was not changed in the definition of y_os).
The following images show the original signal along with the deconvolution signal for the three aforementioned sets.
Original signal
Deconvolution Signal Comparison
Can anyone explain this behavior? Are there any divisor requirements that guarantee the correct behavior of this function?
Thanks in advance.
python numpy scipy numerical-stability deconvolution
user6109023
source share