Changes
Page history
Create home/comp_snr_ts
authored
Mar 11, 2021
by
Kentaro Mogushi
Show whitespace changes
Inline
Side-by-side
home/comp_snr_ts.md
0 → 100644
View page @
5c541fa4
```
# calculate the optimal snr in raw scale
y_inj_pycbc = scaled_projected_wf_dict['L1_y_inj_pycbc']
y_inj_pycbc = scaled_projected_wf_dict['L1_y_inj_pycbc']
snr_ts_pycbc = scaled_projected_wf_dict['L1_snr_ts']
psd = asd.to_pycbc() ** 2
psd = pycbc_interpolate(psd, y_inj_pycbc.delta_f)
opt_snr_inj = pycbc.filter.matchedfilter.sigma(y_inj_pycbc, psd=psd, low_frequency_cutoff=10,
high_frequency_cutoff=1024)
print('optimal SNR of the injection: {:.2f}'.format(opt_snr_inj))
# calculate the optimal snr in whiten scale
whitened_y_inj_pycbc = whitened_scaled_projected_wf_dict['L1_y_inj_pycbc']
whitened_y_inj_pycbc_dummy = whitened_scaled_projected_wf_dict['L1_y_inj_pycbc_dummy']
whitened_gwpy = d_gwpy.whiten(asd=asd, fduration=2, method='median')
asd_whitened = calcualte_asd(whitened_gwpy)
psd_whitened = asd_whitened.to_pycbc() ** 2
psd_whitened = pycbc_interpolate(psd_whitened, y_inj_pycbc.delta_f)
opt_snr_inj = pycbc.filter.matchedfilter.sigma(whitened_y_inj_pycbc, psd=psd_whitened, low_frequency_cutoff=10, high_frequency_cutoff=1024)
print('optimal SNR of the injection: {:.2f}'.format(opt_snr_inj))
snr_timeseries_inj = pycbc.filter.matchedfilter.matched_filter(whitened_y_inj_pycbc_dummy, whitened_y_inj_pycbc, psd=psd_whitened,
low_frequency_cutoff=10,
high_frequency_cutoff=1024)
plt.plot(snr_timeseries_inj.sample_times, np.abs(snr_timeseries_inj.data) , label='whitened scale')
plt.plot(snr_ts_pycbc.sample_times, np.abs(snr_ts_pycbc.data), label='raw scale')
plt.legend()
plt.savefig('test.png')
plt.close()
```
-
optimal SNR in whitened space is smaller than the SNR in raw scale by a factor of 2.

\ No newline at end of file