TimeSeries.to_pycbc() not behaving as expected
Created by: dethodav
The function TimeSeries.to_pycbc() appears to both change the duration and value of a timeseries when it is applied.
>>> from gwpy.timeseries import TimeSeries
>>> data = TimeSeries.fetch_open_data('H1', 1126259446, 1126259478)
>>> data_pycbc = data.to_pycbc()
>>> data_gwpy = TimeSeries.from_pycbc(data_pycbc)
>>> print "gwpy dur:", data.duration, "pycbc dur:", data_pycbc.duration, "new gwpy dur:", data_gwpy.duration
gwpy dur: 32.0 s pycbc dur: 256.0 new gwpy dur: 256.0 s
>>> print "gwpy dt:", data.dt, "pycbc dt:", data_pycbc.delta_t, "new gwpy dt:", data_gwpy.dt
gwpy dt: 0.000244140625 s pycbc dt: 0.000244140625 new gwpy dt: 0.000244140625 s
>>> print data.value
[ 2.17704028e-19 2.08763900e-19 2.39681183e-19 ...,
3.55365541e-20 6.33533516e-20 7.58121195e-20]
>>> print data_pycbc
[ 35. 130. 39. ..., 96. 246. 59.]
However, when a pycbc timeseries is manually created from a gwpy timeseries, this issue is not seen.
>>> from pycbc import types
>>> data_pycbc = types.TimeSeries(data.value,delta_t=data.dt.to('s').value,epoch=data.epoch.gps,copy=True)
>>> data_gwpy = TimeSeries.from_pycbc(data_pycbc)
>>> print "gwpy dur:", data.duration, "pycbc dur:", data_pycbc.duration, "new gwpy dur:", data_gwpy.duration
gwpy dur: 32.0 s pycbc dur: 32.0 new gwpy dur: 32.0 s
>>> print "gwpy dt:", data.dt, "pycbc dt:", data_pycbc.delta_t, "new gwpy dt:", data_gwpy.dt
gwpy dt: 0.000244140625 s pycbc dt: 0.000244140625 new gwpy dt: 0.000244140625 s
(These examples were done on ldas-pcdev1 @ CIT with the ~detchar/opt/gwpysoft/bin/activate
environment sourced)