inspiral_range function bugged when SNR!=8
Created by: dethodav
When using the gpwy.astro.inspiral_range()
function, there is an issue with the calculated range when snr!=8
. The following example demonstrates the problem:
from gwosc.datasets import event_gps
from gwpy.timeseries import TimeSeries
from gwpy.astro import sensemon_range, inspiral_range
gps = event_gps("GW150914")
data = TimeSeries.fetch_open_data('L1', gps-32, gps+32, cache=True)
psd = data.psd(4,2)
snrs = [2,8,16]
fmin = 10
fmax = 100
for s in snrs:
print('SNR = %d'%s)
r_sensemon = sensemon_range(psd, fmin=fmin, fmax=fmax, snr=s)
r_astro = inspiral_range(psd, fmin=fmin, fmax=fmax, snr=s)
print('sensemon range: %.2f Mpc'%r_sensemon.value)
print('inspiral range: %.2f Mpc'%r_astro.value)
print('ratio, sensemon/inspiral: %.2f'%(r_sensemon.value/r_astro.value))
print()
This returns:
SNR = 2
sensemon range: 175.12 Mpc
inspiral range: 42.60 Mpc
ratio, sensemon/inspiral: 4.11
SNR = 8
sensemon range: 43.78 Mpc
inspiral range: 42.72 Mpc
ratio, sensemon/inspiral: 1.02
SNR = 16
sensemon range: 21.89 Mpc
inspiral range: 36.23 Mpc
ratio, sensemon/inspiral: 0.60
While the sensemon range function returns sensible results, there is (roughly) a , missing factor of 8 / SNR
in the inspired range calculation. This is likely due to the sir value not being passed to range_func()
here:
https://github.com/gwpy/gwpy/blob/main/gwpy/astro/range.py#L439