Add missing detection_snr argument
This PR addresses #1614 to correctly pass the detection_snr argument to inspiral_range.range().
With this update, the inspired_range() function returns sensible values:
>>> 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()
...
SNR = 2
sensemon range: 175.12 Mpc
inspiral range: 168.06 Mpc
ratio, sensemon/inspiral: 1.04
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: 21.42 Mpc
ratio, sensemon/inspiral: 1.02
Closes #1614
Codecov Report
Merging #1615 (055e4e1) into main (eee114f) will increase coverage by
0.0%. The diff coverage isn/a.
@@ Coverage Diff @@
## main #1615 +/- ##
======================================
Coverage 94.2% 94.3%
======================================
Files 238 239 +1
Lines 18282 18391 +109
======================================
+ Hits 17232 17343 +111
+ Misses 1050 1048 -2
| Flag | Coverage Δ | |
|---|---|---|
| Conda | 94.1% <ø> (+<0.1%) |
:arrow_up: |
| Linux | 94.3% <ø> (+<0.1%) |
:arrow_up: |
| Windows | 84.5% <ø> (+0.1%) |
:arrow_up: |
| macOS | 93.4% <ø> (-0.1%) |
:arrow_down: |
| python3.10 | 94.0% <ø> (+<0.1%) |
:arrow_up: |
| python3.11 | 94.0% <ø> (+<0.1%) |
:arrow_up: |
| python3.7 | 82.4% <ø> (-11.6%) |
:arrow_down: |
| python3.8 | 94.0% <ø> (+<0.1%) |
:arrow_up: |
| python3.9 | 94.0% <ø> (+<0.1%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| gwpy/astro/range.py | 98.3% <ø> (ø) |
... and 13 files with indirect coverage changes
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
@duncanmmacleod I just updated this PR - it should be ready for you to look over again
I have requested some pedantic formatting changes (unsurprisingly), but would also like to ask that you update
pyproject.tomlto include the minimum version requirement forinspiral-range. Thedetection_snrkeyword was first added in 0.9.0 [ref].
@dethodav, sorry for the delay, can you update the package metadata to include the new minimum version requirement?