Help with Challenge 1

Hi. This might be dumb. How do I find the sampling rate and duration of a signal that we download?. In this case challenge1.gwf.

The sample rate is stored as an attribute with each timeseries object. The duration you can find as the length of the vector times the sample time. For example, you could try something like this:

# -- for pycbc
from pycbc import frame
pycbc_strain = frame.read_frame('challenge1.gwf', 'H1:CHALLENGE1')
dt = pycbc_strain.delta_t
duration = len(pycbc_strain)*dt
print(duration)
2 Likes

This gives an error
RuntimeError: Internal function call failed: Invalid argument
How to find the solution?

Hi Ajay,

Can you post the line in question as you wrote it and the entire backtrace? That can help in debugging.

Hi Martin
I have use this
from pycbc import frame
pycbc_strain = frame.read_frame(‘challenge2.gwf’, ‘H1:CHALLENGE2’)
dt = pycbc_strain.delta_t
duration = len(pycbc_strain)*dt
print(duration)

At first sight it could be that the file challenge2.gwf is not in a directory accessible from your notebook. Try writing the absolute path for the file. If it doesn’t work, remember to copy here the entire backtrace for the error you get.