Changes
Page history
Update comp_snr_ts
authored
Mar 11, 2021
by
Kentaro Mogushi
Show whitespace changes
Inline
Side-by-side
home/comp_snr_ts.md
View page @
dfb072e1
...
...
@@ -78,7 +78,7 @@ plt.close()
```

-
- find the snr time series in pycbc
-
find the snr time series in
**
pycbc
**
```
# let's do the same thing in pycbc object
d_pycbc = d_gwpy.to_pycbc()
...
...
@@ -105,3 +105,28 @@ print(optimal_snr)
```

-
find the snr time series in
**gwpy**
```
# find the optimal snr of the noise
d_pycbc = d_gwpy.to_pycbc()
psd = pycbc_interpolate(psd, d_pycbc.delta_f)
opt_snr_inj = pycbc.filter.matchedfilter.sigma(d_pycbc, psd=psd, low_frequency_cutoff=10, high_frequency_cutoff=1024)
print('optimal SNR of the noise: {:.2f}'.format(opt_snr_inj))
d_pycbc_dummy = d_pycbc.copy()
peak_time_index = np.argmax(d_pycbc.data)
peak_time = d_pycbc.sample_times.data[peak_time_index]
peak_window_start_index = peak_time_index - int(d_pycbc.sample_rate * 1)
peak_window_end_index = peak_time_index + int(d_pycbc.sample_rate * 1)
d_pycbc_dummy = d_pycbc_dummy.cyclic_time_shift(np.round(d_pycbc.sample_times.data[-1] - peak_time, 3))
snr_timeseries_n = pycbc.filter.matchedfilter.matched_filter(d_pycbc_dummy, d_pycbc, psd=psd, low_frequency_cutoff=10, high_frequency_cutoff=1024)
plt.plot(snr_timeseries_n.sample_times, np.abs(snr_timeseries_n.data))
plt.savefig('test.png')
plt.close()
optimal_snr = np.abs(snr_timeseries_n.data)[peak_window_start_index: peak_window_end_index].max()
print(optimal_snr)
```

\ No newline at end of file