# Trim2 of traces with respect to a theoretical arrival time (from taup)

**URL:** https://discourse.obspy.org/t/trim2-of-traces-with-respect-to-a-theoretical-arrival-time-from-taup/1139
**Category:** Related: rf
**Created:** [November 25, 2020, 12:59pm UTC](https://discourse.obspy.org/t/trim2-of-traces-with-respect-to-a-theoretical-arrival-time-from-taup/1139 "2020-11-25T12:59:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jritsema](https://discourse.obspy.org/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jritsema](https://discourse.obspy.org/u/jritsema)
#### Post date: [November 25, 2020, 12:59pm UTC](https://discourse.obspy.org/t/trim2-of-traces-with-respect-to-a-theoretical-arrival-time-from-taup/1139/1 "2020-11-25T12:59:09Z")

</div>

I have a stream with three component traces. The field stream.stats.onset is filled with a time close to the theoretical P-time (which is filled in stats.sac.t0). I would like to trim the traces with respect to the theoretical P time (i.e. t0). Is there a way to use t0 as the reference time in trim2() or should I use, for example, ‘starttime’ as the reference time and calculate the time window for trimming with respect to it?

---

<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: [November 25, 2020, 1:02pm UTC](https://discourse.obspy.org/t/trim2-of-traces-with-respect-to-a-theoretical-arrival-time-from-taup/1139/2 "2020-11-25T13:02:57Z")

</div>

You can also use onset or every other stats header holding a UTCDateTime object.

Example:

```python
stream.trim2(-5, 95, 'onset')

```

Please also have a look at the introductory tutorial.

> **[Jupyter Notebook Viewer](https://nbviewer.org/github/trichter/notebooks/blob/master/receiver_function_minimal_example.ipynb)**
>
> Check out this Jupyter notebook!

---

<div class="post-metadata">

### Author: ![jritsema](https://discourse.obspy.org/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jritsema](https://discourse.obspy.org/u/jritsema)
#### Post date: [November 25, 2020, 1:53pm UTC](https://discourse.obspy.org/t/trim2-of-traces-with-respect-to-a-theoretical-arrival-time-from-taup/1139/3 "2020-11-25T13:53:05Z")

</div>

Thanks. Sorry about my confusion about “onset”. I thought it was determined from a some basic picker analysis. Now I understand it is the theoretical P time.
