gwastro / pycbc

Core package to analyze gravitational-wave data, find signals, and study their parameters. This package was used in the first direct detection of gravitational waves (GW150914), and is used in the ongoing analysis of LIGO/Virgo data.
http://pycbc.org
GNU General Public License v3.0
315 stars 349 forks source link

Convert NumPy Array to pycbc.types.timeseries.TimeSeries #2447

Closed arjung128 closed 5 years ago

arjung128 commented 5 years ago

I'd like to convert my NumPy array which represents a gravitational wave with 8192 time-steps into pycbc.types.timeseries.TimeSeries to be able to use the match function -- how can I go about doing this?

micamu commented 5 years ago

Assuming that you know what the time step (delta_t) and the start time (epoch) of the waveform is, you just need to do

from pycbc.types import TimeSeries
gw_timeseries = TimeSeries(numpy_array, delta_t=time_step, epoch=start_time)

with 'numpy_array' your array (if you skip the 'epoch' option then it will just set gw_timeseries.start_time to 0)