# When is a timeseries a time series?

**URL:** https://ask.igwn.org/t/when-is-a-timeseries-a-time-series/362
**Category:** Data Analysis
**Created:** [June 3, 2022, 7:10pm UTC](https://ask.igwn.org/t/when-is-a-timeseries-a-time-series/362 "2022-06-03T19:10:26Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![buyukcam](https://avatars.discourse-cdn.com/v4/letter/b/5e9695/32.png) [@buyukcam](https://ask.igwn.org/u/buyukcam)
#### Post date: [June 3, 2022, 7:10pm UTC](https://ask.igwn.org/t/when-is-a-timeseries-a-time-series/362/1 "2022-06-03T19:10:26Z")

</div>

Working on Challenge 2:  
Variable “hdata” is timeseries, but not!?

Here is code:

```auto
# Challenge 2 (2 points) -- Rookie
# Signal in colored, Gaussian noise.

# Use the data file "challenge2.gwf", with channel name "H1:CHALLENGE2"
# The data contain a BBH signal with m1=m2=30 solar masses, spin = 0.

import gwpy
from gwpy.timeseries import TimeSeries
import numpy
import pylab
%matplotlib inline

hdata = TimeSeries.read("challenge2.gwf", "H1:CHALLENGE2")
print(f"time series = {hdata}")     
print( "\n ***************************")
print(f"datatype for variable hdata = {type(hdata)}")
print( " ***************************")

print(f" delta_t = {hdata.dt}")
print(f"number of samples = {len(hdata)}")
print(f" elapsed time = {hdata.dt*(len(hdata)-2)}")
print(f" sampling rate = {1/hdata.dt}")
hdata.plot()
import pylab
from pycbc.catalog import Merger
from pycbc.filter import resample_to_delta_t, highpass
##################################################
# Preconditioning the Data
###################################################
strain = highpass(hdata, 15.0)

```

Here is stuff that worked:

```auto
time series = [ 1.16850460e-22 -6.44996982e-22 -3.20366127e-22 ...
 -1.91886478e-23 -2.10989354e-22 2.30287965e-22] ct

***************************
datatype for variable hdata = <class 'gwpy.timeseries.timeseries.TimeSeries'>
***************************
          delta_t = 0.000244140625 s
number of samples = 262144
     elapsed time = 63.99951171875 s
    sampling rate = 4096.0 1 / s

```

Here is failure info:

```auto
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [5], in <cell line: 30>()
     26 from pycbc.filter import resample_to_delta_t, highpass
     27 ##################################################
     28 # Preconditioning the Data
     29 ###################################################
---> 30 strain = highpass(hdata, 15.0)

File ~/.local/lib/python3.9/site-packages/pycbc/filter/resample.py:302, in highpass(timeseries, frequency, filter_order, attenuation)
    272 """Return a new timeseries that is highpassed.
    273 
    274 Return a new time series that is highpassed above the `frequency`.
   (...)
    298 
    299 """
    301 if not isinstance(timeseries, TimeSeries):
--> 302 raise TypeError("Can only resample time series")
    304 if timeseries.kind is not 'real':
    305 raise TypeError("Time series must be real")

TypeError: Can only resample time series

```

Any help is appreciated.

---

<div class="post-metadata">

### Author: ![buyukcam](https://avatars.discourse-cdn.com/v4/letter/b/5e9695/32.png) [@buyukcam](https://ask.igwn.org/u/buyukcam)
#### Post date: [June 4, 2022, 12:36am UTC](https://ask.igwn.org/t/when-is-a-timeseries-a-time-series/362/2 "2022-06-04T00:36:02Z")

</div>

forgot “Timeseries.” wish I could delete this post

---

<div class="post-metadata">

### Author: ![jonah](https://yyz1.discourse-cdn.com/flex031/user_avatar/ask.igwn.org/jonah/32/10_2.png) [@jonah](https://ask.igwn.org/u/jonah)
#### Post date: [June 6, 2022, 3:34pm UTC](https://ask.igwn.org/t/when-is-a-timeseries-a-time-series/362/3 "2022-06-06T15:34:57Z")

</div>

@buyukcam Hi! It looks like you read in the data using `gwpy`, but then tried to use a high pass filter from `pycbc`.

`gwpy` and `pycbc` both have an object they call `timeseries`, but they are not the same object! In general, you’ll want to pick one package at a time to use. Or, to say it a different way, if you read in the data with `gwpy`, then you should also use `gwpy` to process and plot the data.

Good luck!

---

<div class="post-metadata">

### Author: ![buyukcam](https://avatars.discourse-cdn.com/v4/letter/b/5e9695/32.png) [@buyukcam](https://ask.igwn.org/u/buyukcam)
#### Post date: [June 6, 2022, 7:07pm UTC](https://ask.igwn.org/t/when-is-a-timeseries-a-time-series/362/4 "2022-06-06T19:07:45Z")

</div>

Thanks, Jonah! I’m going through the tutorials again in a more organized manner.  
Thanks again!! (great relief)
