# Gaussian parameter (iterative deconvolution)

**URL:** https://discourse.obspy.org/t/gaussian-parameter-iterative-deconvolution/1886
**Category:** Related: rf
**Created:** [February 27, 2024, 7:06pm UTC](https://discourse.obspy.org/t/gaussian-parameter-iterative-deconvolution/1886 "2024-02-27T19:06:39Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Ademar](https://discourse.obspy.org/user_avatar/discourse.obspy.org/ademar/32/806_2.png) [@Ademar](https://discourse.obspy.org/u/Ademar)
#### Post date: [February 27, 2024, 7:06pm UTC](https://discourse.obspy.org/t/gaussian-parameter-iterative-deconvolution/1886/1 "2024-02-27T19:06:39Z")

</div>

Dear all,

I am a user of ITERDECON (from Dr. Ammon) and SACITERD (from Dr. Herrmann), and I realized that the RFs from both programs with a Gaussian parameter of 2.5 resemble the traces of the rf package when the Gaussian parameter is 0.5. Am I correct? Here is the line of code:

rf\_iter = stream.copy().rf(deconvolve=‘iterative’,gauss=0.5 ,itmax=1000, minderr=0.001, mute\_shift=False, normalize=0).moveout()

To summarize, I just would like to make sure that the 2.5 Gaussian in ITERDECON (or in SACITERD) is equivalent to the 0.5 Gaussian in the rf package.

 ![Screenshot 2024-02-26 at 4.48.05 PM](https://discourse.obspy.org/uploads/default/original/1X/9a6fd6ce224c8dc9e2767d8a8dcce9c3eca273db.png)

---

<div class="post-metadata">

### Author: ![trichter](https://discourse.obspy.org/user_avatar/discourse.obspy.org/trichter/32/226_2.png) [@trichter](https://discourse.obspy.org/u/trichter)
#### Post date: [February 27, 2024, 8:22pm UTC](https://discourse.obspy.org/t/gaussian-parameter-iterative-deconvolution/1886/2 "2024-02-27T20:22:04Z")

</div>

Hi!

Thanks for the relevant question!  
I remember I looked that up before. I had to look it up again 🤷

Edit: The correct factor is 0.22, the answer below.

Short answer: The parameters are related like `gauss_rf = 0.45 * gauss_id`

Long answer:

The wiggles of the orange curve (rf) appear to have a longer period than the blue wiggles (id, iterdecon).

In the rf package the gauss parameter is defined as

> gauss – Gauss parameter (standard deviation) of the Gaussian Low-pass filter, corresponds to cut-off frequency in Hz for a response value of exp(-0.5)=0.607.

You chose 0.5 for rf’s gauss, that is a 0.5 Hz lowpass → periods will be ~2s or larger → “rf peaks” will be \>2s apart, which is what you observe in your plot (fist peak at 0.5s, 2nd at \>2.5s).

Looking at the code, the definition of the filter response in frequency domain is

```python
exp(-0.5 * (f/gauss_rf) ** 2)

```

I do not know the definition of the gauss parameter in iterdecon, but looking at the code of `iterdeconvd.f`, lines 518-566 the Gaussian filter response should be

```python
exp(-pi**2 * (f/gauss_id)** 2)

```

Therefore: `gauss_rf = sqrt(2) / pi * gauss_id = 0.45 * gauss_id`

gauss\_id 2.5 would be equal to gauss\_rf of 1.1. And indeed, higher frequencies are still present for the iterdecon curve, there is a small peak at ~1.5s in the blue curve.

---

<div class="post-metadata">

### Author: ![Ademar](https://discourse.obspy.org/user_avatar/discourse.obspy.org/ademar/32/806_2.png) [@Ademar](https://discourse.obspy.org/u/Ademar)
#### Post date: [February 27, 2024, 8:59pm UTC](https://discourse.obspy.org/t/gaussian-parameter-iterative-deconvolution/1886/3 "2024-02-27T20:59:54Z")

</div>

Thank you so much for your complete response. Here, I uploaded the comparison when the gauss\_rf is 1.1 :

 ![Screenshot 2024-02-27 at 3.46.18 PM](https://discourse.obspy.org/uploads/default/original/1X/4d517f338877f2aec2dee8d17291f2014a3e37c6.png)

I am unsure about what am I doing wrong in my code, so I will show you my goal. Here is the SAC code I am using to compute the RFs:

```sac
r *HHZ* *HHR* *HHT*
rtrend
rmean
taper
bandpass corner 0.05 5 npoles 2 passes 2
w V.SAC R.SAC T.SAC
quit
END1

```

And then run the deconvolution code (ALP is alpha or Gaussian parameter):

```python
saciterd -FN R.SAC -FD V.SAC -N 1000 -ALP 2.5 

```

The result of this code is the blue RF we saw above. Now, for calculating the orange RF, my jupyter notebook is doing the following:

```python
#lowpass filter first
stream.filter('lowpass', freq=5, corners=2, zerophase=True)

#Then apply a highpass filter
stream.filter('highpass', freq=0.05, corners=2, zerophase=True)

#and now, deconvolution:
rf_iter = stream.copy().rf(deconvolve='iterative', gauss=1.1 ,itmax=1000, minderr=0.001, mute_shift=False, normalize=0).moveout()

```

What am I doing wrong? Why now that I have the gauss\_rf=1.1 and gauss\_id=2.5 the traces do not look like having the same pulse width?

I am very grateful for your response. Thanks a lot!

---

<div class="post-metadata">

### Author: ![trichter](https://discourse.obspy.org/user_avatar/discourse.obspy.org/trichter/32/226_2.png) [@trichter](https://discourse.obspy.org/u/trichter)
#### Post date: [February 28, 2024, 9:28pm UTC](https://discourse.obspy.org/t/gaussian-parameter-iterative-deconvolution/1886/4 "2024-02-28T21:28:23Z")

</div>

TBH, I do not know why the two rfs look different. At least they show similar features. Could be that the two codes handle the iterative deconvolution slightly differently. @hfmark contributed the iterative deconvolution code to rf, maybe she knows more.

---

<div class="post-metadata">

### Author: ![hfmark](https://discourse.obspy.org/letter_avatar_proxy/v4/letter/h/85f322/32.png) [@hfmark](https://discourse.obspy.org/u/hfmark)
#### Post date: [March 1, 2024, 5:20pm UTC](https://discourse.obspy.org/t/gaussian-parameter-iterative-deconvolution/1886/5 "2024-03-01T17:20:31Z")

</div>

It’s been a while since I wrote the function so I don’t remember all of what I did to test it, but I think I was mostly checking that it gave similar results to the other decon methods in the package. I’m also not sure why the two look different, to be honest; in theory the method is all the same.

You might want to first check the sac vs obspy filters to make sure they’re doing similar things to your input data. You can also try using the private methods in rf that construct the gaussian filter to take a look at the pulse width you get for a given gauss parameter and see if it matches your expectations. I’ll note that normalization in Ammon’s codes is handled in particular way (the last section of this webpage: ["Receiver Function Source Equalization"](http://eqseis.geosc.psu.edu/cammon/HTML/RftnDocs/seq01.html)) so perhaps that is part of it?

---

<div class="post-metadata">

### Author: ![Ali\_Aslanli](https://discourse.obspy.org/user_avatar/discourse.obspy.org/ali_aslanli/32/894_2.png) [@Ali\_Aslanli](https://discourse.obspy.org/u/Ali_Aslanli)
#### Post date: [January 23, 2025, 10:31am UTC](https://discourse.obspy.org/t/gaussian-parameter-iterative-deconvolution/1886/6 "2025-01-23T10:31:03Z")

</div>

Hello!

I’ve stumbled upon the same question. It seems to me that the most optimum ratio btw. IterDecon and RF package for the gaussian parameter is in between 4-5 as mentioned by OP.

Another thing that should be taken into account is the moveout correction. The IterDecon originally does not use this correction (as far as I know), so for the comparison it is better not to use it in RF package, otherwise the signals will be out of phase.

Posting some results for the comparison:

 ![g1 and g0.15](https://discourse.obspy.org/uploads/default/original/1X/4b01cba28b41e4c1d6c2a6b5ce80acd24980c2ba.png)  
 ![g1 and g0.2](https://discourse.obspy.org/uploads/default/original/1X/6ad85a84fdf71fde9f5cfab3da822f06e5aa1e63.png)  
 ![g1 and g0.25](https://discourse.obspy.org/uploads/default/original/1X/1182343ef3d296ea33f36e2ff3de48a00590f8d7.png)  
 ![g1 and g0.3](https://discourse.obspy.org/uploads/default/original/1X/45c6fff9658fe0a233d20a4928b3a18c84cd9baf.png)  
 ![g2 and g0.4](https://discourse.obspy.org/uploads/default/original/1X/1530b843309068ae6f79b858815877816477a9c6.png)  
 ![g2 and g0.5](https://discourse.obspy.org/uploads/default/original/1X/56dceb00617b6e7a56d307e8e40d74e4c46c4b47.png)

---

<div class="post-metadata">

### Author: ![trichter](https://discourse.obspy.org/user_avatar/discourse.obspy.org/trichter/32/226_2.png) [@trichter](https://discourse.obspy.org/u/trichter)
#### Post date: [January 24, 2025, 1:53pm UTC](https://discourse.obspy.org/t/gaussian-parameter-iterative-deconvolution/1886/7 "2025-01-24T13:53:43Z")

</div>

Hey!

Thanks for your input. I took another look at the `iterdeconvd.f` code and confirmed:

```python
gauss_freq_response = exp(-0.5 * (f/gauss_rf) **2) = exp(-pi**2 * (f/gauss_id) ** 2)

```

_but_ there was a serious error after that. As I see now:

```python
gauss_rf = sqrt(0.5) / pi * gauss_id = 0.22 * gauss_id

```

Voilà!  
0.22 resp. the inverse 4.44 are the correct factors, sorry for the confusion.
