# Receiver functions for PKP-arrivals

**URL:** <https://discourse.obspy.org/t/receiver-functions-for-pkp-arrivals/1233>\
**Category:** Related: rf\
**Created:** [May 14, 2021, 3:48pm UTC](https://discourse.obspy.org/t/receiver-functions-for-pkp-arrivals/1233 "2021-05-14T15:48:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thea92](https://discourse.obspy.org/user_avatar/discourse.obspy.org/thea92/32/408_2.png) [@Thea92](https://discourse.obspy.org/u/Thea92)\
**Post date:** [May 14, 2021, 3:48pm UTC](https://discourse.obspy.org/t/receiver-functions-for-pkp-arrivals/1233/1 "2021-05-14T15:48:19Z")

</div>

Hello everyone,  
is it possible to calculate Receiver Functions with the PKP-phases using the rf-module?  
When I try to create the RFstream with stream = RFStream(zrt) and rfstats(stream), the traces are not added to the stream.  
In the documentation I found how to differ between P and S phase, but is it also possible to calculate with PKP arrivals? Is there a way to ‘trick’ the module that it is calculating the slowness for the PKP-phases and based on that creating the RFs?  
Many thanks in advance! 🙂

---

<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:** [May 17, 2021, 9:23am UTC](https://discourse.obspy.org/t/receiver-functions-for-pkp-arrivals/1233/2 "2021-05-17T09:23:58Z")

</div>

Hello!

Yes that should be possible. Please try something along this line

```python
rfstats(stream, phase='PKP', dist_range=(130, 160))

```

When the resulting stream is empty, the calculated distances are probably not in the expected distance range.

---

<div class="post-metadata">

**Author:** ![Thea92](https://discourse.obspy.org/user_avatar/discourse.obspy.org/thea92/32/408_2.png) [@Thea92](https://discourse.obspy.org/u/Thea92)\
**Post date:** [May 17, 2021, 1:21pm UTC](https://discourse.obspy.org/t/receiver-functions-for-pkp-arrivals/1233/3 "2021-05-17T13:21:35Z")

</div>

Hi,

thanks for your help.  
Unfortunately, I still have problems with that…

I’m receiving the Error:  
File “…/python3.8/site-packages/rf/rfstream.py”, line 698, in rfstats  
warnings.warn(msg % (phase, dist))

TypeError: not all arguments converted during string formatting

I tried a few things, but I don’t know how to fix this…but even if I exclude the warning.warn message, I receive again 0 traces in the stream…

For my example, the calculated epicentral distance was 146°, which is perfectly between the dist\_range of 130-160°.

Thanks for your help!

---

<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:** [May 18, 2021, 12:50pm UTC](https://discourse.obspy.org/t/receiver-functions-for-pkp-arrivals/1233/4 "2021-05-18T12:50:49Z")

</div>

I opened a PR to track changes resulting from the discussion here.

The mentioned warning is triggered when more than one arrival is returned by taupy. There was an error upon formatting the warning message which hopefully is fixed now.

I do not understand yet, why nothing is returned when you comment the message. Can you try again with the code from the PR? If the problem persists, do you have a small code example illustrating the problem?

> <https://github.com/trichter/rf/pull/39>
>
> See discussion at \[discourse\](https://discourse.obspy.org/t/receiver-functions-f…or-pkp-arrivals).

---

<div class="post-metadata">

**Author:** ![Thea92](https://discourse.obspy.org/user_avatar/discourse.obspy.org/thea92/32/408_2.png) [@Thea92](https://discourse.obspy.org/u/Thea92)\
**Post date:** [May 19, 2021, 7:38am UTC](https://discourse.obspy.org/t/receiver-functions-for-pkp-arrivals/1233/5 "2021-05-19T07:38:02Z")

</div>

Hi, it is working now. Thanks a lot!
