ex-6: terminated results comparison

This commit is contained in:
Giù Marcer 2020-03-29 23:44:28 +02:00 committed by rnhmjoj
parent 073d841bd1
commit 25272bf77b

View File

@ -102,7 +102,7 @@ filled with $m$ points according to a Gaussian distribution with mean $\mu$,
corresponding to the central bin, and variance $\sigma$. corresponding to the central bin, and variance $\sigma$.
Then, the original histogram was convolved with the kernel in order to obtain Then, the original histogram was convolved with the kernel in order to obtain
the smeared signal. Some results in terms of various $\sigma$ are shown in the smeared signal. Some results in terms of various $\sigma$ are shown in
@fig:convolved. [@fig:results1; @fig:results2; @fig:results3].
The convolution was implemented as follow. Consider the definition of The convolution was implemented as follow. Consider the definition of
convolution of two functions $f(x)$ and $g(x)$: convolution of two functions $f(x)$ and $g(x)$:
@ -306,10 +306,10 @@ When $\hat{F}[s \otimes k]$ and $\hat{F}[k]$ are computed, their normal format
must be restored in order to use them as standard complex numbers and compute must be restored in order to use them as standard complex numbers and compute
the ratio between them. Then, the result must return in the half-complex format the ratio between them. Then, the result must return in the half-complex format
for the inverse DFT application. for the inverse DFT application.
GSL provides the function `gsl_fft_halfcomplex_unpack` which passes the vectors GSL provides the function `gsl_fft_halfcomplex_unpack()` which passes the
from half-complex format to standard complex format. The inverse procedure, vectors from half-complex format to standard complex format. The inverse
required to compute the inverse transformation of $\hat{F}[s]$, which is not procedure, required to compute the inverse transformation of $\hat{F}[s]$, which
provided by GSL, was implemented in the code. is not provided by GSL, was implemented in the code.
The fact that the gaussian kernel is centerd in the middle of the vector and The fact that the gaussian kernel is centerd in the middle of the vector and
not in the $\text{zero}^{th}$ bin causes the final result to be shifted of half not in the $\text{zero}^{th}$ bin causes the final result to be shifted of half
the leght of the vector the same as it was produced by a DFT. This makes it the leght of the vector the same as it was produced by a DFT. This makes it
@ -317,13 +317,13 @@ necessary to rearrange the two halfs of the final result.
At the end, the external bins which exceed with respect to the original signal At the end, the external bins which exceed with respect to the original signal
are cut away in order to restore the original number of bins $n$. Results are are cut away in order to restore the original number of bins $n$. Results are
shown in @fig:convolved. shown in [@fig:results1; @fig:results2; @fig:results3].
## Unfolding with Richardson-Lucy ## Unfolding with Richardson-Lucy
The RichardsonLucy deconvolution is an iterative procedure usually used for The RichardsonLucy (RL) deconvolution is an iterative procedure usually used
recovering an image that has been blurred by a known point spread function. for recovering an image that has been blurred by a known point spread function.
It is based on the fact that an ideal point source does not appear as a point It is based on the fact that an ideal point source does not appear as a point
but is spread out into the so-called point spread function, thus the observed but is spread out into the so-called point spread function, thus the observed
@ -376,34 +376,82 @@ When implemented, this method results in an easy step-wise routine:
product and the division at each step; product and the division at each step;
- proceed until a given number of reiterations is achieved. - proceed until a given number of reiterations is achieved.
In this case, the zero-order was set as $c_i = 0.5 \, \forall i$. Results are In this case, the zero-order was set $c_i = 0.5 \, \forall i$ and it was
shown in @fig:convolved. empirically shown that the better result is given with a number of three steps,
otherwise it starts returnig fanciful histograms. Results are shown in
[@fig:results1; @fig:results2; @fig:results3].
---
<div id="fig:convolved"> ## Results comparison
![Convolved. $\sigma = 0.05 \Delta \theta$](images/noise-0.05-big.pdf){width=7cm}
![Deconvolved. $\sigma = 0.05 \Delta \theta$](images/deco-0.05-big.pdf){width=7cm}
![Convolved. $\sigma = 0.1 \Delta \theta$](images/noise-0.1-big.pdf){width=7cm} In [@fig:results1; @fig:results2; @fig:results3] the results obtained for three
![Deconvolved. $\sigma = 0.1 \Delta \theta$](images/deco-0.1-big.pdf){width=7cm} different $\sigma$s are shown. The tested values are $\Delta \theta$, $0.5 \,
\Delta \theta$ and $0.05 \, \Delta \theta$, where $\Delta \theta$ is the bin
width of the original histogram, which is the one previously introduced in
@fig:original. In each figure, the convolved signal is shown above, the
histogram deconvolved with the FFT method is in the middle and the one
deconvolved with RL is located below.
![Convolved. $\sigma = 0.5 \Delta \theta$](images/noise-0.5-big.pdf){width=7cm} As can be seen, increasig the value of $\sigma$ implies a stronger smoothing of
![Deconvolved. $\sigma = 0.5 \Delta \theta$](images/deco-0.5-big.pdf){width=7cm} the curve. The FFT deconvolution process seems not to be affected by $\sigma$
amplitude changes: it always gives the same outcome, remarkably similar to the
original signal. The same can't be said about the RL deconvolution, which, on
the other hand, looks heavily influenced by the variance magnitude: the greater
$\sigma$, the worse the deconvoluted result. In fact, given the same number of
steps, the deconvolved signal is always the same 'distance' far form the
convolved one: if it very smooth, the deconvolved signal is very smooth too and
if the convolved is less smooth, it is less smooth too.
![Convolved. $\sigma = 1 \Delta \theta$](images/noise-1-big.pdf){width=7cm} It was also implemented the possibility to add a Poisson noise to the
![Deconvolved. $\sigma = 1 \Delta \theta$](images/deco-1-big.pdf){width=7cm} convoluted histogram to check weather the deconvolution is affected or not by
this kind of noise. It was took as an example the case with $\sigma = \Delta
\theta$. In @fig:poisson the results are shown for both methods when a Poisson
noise with mean $\mu = 50$ is employed.
In both cases, the addition of the Poisson noise seems to affect partially the
deconvolution. When the FFT method was applied, it adds little spikes nearly
everywhere on the curve but it is particularly evident on the edges of the
curve, where the expected data are very small. This is because the technique is
very accurate and hence returns nearly the exact original data which, in this
case, is the expected one to which the Poisson noise is added.
On the other hand, the Richardson-Lucy routine is less affected by this further
complication being already inaccurate in itself.
Signal convolved with kernel on the left and deconvolved signal on the right. <div id="fig:results1">
Increasing values of $\sigma$ from top to bottom. $\Delta \theta$ is the bin ![Convolved signal.](images/noise-0.05.pdf){width=12cm}
![Deconvolved signal with FFT.](images/deco-fft-0.05.pdf){width=12cm}
![Deconvolved signal with RL.](images/deco-rl-0.05.pdf){width=12cm}
Results for $\sigma = 0.05 \Delta \theta$, where $\Delta \theta$ is the bin
width. width.
</div> </div>
As can be seen from the plots on the left in @fig:convolved, increasig the <div id="fig:results2">
value of $\sigma$ implies a stronger smoothing of the curve, while the ![Convolved signal.](images/noise-0.5.pdf){width=12cm}
deconvolution process seems not to be affected by $\sigma$ amplitude changes:
it always gives the same outcome.
It was also implemented the possibility to add a Poisson noise to the ![Deconvolved signal with FFT.](images/deco-fft-0.5.pdf){width=12cm}
distribution to check weather the deconvolution is affected or not by this
kind of noise. ![Deconvolved signal with RL.](images/deco-rl-0.5.pdf){width=12cm}
Results for $\sigma = 0.5 \Delta \theta$, where $\Delta \theta$ is the bin
width.
</div>
<div id="fig:results3">
![Convolved signal.](images/noise-1.pdf){width=12cm}
![Deconvolved signal with FFT.](images/deco-fft-1.pdf){width=12cm}
![Deconvolved signal with RL.](images/deco-rl-1.pdf){width=12cm}
Results for $\sigma = \Delta \theta$, where $\Delta \theta$ is the bin width.
</div>
<div id="fig:poisson">
![Deconvolved signal with FFT.](images/poisson-fft.pdf){width=12cm}
![Deconvolved signal withh RL.](images/poisson-rl.pdf){width=12cm}
Results for $\sigma = \Delta \theta$, poissoned data.
</div>